Closed mnemonic-re closed 4 years ago
Hey, I think I will need more information before I can diagnose this one. Although it looks like it's the failed unstripping error.
Are you sure there is nothing in the MelonLoader console about CppExplorer? No errors or warnings?
If not, try this: Right-click the game in your Steam Library, then select Properties, then "Set Launch Options", and enter --melonloader.debug
.
Launch the game with debug logging, then re-create this problem (maybe try clicking on some stuff too?). Close the game, open the most recent log created in [GameFolder]\Logs\
, paste that to pastebin.com and send me the link.
Also, not too sure what you mean by "CppExplorer Wiki".... I have to assume you just mean the menu itself.
Hi.
No, no errors or warnings. It all loads perfectly and as game starts Console appears but it is as you see in picture above.
I clicked everything but nothing appears. Every button I click, nothing happens. Just black.
Sorry, by Wiki, I meant the Screenshots that are on the CppExplorer github :) They are full of various info and mine console is just black. Only thing I noticed is that when I turn the cursor off and browse the gameworld I can see some object names.
I will try --melonloader.debug in Steam. I used that argument in shortcut I created for the game. eg: "C:\games\game.exe" --melonloader.debug and make the log.
Ah right I got you. I've noticed sometimes exceptions being silently supressed unless I wrap it in my own try/catch, that could be what is happening here.
Mind if I ask which game this is on?
Ultimate Fishing Simulator
Lot of fun with modding and CppExplorer is great for scenes, repl and everything else!.
I will have logs ready for you soon.
PS. Game is Unity 2019.4.2 if that is of any interest.
I used debug build when I tried to compile it myself. Other Unity2018.dll is the same. Both DLL - blank console.
Ayaya, so many errors. It wasn't like this before :( But console still appears. It is 'broken' tho.
Ah I see, was hoping it was a free game but that's alright.
Hmm, 2019.4.2 you say? Looks like support for that version was added about 15 hours ago to ML, maybe you could try regenerating assemblies again if you haven't done since then? Just uninstall+reinstall ML and it should do it for you.
Yeah, I found and reported the bug in ML on their discord and it was fixed and added proper 2019 support :D
EDIT: If you want you can download Fishing Planet. It is free and uses same Unity version. Also not big GB wise.
Oh nice one!
Well yeah that looks more like what I expected haha, failed unstripping strikes again.
You could try removing every BeginScrollView
and EndScrollView
in the source, but I worry that you might just run into a different unstripping problem again. Worth a shot though I guess.
The other option is that I remake the entire GUI with UnityEngine.UI in the Editor, only issue with that is I think I would need to build lots of versions of the bundle for different Unity versions.
I will try to remove them but I fear my compilation will fail. Don't know why but I had lot of problems compiling the current source. Maybe my references were bad because I was getting a ton of issues about Input.KeyCode(etc...). Input - not defined. But will try.
I don't have Unity atm but will download.
Yeah you would have to fix the references, you'll need to replace my references with ones from your game folder.
And na don't worry about that, will be a big job to remake the UI in the editor, just something I might consider.
I'll download the free one soon and see what I can do, hopefully the same methods were stripped so I get the same error.
Allright, thanks for the help! I will follow this page and wait when you get the time to update.
I will try something in the meantime but now getting some weird errors heh... Severity Code Description Project File Line Suppression State Error CS0121 The call is ambiguous between the following methods or properties: 'GUILayout.Label(string, params GUILayoutOption[])' and 'GUILayout.Label(string, GUIStyle, params GUILayoutOption[])' CppExplorer C:\Users\reDEV\Desktop\IL2CPP\CppExplorer.1.5.1\CppExplorer-master\CppExplorer-master\CppExplorer-master\src\MainMenu\Pages\ConsolePage.cs 122 Active
Much appreciated answering my issue.
Best Regards!
Just had an idea, you said the REPL works fine? I wonder if the problem is only when I include a GUIStyle in the BeginScrollView, maybe if I move the GUIStyle outside of that it will work. I'll try that in a moment.
And hmm, odd, I usually get that error if I reference Mono assemblies instead of the MelonLoader/Managed/ ones.
Nah, nothing works. I just said I wish I had REPL :) Only thing that works are the 3 buttons and checkboxes.
My workspace is a mess. I was coding, compiling since yesterday, need to get organized haha
Ahh damn, nevermind then. Well I'm not optimistic about how it will look with no scrolling but I'll give it a shot.
I could try using ImGui.NET instead of Unity ImGUI and rule out the unstripping problem, I'll have to look into it and see if it suits us.
Worst case scenario is we just wait for knah or others to improve Unhollower's unstripping.
Well allright. Also, I won't tell you how to make your software but maybe do 1 thing at a time and see what works and then improve upon that until you get what you want!
If you can try I can test it immediately when you are done.
Yeah, Unhollower is still early so bugs are abound. But still, it does great job!
Oh nice! Well there you go, I guess the scrolling might have been the only thing that failed unstripping, interesting.
I'll post an official release shortly which will disable the scrolling if unstripping fails. Also installing the free Fishing Sim now, I'll update you here if I make any further progress with it. Might see if I can look into exactly what causes the unstripping to fail myself, or perhaps a workaround "fake" scrolling solution.
Thanks for being so helpful in debugging this one!
Awesome, can't wait! This Mod is far the best out there. Hope you get it sorted. Also I tried on Fishing Planet and it fails so you are not downloading in 'vain'. Same issues as in Ultimate Simulator.
Also, if you remember, let me know what exact problem was in unstripping, curious.
As for debugging, just give me more, I live for that :D
And a Q: How can I stabilize my mouse so that whole screen doesn't move? I tried one but it didnt work.
Best Regards.
Also another bug. If I click "Inspect" on Scene:
[15:39:15.872] [CppExplorer] System.NotSupportedException, Method unstripping failed [15:39:15.878] [CppExplorer] System.NotSupportedException, Method unstripping failed [15:39:19.901] [CppExplorer] System.NotSupportedException, Method unstripping failed [15:39:19.907] [CppExplorer] System.NotSupportedException, Method unstripping failed [15:39:25.340] [CppExplorer] System.NotSupportedException, Method unstripping failed [15:39:25.348] [CppExplorer] System.NotSupportedException, Method unstripping failed
Tried many, each time same error.
Ok good to know it's the same problem in Fishing Planet. I guess I could also just build a dummy project with the same Unity version and try that, should work too.
Not exactly sure what the problem is with unstripping, whether it's actually unsupported or if it's just not implemented yet, or something else.
I suspect there is an InnerException there we could check for which might tell us more, otherwise we'll have to look into the Unhollower's source to debug this any further.
And hmm, damn, more failed unstripping? Looks like that is GameObjectWindow
calling DestroyOnException
, I should have put better logging there. There isn't really anything different that I can see in there compared to the other windows, it's not just BeginScrollView failing again?
Scrolling is disabled as you instructed. But when I go to inspect a scene I get: [15:39:25.348] [CppExplorer] System.NotSupportedException, Method unstripping failed
I fear this might not be last unstrip error but no point in searching all. When one is found, then we can fix it.
Deeper debugging of this is a bit out of my league since I am not very familliar with Unity. I can code C# but Unity stuff, not so much :( For example, I don't know how to solve scrolling to work. I might try but it will take me a lot of time.
If you could tell me what to look at and try to change\add I will try.
Do you have any newer dll build I could test?
Didn't have much luck poking around in the free sim, so I went with the empty project idea, figured that will show me all of the GUI methods which can't be unstripped currently. Looks like there are a few, but honestly far less than I expected.
I added some verbose logging to the Unhollower's method unstripper so we can see exactly where each method is failing.
Personally I'm not really that knowledgeable about C# for this low-level type stuff, I would have to learn more about Emit etc to make much progress.
Apparently the error for BeginScrollView is due to an unsupported inline field.
We hit
bodyInstruction.OpCode.OperandType == OperandType.InlineField
Then it falls into
bodyInstruction.OpCode == OpCodes.Ldfld || bodyInstruction.OpCode == OpCodes.Ldsfld
And we fail the null check on
var getterMethod = fieldDeclarer.Resolve().Properties.SingleOrDefault(it => it.Name == fieldArg.Name)?.GetMethod;
Here's that release, sorry got a bit extracted working on that logging stuff lol, pretty much the same as the version you are running now though. https://github.com/sinai-dev/CppExplorer/releases/tag/1.5.3
Nice! Well progress is progress :) And to be honest now it works pretty well! I will try the new version and let you know.
Noticed fixes:
Did not notice any other bugs! Here is the log. Maybe it helps. But it seems I only got normal log output.
[18:03:42.174] Registered mono type Explorer.ReplHelper in il2cpp domain
[18:03:42.549] [CppExplorer] CppExplorer 1.5.3 initialized.
[18:03:43.018] [CppExplorer] Exception drawing ScenePage! UnhollowerBaseLib.Il2CppException, System.ArgumentException: Getting control 4's position in a group with only 4 controls when doing repaint
Aborting
>[18:03:43.026] [CppExplorer] at UnhollowerBaseLib.Il2CppException.RaiseExceptionIfNecessary (System.IntPtr returnedException) [0x00018] in <56ec66a01d45498298ce9793c60195c6>:0
at UnityEngine.GUILayout.BeginHorizontal (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnhollowerBaseLib.Il2CppReferenceArray`1[T] options) [0x0006e] in <1d1f4089bf91431e88d026debb0aac19>:0
at UnityEngine.GUILayout.BeginHorizontal (UnityEngine.GUIStyle style, UnhollowerBaseLib.Il2CppReferenceArray`1[T] options) [0x00006] in <1d1f4089bf91431e88d026debb0aac19>:0
at Explorer.ScenePage.DrawHeaderArea () [0x00141] in <6d1ae49880ed487d8bb1c8e83f92b6b7>:0
at Explorer.ScenePage.DrawWindow () [0x00002] in <6d1ae49880ed487d8bb1c8e83f92b6b7>:0
18:03:43.077] [CppExplorer] Exception on GuiResize: System.NotSupportedException, Method unstripping failed
[18:06:07.647] [CppExplorer] Exception drawing GameObject Window: UnhollowerBaseLib.Il2CppException, System.NullReferenceException: Object reference not set to an instance of an object.
EDIT: A question. About the REPL. What are the features? I used REPL when it was Mono and it was pretty basic and limited. Is there any document to read for this one?
Regards.
Thats great to hear! So it probably is just the scroll that failed, at least for that game.
I'll see if there's any kind of workaround for it, depending on how much is internal native calls I might even be able to just copy the unityengine source. Will get back to you.
Thanks man!
This tool is awesome, so much detail. Very good job!
Thanks! And my pleasure.
The REPL is as simple as it gets, and technically its just a "Read Evaluate Loop", no print. Literally just paste your code in there like its a method body and run it, take note of namespaces. Usually I write the code in the IDE and copy paste it.
I actually did that but: [18:25:30.538] [CppExplorer] [Warning] System.Exception, Mono.Csharp Service was unable to compile the code provided.
Last REPL I used was in some weird proxy and it was very limited. Mostly for returning values.
If it compiles as a method body in your IDE it should compile in the REPL. Does the starting example work? Just the hello world log.
Yes, Hello works but anything else I try does not.
Here is something for testing:
GUI.Label(new Rect(1000f, 380f, 500f, 30f), " Fish: ");
I am guessing it should show a Label. Unless I am completely missing the mark. There is no error but there is no result.
Yeah, Unity IMGUI can only be called inside OnGUI methods from a monobehaviour script.
This is a body of a method to draw. Outside OnGui:
WeatherDesc weatherDesc = new WeatherDesc();
GUI.Box(new Rect(40f, 700f, 300f, 300f), "--- WEATHER ---");
GUI.Label(new Rect(40f, 720f, 500f, 30f), "AirTemperature: " + weatherDesc.AirTemperature);
GUI.Label(new Rect(40f, 740f, 500f, 30f), "Pressure: " + weatherDesc.Pressure);
GUI.Label(new Rect(40f, 760f, 500f, 30f), "WaterTemperature: " + weatherDesc.WaterTemperature);
GUI.Label(new Rect(40f, 780f, 500f, 30f), "WindDirection: " + weatherDesc.WindDirection);
GUI.Label(new Rect(40f, 800f, 500f, 30f), "WindSpeed: " + weatherDesc.WindSpeed);
GUI.Label(new Rect(40f, 820f, 500f, 30f), "FishPlayFreq: " + weatherDesc.FishPlayFreq);
GUI.Label(new Rect(40f, 840f, 500f, 30f), "Name: " + weatherDesc.Name);
Console: replacing fieldspec for weatherDesc
Not sure, but any ImGUI wont work from REPL, ImGUI is designed to be called at least once per frame, the REPL only executes once and is then discarded.
If you need help with general mod development you should ask in the development-support channel of the MelonLoader discord, you'll get plenty of help there.
I will do that. Gonna test around a bit for now.
Anyway, thanks for all the help. When you get the time to update the mod, let me know. I will follow this issue.
Good day\night :)
Good news! Unity's ImGUI methods are mostly not internal native calls, so I was able to copy them directly and it seems to work fine. I manually unstripped all the relevant GUI methods which were failing unstripping, hopefully this should fix the problems for most games.
In Fishing Planet: https://i.gyazo.com/4a911f013514f5d9ee2475489679c144.mp4
(mouse-scroll still doesn't work, but I'm satisfied for now haha)
Going to close this for now, thanks again for your help debugging it!
Release: https://github.com/sinai-dev/CppExplorer/releases/tag/1.5.4
Awesome! It works great now! I also tested in Fishing Planet and I saw something interesting.
Do you know is this fake or somehow dumped? https://i.imgur.com/EICKJRX.png
I saw a guy edit a fishing planet lake geometry file in Unity. Is it possible to dump that or is it fake?
Awesome, thanks for testing 👍
It's probably real, you can use uTiny Ripper to dump games into Unity Editor project format, and open them with the Editor. It doesn't work great with Il2Cpp games though (scripts won't work), but you will be able to see all the other assets just fine.
More than happy to help you with mod development but this probably isn't the place for it, hit me up on Discord (or in the MelonLoader discord) and we can chat there.
Allright, thanks for the link! I will check it out.
And you are def. right, this really isn't the place :) Just got carried away haha! I will hit you up on Discord, I hope name is the same. I'm Robbie.
Regards.
All good, no worries! Yep I'm Sinai#4637 on Discord.
Hmm, weird. I try to add you on Melon discord:
Friend Request Failed. Double check that the capitalization, spelling, etc... are correct.
I can see you under "Modders" and I tried adding that way but still same error message.
If you can, please try: Robbie#1285
Hello.
I downloaded the release version (also tried to compile myself to see if anything is different) and plugin loaded.
But, I only get a "black" screen: https://i.imgur.com/ziAoOIt.png
While on the CppExplorer Wiki there are tons of options. Whatever I click, nothing happens and nothing shows up.
My game is Unity 2019.4.2 with latest MelonLoader.
There are no errors during Melon\Game startup and CppExplorer shows, but only what you see in that picture.
Can this be solved in any way? Thanks.