LibCpp2IL can be initialized using two methods. Note that debug logging is enabled by default, which will output extensive timing and loading data to the Console. You must provide the Unity version as an integer array (e.g., new [] {2019, 2, 0}).
From the hard drive
Use LibCpp2IlMain.LoadFromFile by providing the paths to the game assembly and the global metadata.
From a byte array
Use LibCpp2IlMain.Initialize if you have already loaded the file contents into memory.
// From the hard drive
var unityVersion = new [] {2019, 2, 0};
if (!LibCpp2IlMain.LoadFromFile(gameAssemblyPath, globalMetadataPath, unityVersion)) {
Console.WriteLine("initialization failed!");
return;
}
// From a byte array
var unityVersion = new [] {2019, 2, 0};
if (!LibCpp2IlMain.Initialize(gameAssemblyBytes, globalMetadataBytes, unityVersion)) {
Console.WriteLine("initialization failed!");
return;
}