Closed SwiTool closed 1 year ago
I don't know exactly how I fixed this, but surely due to a Clean Build and a typo correction
<!-- IL2CPP References -->
<ItemGroup Condition="'$(Configuration)'=='IL2CPP'">
- <Reference Include="UniverseLib.IL2CPP.Unhlolloer">
+ <Reference Include="UniverseLib.IL2CPP.Unhollower">
<HintPath>packages\UniverseLib.IL2CPP.Unhollower.X.X.X\lib\net472\UniverseLib.IL2CPP.Unhollower.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
Though, I still have the second error in the log :
[21:57:04.106] [ERROR] Exception in IL2CPP-to-Managed trampoline, not passing it to il2cpp: System.NullReferenceException: Object reference not set to an instance of an object
at UniverseLib.Universe.Patch (System.Type type, System.String methodName, HarmonyLib.MethodType methodType, System.Type[] arguments, System.Reflection.MethodInfo prefix, System.Reflection.MethodInfo postfix, System.Reflection.MethodInfo finalizer) [0x0012b] in <49afc313f5094db08cf47c312888dae9>:0
at UniverseLib.UI.UniversalUI.SetupAssetBundlePatches () [0x00028] in <49afc313f5094db08cf47c312888dae9>:0
at UniverseLib.UI.UniversalUI.LoadBundle () [0x00001] in <49afc313f5094db08cf47c312888dae9>:0
at UniverseLib.UI.UniversalUI.Init () [0x00001] in <49afc313f5094db08cf47c312888dae9>:0
at UniverseLib.Universe+<SetupCoroutine>d__23.MoveNext () [0x0009f] in <49afc313f5094db08cf47c312888dae9>:0
at UniverseLib.Runtime.Il2Cpp.Il2CppManagedEnumerator.MoveNext () [0x00000] in <49afc313f5094db08cf47c312888dae9>:0
at (wrapper dynamic-method) UniverseLib.Runtime.Il2Cpp.Il2CppManagedEnumerator.Trampoline_BooleanThisUniverseLib.Runtime.Il2Cpp.Il2CppManagedEnumeratorMoveNext(intptr,UnhollowerBaseLib.Runtime.Il2CppMethodInfo*)
Seems like a patching error. I referenced 0Harmony.dll
from Game_Data/MelonLoader/0Harmony.dll
. I will try with the official Harmony package tonight and see if it solves the problem.
I must say though that I successfully patched some methods with 0Harmony.dll so this shouldn't be a problem in my guess.
I'll do more tests and keep this thread updated.
EDIT: Nah it's the same..
I followed the guide here.
Though, here's my simple code:
And the error log
``` [21:56:57.690] ------------------------------ [21:56:57.690] ATestMod v0.0.1 [21:56:57.690] by SwiTool [21:56:57.691] Assembly: ATestMod.dll [21:56:57.692] ------------------------------ [21:56:57.693] ------------------------------ [21:56:57.693] MelonPreferencesManager v1.3.0 [21:56:57.694] by Sinai [21:56:57.695] Assembly: MelonPrefManager.IL2CPP.dll [21:56:57.695] ------------------------------ [21:56:57.697] ------------------------------ [21:56:57.697] UnityExplorer v4.9.0 [21:56:57.698] by Sinai [21:56:57.698] Assembly: UnityExplorer.ML.IL2CPP.dll [21:56:57.699] ------------------------------ [21:56:57.699] ------------------------------ [21:56:57.700] 3 Mods loaded. [21:56:57.863] Support Module Loaded: D:\Games\Il2cppTestGame\MelonLoader\Dependencies\SupportModules\Il2Cpp.dll [21:56:58.027] [ATestMod] [UniverseLib] UniverseLib 1.4.3 initializing... [21:56:58.433] [ATestMod] [WARNING] [UniverseLib] Expected Unhollowed folder path does not exist: ''. If you are using the standalone release, you can specify the Unhollowed modules path when you call CreateInstance(). [21:56:58.434] [ATestMod] [UniverseLib] Loaded Unhollowed modules in 0.001 seconds. [21:56:58.497] [ATestMod] [UniverseLib] Setup deobfuscation cache in 0.062 seconds. [21:56:58.500] [ATestMod] [UniverseLib] Finished UniverseLib initial setup. [21:56:58.503] [MelonPreferencesManager] [UniverseLib] UniverseLib 1.5.1 initializing... [21:56:58.507] [MelonPreferencesManager] [ERROR] System.ArgumentException: Type with FullName UniverseLib.UniversalBehaviour is already injected. Don't inject the same type twice, or use a different namespace at UnhollowerRuntimeLib.ClassInjector.RegisterTypeInIl2CppImpl (System.Type type, System.Boolean logSuccess, UnhollowerBaseLib.Runtime.VersionSpecific.Class.INativeClassStruct[] interfaces) [0x001c7] in <6f5e4ff5bbd94258ab8bd773251f8e6c>:0 at UnhollowerRuntimeLib.ClassInjector.RegisterTypeInIl2Cpp[T] () [0x00010] in <6f5e4ff5bbd94258ab8bd773251f8e6c>:0 at UniverseLib.UniversalBehaviour.Setup () [0x00001] inI'm using both UnityExplorer and MelonPreferencesManager. When I don't load my mod, they work just fine, but with my mod, nothing loads at all.
I've read the source code of MelonPreferencesManager but I can't see where i'm doing things wrong.
When I comment out the
UniverseLib.Universe.Init()
line, the error goes away.Any idea if bug of misusage ?