AppModel: Build model by default in constructor
This commit is contained in:
@@ -213,7 +213,7 @@ namespace Il2CppInspector.CLI
|
||||
|
||||
AppModel appModel;
|
||||
using (new Benchmark("Create C++ application model")) {
|
||||
appModel = new AppModel(model).Build(options.UnityVersion, options.CppCompiler);
|
||||
appModel = new AppModel(model, makeDefaultBuild: false).Build(options.UnityVersion, options.CppCompiler);
|
||||
}
|
||||
|
||||
// C# signatures output
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Il2CppInspector.Model
|
||||
}
|
||||
|
||||
// Initialize
|
||||
public AppModel(TypeModel model) {
|
||||
public AppModel(TypeModel model, bool makeDefaultBuild = true) {
|
||||
// Save .NET type model
|
||||
TypeModel = model;
|
||||
|
||||
@@ -106,6 +106,10 @@ namespace Il2CppInspector.Model
|
||||
|
||||
// Get all symbols
|
||||
Symbols = Image.GetSymbolTable();
|
||||
|
||||
// Build if requested
|
||||
if (makeDefaultBuild)
|
||||
Build();
|
||||
}
|
||||
|
||||
// Build the application model targeting a specific version of Unity and C++ compiler
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Il2CppInspectorGUI
|
||||
|
||||
// Initialize (but don't build) application model
|
||||
// We will build the model after the user confirms the Unity version and target compiler
|
||||
AppModels.Add(new AppModel(typeModel));
|
||||
AppModels.Add(new AppModel(typeModel, makeDefaultBuild: false));
|
||||
}
|
||||
}
|
||||
// Unsupported architecture; ignore it
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Il2CppInspector
|
||||
// Act
|
||||
var inspectors = Il2CppInspector.LoadFromFile(testPath + @"\ArraysAndPointers-ARM64.so", testPath + @"\global-metadata.dat");
|
||||
var model = new TypeModel(inspectors[0]);
|
||||
var app = new AppModel(model).Build();
|
||||
var app = new AppModel(model);
|
||||
|
||||
// Assert
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Il2CppInspector
|
||||
int i = 0;
|
||||
foreach (var il2cpp in inspectors) {
|
||||
var model = new TypeModel(il2cpp);
|
||||
var appModel = new AppModel(model).Build(compiler: CppCompilerType.MSVC);
|
||||
var appModel = new AppModel(model, makeDefaultBuild: false).Build(compiler: CppCompilerType.MSVC);
|
||||
var nameSuffix = i++ > 0 ? "-" + (i - 1) : "";
|
||||
|
||||
new CSharpCodeStubs(model) {
|
||||
|
||||
Reference in New Issue
Block a user