yukieiji / UnityExplorer

An in-game UI for exploring, debugging and modifying IL2CPP and Mono Unity games.
GNU General Public License v3.0
211 stars 14 forks source link

[Bug]: #4

Closed SumScriptKiddie closed 12 months ago

SumScriptKiddie commented 12 months ago

Are you on the latest version of UnityExplorer?

Which release are you using?

MelonLoader IL2CPP

Which game did this occur on?

[16:07:34.629] MelonLoader v0.6.1 Open-Beta [16:07:34.631] OS: Windows 10 [16:07:34.631] ------------------------------ [16:07:34.632] Game Type: Il2cpp [16:07:34.632] Game Arch: x64

[16:07:34.746] Game Name: Evony: The King's Return [16:07:34.747] Game Developer: topgamesinc [16:07:34.749] Unity Version: 2018.4.0f1 [16:07:34.749] Game Version: 4.56.1

Describe the issue.

Games loads fine initially but crashes when main ui scene loads

Relevant log output

[16:03:17.325] [UnityExplorer] UnityExplorer 4.10.0 initializing...
[16:03:17.355] [UnityExplorer] [UniverseLib] UniverseLib 1.5.4 initializing...
[16:03:17.359] Registered mono type UniverseLib.UniversalBehaviour in il2cpp domain
[16:03:17.876] Registered mono type UniverseLib.Runtime.Il2Cpp.Il2CppManagedEnumerator in il2cpp domain
[16:03:17.960] [UnityExplorer] [UniverseLib] Finished UniverseLib initial setup.
[16:03:17.975] Registered mono type UnityExplorer.ExplorerBehaviour in il2cpp domain
[16:03:26.337] [UnityExplorer] [UniverseLib] Loaded Unhollowed modules in 8.458 seconds.
[16:03:26.532] [UnityExplorer] [UniverseLib] Setup deobfuscation cache in 0.194 seconds.
[16:03:41.408] [UnityExplorer] [UniverseLib] Initialized Legacy Input support
[16:03:41.415] Exception in IL2CPP-to-Managed trampoline, not passing it to il2cpp: System.MissingMethodException: Method not found: 'Boolean Il2CppSystem.Type.op_Inequality(Il2CppSystem.Type, Il2CppSystem.Type)'.
   at UniverseLib.Universe.Patch(Type type, String methodName, MethodType methodType, Type[] arguments, MethodInfo prefix, MethodInfo postfix, MethodInfo finalizer)
   at UniverseLib.Input.CursorUnlocker.InitPatches()
   at UniverseLib.Input.CursorUnlocker.Init()
   at UniverseLib.Input.InputManager.Init()
   at UniverseLib.Universe.SetupCoroutine()+MoveNext()
   at UniverseLib.Runtime.Il2Cpp.Il2CppManagedEnumerator.MoveNext()
   at Trampoline_ByteThisUniverseLib.Runtime.Il2Cpp.Il2CppManagedEnumeratorMoveNext(IntPtr , Il2CppMethodInfo* )
yukieiji commented 12 months ago

I think it's an internal Il2Cpp method misreference(seems to be an error in this line), so either the file generated by MelonLoader or it's own installation is failing. Do other mods work properly? If work reinstall game and MelonLoader.

SumScriptKiddie commented 12 months ago

Other mods work fine on this game and i can get UnityExplorer to work on other games it just has issues with this game, let me know if there is any additional information i can help provide?

yukieiji commented 12 months ago

It is possible that only this game failed to generate files during MelonLoader initialization So please try to reinstall this game and MelonLoader first.

SumScriptKiddie commented 12 months ago

image image image image

SumScriptKiddie commented 12 months ago

Added images of steps just to help...

Uninstalled game, Redownloaded fresh install of game? Reinstalled game Installed latest melonloader Run game with just melonloader and no other mods (works fine) add unity explorer and same issue happens

Logs:

[10:36:28.365] Loading Mods from 'C:\Program Files\TopGames\Evony\Game\249626\Mods'... [10:36:28.367] ------------------------------ [10:36:29.106] Melon Assembly loaded: '.\Mods\UnityExplorer.ML.IL2CPP.CoreCLR.dll' [10:36:29.106] SHA256 Hash: '08752b0aec25b200fcfc424b50e0f9cec0039daf2f5239588031a1e579585060'

[10:36:30.188] ------------------------------ [10:36:30.188] UnityExplorer v4.10.0 [10:36:30.188] by Sinai, yukieiji [10:36:30.189] Assembly: UnityExplorer.ML.IL2CPP.CoreCLR.dll [10:36:30.190] ------------------------------ [10:36:30.190] ------------------------------ [10:36:30.190] 1 Mod loaded.

