@@ -258,17 +258,17 @@ internal override object Internal_TryCast(object obj, Type castTo)
258
258
}
259
259
}
260
260
261
- private static bool IsAssignableFrom ( Type thisType , Type fromType )
262
- {
263
- if ( ! Il2CppTypeNotNull ( fromType , out IntPtr fromTypePtr )
264
- || ! Il2CppTypeNotNull ( thisType , out IntPtr thisTypePtr ) )
265
- {
266
- // one or both of the types are not Il2Cpp types, use normal check
267
- return thisType . IsAssignableFrom ( fromType ) ;
268
- }
269
-
270
- return il2cpp_class_is_assignable_from ( thisTypePtr , fromTypePtr ) ;
271
- }
261
+ // private static bool IsAssignableFrom(Type thisType, Type fromType)
262
+ // {
263
+ // if (!Il2CppTypeNotNull(fromType, out IntPtr fromTypePtr)
264
+ // || !Il2CppTypeNotNull(thisType, out IntPtr thisTypePtr))
265
+ // {
266
+ // // one or both of the types are not Il2Cpp types, use normal check
267
+ // return thisType.IsAssignableFrom(fromType);
268
+ // }
269
+ //
270
+ // return il2cpp_class_is_assignable_from(thisTypePtr, fromTypePtr);
271
+ // }
272
272
273
273
#endregion
274
274
@@ -450,42 +450,35 @@ internal override void Internal_FindSingleton(string[] possibleNames, Type type,
450
450
451
451
#region Force-loading game modules
452
452
453
- // Helper for IL2CPP to try to make sure the Unhollowed game assemblies are actually loaded.
454
-
455
- internal override bool Internal_LoadModule ( string moduleName )
456
- {
457
- if ( ! moduleName . EndsWith ( ".dll" , StringComparison . InvariantCultureIgnoreCase ) )
458
- moduleName += ".dll" ;
453
+ internal static string UnhollowedFolderPath => Path . GetFullPath (
459
454
#if ML
460
- var path = Path . Combine ( "MelonLoader" , "Managed" , $ "{ moduleName } ") ;
455
+ Path . Combine ( "MelonLoader" , "Managed" )
456
+ #elif BIE
457
+ Path . Combine ( "BepInEx" , "unhollowed" )
461
458
#else
462
- var path = Path . Combine ( "BepInEx" , "unhollowed" , $ " { moduleName } " ) ;
459
+ Path . Combine ( ExplorerCore . Loader . ExplorerFolder , "Modules" )
463
460
#endif
464
- return DoLoadModule ( path ) ;
465
- }
461
+ ) ;
462
+
463
+ // Helper for IL2CPP to try to make sure the Unhollowed game assemblies are actually loaded.
464
+
465
+ //internal override bool Internal_LoadModule(string moduleName)
466
+ //{
467
+ // if (!moduleName.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase))
468
+ // moduleName += ".dll";
469
+ //
470
+ // return DoLoadModule(Path.Combine(UnhollowedFolderPath, moduleName));
471
+ //}
466
472
467
473
// Force loading all il2cpp modules
468
474
469
475
internal void TryLoadGameModules ( )
470
476
{
471
- string dirpath =
472
- #if ML
473
- Path . Combine ( "MelonLoader" , "Managed" ) ;
474
- #elif BIE
475
- Path . Combine ( "BepInEx" , "unhollowed" ) ;
476
- #else
477
- Path . Combine ( ExplorerCore . Loader . ExplorerFolder , "Modules" ) ;
478
- #endif
479
- ;
480
-
481
- if ( Directory . Exists ( dirpath ) )
477
+ if ( Directory . Exists ( UnhollowedFolderPath ) )
482
478
{
483
- var files = Directory . GetFiles ( dirpath ) ;
479
+ var files = Directory . GetFiles ( UnhollowedFolderPath ) ;
484
480
foreach ( var filePath in files )
485
481
{
486
- var name = Path . GetFileName ( filePath ) ;
487
- if ( ! name . StartsWith ( "Unity" ) && ! name . StartsWith ( "Assembly-CSharp" ) )
488
- continue ;
489
482
try
490
483
{
491
484
DoLoadModule ( filePath , true ) ;
@@ -496,6 +489,8 @@ internal void TryLoadGameModules()
496
489
}
497
490
}
498
491
}
492
+ else
493
+ ExplorerCore . LogWarning ( $ "Expected Unhollowed folder path does not exist: '{ UnhollowedFolderPath } '") ;
499
494
}
500
495
501
496
internal bool DoLoadModule ( string fullPath , bool suppressWarning = false )
@@ -505,7 +500,8 @@ internal bool DoLoadModule(string fullPath, bool suppressWarning = false)
505
500
506
501
try
507
502
{
508
- Assembly . Load ( File . ReadAllBytes ( fullPath ) ) ;
503
+ Assembly . LoadFile ( fullPath ) ;
504
+ //Assembly.Load(File.ReadAllBytes(fullPath));
509
505
return true ;
510
506
}
511
507
catch ( Exception e )
@@ -648,6 +644,9 @@ internal bool DoLoadModule(string fullPath, bool suppressWarning = false)
648
644
"UnityEngine.Scripting.GarbageCollector+CollectIncrementalDelegate.Invoke" ,
649
645
"UnityEngine.Scripting.GarbageCollector.CollectIncremental" ,
650
646
"UnityEngine.SpherecastCommand.ScheduleBatch" ,
647
+ "UnityEngine.Texture.GetPixelDataSize" ,
648
+ "UnityEngine.Texture.GetPixelDataOffset" ,
649
+ "UnityEngine.Texture.GetPixelDataOffset" ,
651
650
"UnityEngine.Texture2D+SetPixelDataImplArrayDelegate.Invoke" ,
652
651
"UnityEngine.Texture2D+SetPixelDataImplDelegate.Invoke" ,
653
652
"UnityEngine.Texture2D.SetPixelDataImpl" ,
@@ -669,6 +668,8 @@ internal bool DoLoadModule(string fullPath, bool suppressWarning = false)
669
668
#endregion
670
669
671
670
671
+ #region IL2CPP IEnumerable and IDictionary
672
+
672
673
protected override bool Internal_TryGetEntryType ( Type enumerableType , out Type type )
673
674
{
674
675
// Check for system types (not unhollowed)
@@ -713,8 +714,6 @@ protected override bool Internal_TryGetEntryTypes(Type type, out Type keys, out
713
714
return false ;
714
715
}
715
716
716
- #region Temp il2cpp list/dictionary fixes
717
-
718
717
// Temp fix until Unhollower interface support improves
719
718
720
719
internal static readonly Dictionary < string , MethodInfo > getEnumeratorMethods = new Dictionary < string , MethodInfo > ( ) ;
0 commit comments