From 79521493dae9890eb390059743c82c794a27294b Mon Sep 17 00:00:00 2001 From: LukeFZ <17146677+LukeFZ@users.noreply.github.com> Date: Fri, 25 Jul 2025 21:21:43 +0200 Subject: [PATCH] expose forward definitions in AppModel, fix issue with method-only used types not being emitted --- Il2CppInspector.Common/Model/AppModel.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Il2CppInspector.Common/Model/AppModel.cs b/Il2CppInspector.Common/Model/AppModel.cs index 59822fc..d7127e7 100644 --- a/Il2CppInspector.Common/Model/AppModel.cs +++ b/Il2CppInspector.Common/Model/AppModel.cs @@ -40,6 +40,9 @@ namespace Il2CppInspector.Model // The types are ordered to enable the production of code output without forward dependencies public List DependencyOrderedCppTypes { get; private set; } + // Required forward definition types for the C++ type definitions + public List RequiredForwardDefinitions { get; private set; } = []; + // Composite mapping of all the .NET methods in the IL2CPP binary public MultiKeyDictionary Methods { get; } = new MultiKeyDictionary(); @@ -247,7 +250,7 @@ namespace Il2CppInspector.Model break; } - AddTypes(declarationGenerator.GenerateRemainingTypeDeclarations()); + AddTypes(definitions); // Any method here SHOULD already be in the Methods list // but we have seen one example where this is not the case for a MethodDef @@ -305,6 +308,8 @@ namespace Il2CppInspector.Model declarationGenerator.IncludeType(type); AddTypes(declarationGenerator.GenerateRemainingTypeDeclarations()); + RequiredForwardDefinitions = declarationGenerator.GenerateRequiredForwardDefinitions(); + // Restore stdout Console.SetOut(stdout);