@@ -17,6 +17,7 @@ public static class PureScriptBuilder
17
17
{
18
18
public static bool Enable ;
19
19
static string ScriptEngineDir ;
20
+ static string il2cppDir ;
20
21
static bool Inbuild = false ;
21
22
22
23
static PureScriptBuilder ( )
@@ -72,17 +73,18 @@ public static void BuildDll()
72
73
public static void RunBinderBeforeStrip ( System . String managedAssemblyFolderPath )
73
74
{
74
75
Inbuild = false ;
76
+ il2cppDir = managedAssemblyFolderPath ;
75
77
var managedPath = Path . Combine ( ScriptEngineDir , "Managed" ) ;
76
78
77
79
//copy all assemblys
78
- CopyManagedFile ( managedAssemblyFolderPath , managedPath ) ;
80
+ CopyManagedFile ( il2cppDir , managedPath ) ;
79
81
80
82
// call binder,bind adapter
81
83
CallBinder ( "Adapter" ) ;
82
84
83
85
// replace adapter by generated assembly
84
86
var generatedAdapter = Path . Combine ( managedPath , "Adapter.gen.dll" ) ;
85
- var adapterGenPath = Path . Combine ( managedAssemblyFolderPath , "Adapter.gen.dll" ) ;
87
+ var adapterGenPath = Path . Combine ( il2cppDir , "Adapter.gen.dll" ) ;
86
88
if ( File . Exists ( generatedAdapter ) )
87
89
{
88
90
File . Copy ( generatedAdapter , adapterGenPath , true ) ;
@@ -97,10 +99,11 @@ public static void RunBinderBeforeStrip(System.String managedAssemblyFolderPath)
97
99
public static void RunBinderBeforeIl2cpp ( string workingDirectory )
98
100
{
99
101
Inbuild = false ;
100
-
102
+ if ( workingDirectory != null )
103
+ il2cppDir = workingDirectory ;
101
104
//copy all striped assemblys
102
105
var managedPath = Path . Combine ( ScriptEngineDir , "Managed" ) ;
103
- CopyManagedFile ( workingDirectory , managedPath ) ;
106
+ CopyManagedFile ( il2cppDir , managedPath ) ;
104
107
105
108
// call binder,bind icall and adapter
106
109
CallBinder ( "All" ) ;
@@ -214,8 +217,33 @@ static void CreateOrCleanDirectory(string dir)
214
217
static MethodHooker stripHooker ;
215
218
static MethodHooker il2cppHooker ;
216
219
220
+ #if UNITY_2020_1_OR_NEWER
221
+ public static void RunIl2CppWithArguments ( object obj , List < string > arguments , Action < System . Diagnostics . ProcessStartInfo > setupStartInfo )
222
+ {
223
+
224
+ if ( il2cppHooker != null )
225
+ {
226
+ il2cppHooker . Dispose ( ) ;
227
+ il2cppHooker = null ;
228
+ }
229
+
230
+ RunBinderBeforeIl2cpp ( null ) ;
231
+
232
+ // call the realy method
233
+ if ( obj != null )
234
+ RunIl2CppWithArgumentsWrap ( obj , arguments , setupStartInfo ) ;
235
+ }
236
+
237
+ //redirect to IL2CPPBuilder.RunIl2CppWithArguments
238
+ public static void RunIl2CppWithArgumentsWrap ( object obj , List < string > arguments , Action < System . Diagnostics . ProcessStartInfo > setupStartInfo )
239
+ {
240
+ throw new NotImplementedException ( ) ;
241
+ }
242
+
243
+ #else
217
244
public static void RunIl2CppWithArguments ( object obj , List < string > arguments , Action < System . Diagnostics . ProcessStartInfo > setupStartInfo , string workingDirectory )
218
245
{
246
+
219
247
if ( il2cppHooker != null )
220
248
{
221
249
il2cppHooker . Dispose ( ) ;
@@ -234,7 +262,7 @@ public static void RunIl2CppWithArgumentsWrap(object obj, List<string> arguments
234
262
{
235
263
throw new NotImplementedException ( ) ;
236
264
}
237
-
265
+ #endif
238
266
239
267
#if UNITY_2019_1_OR_NEWER
240
268
public static void StripAssemblies ( string managedAssemblyFolderPath , object unityLinkerPlatformProvider , object il2cppPlatformProvider , object rcr , ManagedStrippingLevel managedStrippingLevel )
0 commit comments