[10:36:31.082] Registered mono type Il2CppInterop.Runtime.DelegateSupport+Il2CppToMonoDelegateReference in il2cpp domain [10:36:31.124] Registered mono type MelonLoader.Support.MonoEnumeratorWrapper in il2cpp domain [10:36:31.132] Registered mono type MelonLoader.Support.SM_Component in il2cpp domain [10:36:31.152] Support Module Loaded: C:\Program Files\TopGames\Evony\Game\249626\MelonLoader\Dependencies\SupportModules\Il2Cpp.dll [10:36:31.186] [UnityExplorer] UnityExplorer 4.10.0 initializing... [10:36:31.211] [UnityExplorer] [UniverseLib] UniverseLib 1.5.4 initializing... [10:36:31.213] Registered mono type UniverseLib.UniversalBehaviour in il2cpp domain [10:36:31.559] Registered mono type UniverseLib.Runtime.Il2Cpp.Il2CppManagedEnumerator in il2cpp domain [10:36:31.641] [UnityExplorer] [UniverseLib] Finished UniverseLib initial setup. [10:36:31.655] Registered mono type UnityExplorer.ExplorerBehaviour in il2cpp domain [10:36:41.356] [UnityExplorer] [UniverseLib] Loaded Unhollowed modules in 9.795 seconds. [10:36:41.530] [UnityExplorer] [UniverseLib] Setup deobfuscation cache in 0.17300001 seconds. [10:36:41.533] [UnityExplorer] [UniverseLib] Initialized Legacy Input support [10:36:41.537] Exception in IL2CPP-to-Managed trampoline, not passing it to il2cpp: System.MissingMethodException: Method not found: 'Boolean Il2CppSystem.Type.op_Inequality(Il2CppSystem.Type, Il2CppSystem.Type)'. at UniverseLib.Universe.Patch(Type type, String methodName, MethodType methodType, Type[] arguments, MethodInfo prefix, MethodInfo postfix, MethodInfo finalizer) at UniverseLib.Input.CursorUnlocker.InitPatches() at UniverseLib.Input.CursorUnlocker.Init() at UniverseLib.Input.InputManager.Init() at UniverseLib.Universe.SetupCoroutine()+MoveNext() at UniverseLib.Runtime.Il2Cpp.Il2CppManagedEnumerator.MoveNext() at Trampoline_ByteThisUniverseLib.Runtime.Il2Cpp.Il2CppManagedEnumeratorMoveNext(IntPtr , Il2CppMethodInfo* )

yukieiji commented 12 months ago

Will it work with older versions of MelonLoader (v5) and UnityExplorer.MelonLoader.IL2CPP?

SumScriptKiddie commented 12 months ago

feel like i tried that but happy to give it another whirl

SumScriptKiddie commented 12 months ago

image Latest.log

different issue? or maybe the same issue im not sure...

yukieiji commented 12 months ago

different issue? or maybe the same issue im not sure...

This seems to be an internal error in the MelonLoader process

May I ask you to create your own mod to see if there is a problem between MelonLoader and this game, and somewhere in the process write and run the code that compares the type to the type in the game?

SumScriptKiddie commented 12 months ago

I have made a simple mod that was working as seen below, i could also get the scenes and iterate through some of the game objects via reflect. Im not sure exactly what you mean by the type compare request? image

run the code that compares the type to the type in the game

yukieiji commented 12 months ago

I wanted a comparison between the class types of that game as I thought appropriate.

After some searching on my part, I found a ticket that reported a similar problem(https://github.com/LavaGang/MelonLoader/issues/524 ). according to the comments on the ticket, it isn't a bug, but a specification by Il2Cpp. So there is nothing I can approach...

SumScriptKiddie commented 12 months ago

image

this script is getting objects fine

        public override void OnUpdate()
        {
            if (Input.GetKeyDown(KeyCode.F))
            {
                MelonLogger.Msg("F Key was Pressed");
                List<GameObject> rootObjects = new List<GameObject>();
                Scene scene = SceneManager.GetActiveScene();
                scene.GetRootGameObjects(rootObjects);
                for (int i = 0; i < rootObjects.Count; ++i)
                {
                    MelonLogger.Msg(rootObjects[i].name);
                }
            } 
        }

and i can also use GetComponentsInChildren to filter through them

not sure if this shows that Melonloader is working correctly?

yukieiji commented 12 months ago

As I said in my comment above, I think the reason is that when this game was compiled with Il2Cpp, the methods required by UnityExplorer were stripped. So simple code may work, but the more complex code like UnityExplorer is, the more it will not work.

It is thought that if I investigate them and bypass the non-working methods for the working ones, it will work, but it takes a lot of time and effort to investigate them.

SumScriptKiddie commented 12 months ago

ahh ok, thanks for your help :D