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