@@ -14,28 +14,13 @@ public class Il2CppHandler
1414
1515 static Il2CppHandler ( )
1616 {
17- InstructionSetRegistry . RegisterInstructionSet < X86InstructionSet > ( DefaultInstructionSets . X86_32 ) ;
18- InstructionSetRegistry . RegisterInstructionSet < X86InstructionSet > ( DefaultInstructionSets . X86_64 ) ;
19- InstructionSetRegistry . RegisterInstructionSet < WasmInstructionSet > ( DefaultInstructionSets . WASM ) ;
20- InstructionSetRegistry . RegisterInstructionSet < ArmV7InstructionSet > ( DefaultInstructionSets . ARM_V7 ) ;
21- bool useNewArm64 = false ;
22- if ( useNewArm64 )
23- {
24- InstructionSetRegistry . RegisterInstructionSet < NewArmV8InstructionSet > ( DefaultInstructionSets . ARM_V8 ) ;
25- }
26- else
27- {
28- InstructionSetRegistry . RegisterInstructionSet < Arm64InstructionSet > ( DefaultInstructionSets . ARM_V8 ) ;
29- }
30-
31- LibCpp2IlBinaryRegistry . RegisterBuiltInBinarySupport ( ) ;
17+ Cpp2IlApi . Init ( ) ;
18+ Cpp2IlApi . ConfigureLib ( false ) ;
3219 }
3320
3421 public static void Initialize ( byte [ ] assemblyData , byte [ ] metadataData , string unityVersionString )
3522 {
3623 unityVersion = UnityVersion . Parse ( unityVersionString ) ;
37- Cpp2IlApi . Init ( ) ;
38- Cpp2IlApi . ConfigureLib ( false ) ;
3924 Cpp2IlApi . InitializeLibCpp2Il ( assemblyData , metadataData , unityVersion , false ) ;
4025 }
4126
@@ -60,6 +45,7 @@ public static void Initialize(byte[] assemblyData, byte[] metadataData, string u
6045 var assemblyResolver = new AssemblyResolver ( ) ;
6146 foreach ( var assembly in outputFormat . BuildAssemblies ( Cpp2IlApi . CurrentAppContext ! ) )
6247 {
48+ assemblyResolver . AddToCache ( assembly . ManifestModule . Name , assembly ) ;
6349 foreach ( var module in assembly . Modules )
6450 {
6551 module . MetadataResolver = new AsmResolver . DotNet . DefaultMetadataResolver ( assemblyResolver ) ;
@@ -72,6 +58,11 @@ public class AssemblyResolver : AsmResolver.DotNet.IAssemblyResolver
7258 {
7359 public Dictionary < string , AsmResolver . DotNet . AssemblyDefinition > assemblyDefinitions = new ( ) ;
7460
61+ public void AddToCache ( string name , AsmResolver . DotNet . AssemblyDefinition definition )
62+ {
63+ assemblyDefinitions [ name ] = definition ;
64+ }
65+
7566 public void AddToCache ( AsmResolver . DotNet . AssemblyDescriptor descriptor , AsmResolver . DotNet . AssemblyDefinition definition )
7667 {
7768 assemblyDefinitions [ descriptor . Name ] = definition ;
0 commit comments