From b7c93ffcc7c5c65aa35448bdf89160f13088ac38 Mon Sep 17 00:00:00 2001 From: Robert Xiao Date: Tue, 16 Jun 2020 19:58:15 -0700 Subject: [PATCH] Type string literals as System.String --- Il2CppInspector.Common/Outputs/CppDeclarations.cs | 2 +- Il2CppInspector.Common/Outputs/IDAPythonScript.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Il2CppInspector.Common/Outputs/CppDeclarations.cs b/Il2CppInspector.Common/Outputs/CppDeclarations.cs index 4b6496b..1e21a98 100644 --- a/Il2CppInspector.Common/Outputs/CppDeclarations.cs +++ b/Il2CppInspector.Common/Outputs/CppDeclarations.cs @@ -52,7 +52,7 @@ namespace Il2CppInspector.Outputs } } - private string AsCType(TypeInfo ti) { + public string AsCType(TypeInfo ti) { // IsArray case handled by TypeNamer.GetName if (ti.IsByRef || ti.IsPointer) { return $"{AsCType(ti.ElementType)} *"; diff --git a/Il2CppInspector.Common/Outputs/IDAPythonScript.cs b/Il2CppInspector.Common/Outputs/IDAPythonScript.cs index bacf783..be9891f 100644 --- a/Il2CppInspector.Common/Outputs/IDAPythonScript.cs +++ b/Il2CppInspector.Common/Outputs/IDAPythonScript.cs @@ -144,6 +144,7 @@ typedef __int64 int64_t; return; } + var stringType = typeGenerator.AsCType(model.TypesByFullName["System.String"]); foreach (var usage in model.Package.MetadataUsages) { var address = usage.VirtualAddress; string name; @@ -151,7 +152,7 @@ typedef __int64 int64_t; switch (usage.Type) { case MetadataUsageType.StringLiteral: var str = model.GetMetadataUsageName(usage); - writeName(address, $"StringLiteral_{stringToIdentifier(str)}"); + writeTypedName(address, stringType, $"StringLiteral_{stringToIdentifier(str)}"); writeComment(address, str); break; case MetadataUsageType.Type: