Add header files for every known Unity version.

We want to get types into the IDA output, and to do that we need
accurate types for the Il2Cpp structures. Unfortunately, some crucial
types like Il2CppClass change between versions without any corresponding
metadata changes, meaning that we have to manually identify the version
outside of the Inspector somehow (e.g. by looking at the version number
embedded in Unity asset files). This patch adds header files for *every*
known Unity version from 5.3.0 to 2019.3.8, merging them into version
ranges where header files don't change.

It also adds front-end support for supplying the version number in both
the CLI and GUI. The GUI is given the ability to guess the version
number approximately to reduce the number of choices presented to the
user.
This commit is contained in:
Robert Xiao
2020-04-14 02:09:39 -07:00
committed by Katy
parent b87d82fd11
commit 34f0d4ceef
32 changed files with 27176 additions and 9 deletions

View File

@@ -6,10 +6,10 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using CommandLine;
using Il2CppInspector.Reflection;
using Il2CppInspector.Outputs;
using Il2CppInspector.Outputs.UnityHeaders;
namespace Il2CppInspector.CLI
{
@@ -71,6 +71,9 @@ namespace Il2CppInspector.CLI
[Option("unity-assemblies", Required = false, HelpText = "Path to Unity script assemblies (when using --project). Wildcards select last matching folder in alphanumeric order", Default = @"C:\Program Files\Unity\Hub\Editor\*\Editor\Data\Resources\PackageManager\ProjectTemplates\libcache\com.unity.template.3d-*\ScriptAssemblies")]
public string UnityAssembliesPath { get; set; }
[Option("unity-version", Required = false, HelpText = "Version of Unity used to create the input files, if known. Used to enhance IDA Python script output. If not specified, a close match will be inferred automatically.", Default = null)]
public UnityVersion UnityVersion { get; set; }
}
// Adapted from: https://stackoverflow.com/questions/16376191/measuring-code-execution-time
@@ -233,7 +236,9 @@ namespace Il2CppInspector.CLI
// IDA Python script output
using (var scriptDumperTimer = new Benchmark("IDA Python Script Dumper")) {
var idaWriter = new IDAPythonScript(model);
var idaWriter = new IDAPythonScript(model) {
UnityVersion = options.UnityVersion,
};
idaWriter.WriteScriptToFile(options.PythonOutFile);
}
}