CLI: Fix multi-image suffix was only applied to types.cs
This commit is contained in:
@@ -201,9 +201,11 @@ namespace Il2CppInspector.CLI
|
|||||||
if (il2cppInspectors == null)
|
if (il2cppInspectors == null)
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
|
|
||||||
// Write output file
|
// Write output files for each binary
|
||||||
int i = 0;
|
int imageIndex = 0;
|
||||||
foreach (var il2cpp in il2cppInspectors) {
|
foreach (var il2cpp in il2cppInspectors) {
|
||||||
|
Console.WriteLine($"Processing image {imageIndex} - {il2cpp.BinaryImage.Arch} / {il2cpp.BinaryImage.Bits}-bit");
|
||||||
|
|
||||||
// Create model
|
// Create model
|
||||||
TypeModel model;
|
TypeModel model;
|
||||||
using (new Benchmark("Create .NET type model"))
|
using (new Benchmark("Create .NET type model"))
|
||||||
@@ -222,13 +224,7 @@ namespace Il2CppInspector.CLI
|
|||||||
MustCompile = options.MustCompile
|
MustCompile = options.MustCompile
|
||||||
};
|
};
|
||||||
|
|
||||||
var imageSuffix = i++ > 0 ? "-" + (i - 1) : "";
|
var csOut = getOutputPath(options.CSharpOutPath, "cs", imageIndex);
|
||||||
|
|
||||||
var csOut = options.CSharpOutPath;
|
|
||||||
if (csOut.ToLower().EndsWith(".cs"))
|
|
||||||
csOut = csOut.Insert(csOut.Length - 3, imageSuffix);
|
|
||||||
else
|
|
||||||
csOut += imageSuffix;
|
|
||||||
|
|
||||||
if (options.CreateSolution)
|
if (options.CreateSolution)
|
||||||
writer.WriteSolution(csOut, unityPath, unityAssembliesPath);
|
writer.WriteSolution(csOut, unityPath, unityAssembliesPath);
|
||||||
@@ -271,25 +267,39 @@ namespace Il2CppInspector.CLI
|
|||||||
|
|
||||||
// C++ output
|
// C++ output
|
||||||
using (new Benchmark("Generate C++ code")) {
|
using (new Benchmark("Generate C++ code")) {
|
||||||
new CppScaffolding(appModel).Write(options.CppOutPath);
|
new CppScaffolding(appModel).Write(getOutputPath(options.CppOutPath, "", imageIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSON output
|
// JSON output
|
||||||
using (new Benchmark("Generate JSON metadata")) {
|
using (new Benchmark("Generate JSON metadata")) {
|
||||||
new JSONMetadata(appModel).Write(options.JsonOutPath);
|
new JSONMetadata(appModel).Write(getOutputPath(options.JsonOutPath, "json", imageIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Python script output
|
// Python script output
|
||||||
using (new Benchmark($"Generate {options.ScriptTarget} Python script")) {
|
using (new Benchmark($"Generate {options.ScriptTarget} Python script")) {
|
||||||
new PythonScript(appModel).WriteScriptToFile(options.PythonOutFile,
|
new PythonScript(appModel).WriteScriptToFile(
|
||||||
|
getOutputPath(options.PythonOutFile, "py", imageIndex),
|
||||||
options.ScriptTarget,
|
options.ScriptTarget,
|
||||||
Path.Combine(options.CppOutPath, "appdata/il2cpp-types.h"),
|
Path.Combine(getOutputPath(options.CppOutPath, "", imageIndex), "appdata/il2cpp-types.h"),
|
||||||
options.JsonOutPath);
|
getOutputPath(options.JsonOutPath, "json", imageIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
imageIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Success exit code
|
// Success exit code
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string getOutputPath(string path, string extension, int suffix) {
|
||||||
|
if (suffix == 0)
|
||||||
|
return path;
|
||||||
|
var imageSuffix = "-" + suffix;
|
||||||
|
if (extension.Length > 0 && path.ToLower().EndsWith("." + extension))
|
||||||
|
path = path.Insert(path.Length - (extension.Length + 1), imageSuffix);
|
||||||
|
else
|
||||||
|
path += imageSuffix;
|
||||||
|
return path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user