AppModel: Include string literals for il2cpp versions < 19

This commit is contained in:
Katy Coe
2020-07-14 17:00:12 +02:00
parent ef043383fc
commit f41fd74baa

View File

@@ -50,6 +50,7 @@ namespace Il2CppInspector.Model
// All of the string literals in the IL2CPP binary
// Note: Does not include string literals from global-metadata.dat
// Note: The virtual addresses are of String* (VAs of the pointer to String*) objects, not the strings themselves
// For il2cpp < 19, the key is the string literal ordinal instead of the address
public Dictionary<ulong, string> Strings = new Dictionary<ulong, string>();
// The .NET type model for the application
@@ -196,6 +197,16 @@ namespace Il2CppInspector.Model
}
}
else {
/* Version < 19 calls `il2cpp_codegen_string_literal_from_index` to get string literals.
* Unfortunately, metadata references are just loose globals in Il2CppMetadataUsage.cpp
* so we can't automatically name those. Next best thing is to define an enum for the strings. */
for (var i = 0; i < Package.StringLiterals.Length; i++) {
var str = Package.StringLiterals[i];
Strings.Add((ulong) i, str);
}
}
// This is to allow this method to be chained after a new expression
return this;
}