From b9612676edd2ed899a0fb0c3ebde8bc3d7c65404 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Mon, 13 Jul 2020 20:23:07 +0200 Subject: [PATCH] AppModel: Include string literals in model --- Il2CppInspector.Common/Model/AppModel.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Il2CppInspector.Common/Model/AppModel.cs b/Il2CppInspector.Common/Model/AppModel.cs index c0b933c..4a53f1f 100644 --- a/Il2CppInspector.Common/Model/AppModel.cs +++ b/Il2CppInspector.Common/Model/AppModel.cs @@ -46,6 +46,11 @@ namespace Il2CppInspector.Model // Composite mapping of all the .NET types in the IL2CPP binary public MultiKeyDictionary Types = new MultiKeyDictionary(); + // 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 + public Dictionary Strings = new Dictionary(); + // The .NET type model for the application public TypeModel ILModel { get; } @@ -143,6 +148,11 @@ namespace Il2CppInspector.Model var address = usage.VirtualAddress; switch (usage.Type) { + case MetadataUsageType.StringLiteral: + var str = ILModel.GetMetadataUsageName(usage); + Strings.Add(address, str); + break; + case MetadataUsageType.Type: case MetadataUsageType.TypeInfo: var type = ILModel.GetMetadataUsageType(usage); @@ -169,8 +179,6 @@ namespace Il2CppInspector.Model } } - // TODO: Build composite types - // This is to allow this method to be chained after a new expression return this; }