-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update MonoMod to 25.0.0, add Harmony 2.3 features #79
Conversation
keeps PatchAll untouched for API stability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too knowledgeable about the monomod/IL parts that were changed so I'll just leave some comments.
This build doesn't work on BepInEx 5.4.21, preloader fails with
System.TypeLoadException: Could not resolve type with token 0100001b (from typeref, class/assembly MonoMod.Utils.Platform, MonoMod.Utils, Version=22.1.29.1, Culture=neutral, PublicKeyToken=null)
at BepInEx.Preloader.PreloaderRunner.PreloaderPreMain () [0x00000] in <fc9d7fbc6dcb44cf87be11d8d92ae161>:0
...
// Reset IsApplied to force MonoMod to reapply the ILHook without removing it | ||
ILHookExtensions.SetIsApplied(ilHook, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ILHookExtensions was using reflection to make MonoMod think something wasn't applied when it was, but I'm not sure that would even work under reorg, so I just got rid of the jank and did Undo + Apply instead (which is what this really should've been doing in the first place)
It's a bit slower, but more "correct", and its not like patching was fast anyway
cd0a86b
to
d590fc6
Compare
d590fc6
to
a68c607
Compare
@Windows10CE I didn't merge this PR yet because it still breaks current BepInEx releases. |
I attempted to make BepInEx5 load with this version of HarmonyX but it just hard crashes Unity after I managed to get rid of all the compilation errors BepInEx/BepInEx@ecb4b57 If you (or anyone else) could made a PR for BepInEx to make it work with this PR without regressions then I would be able to merge both. Edit: Looks like v2.10 also broke BepInEx5 but only in Unity 5.x games with a preloader crash but it did work in later versions. |
Looing at this again because somebody else pointed me at it... This looks like the wrong version of Utils. Are you sure you had Reorg's Utils (25.0.0) available to the game? |
From what I've checked: Tests on net3.5 only pass because forward to latest version 4.5+ fm |
25 should work on .NET 3.5, unless I broke it recently. Mono I'm less sure of, if you can get a testable repro, I can probably fix it pretty quickly. |
The |
I'll wait and see what happens then. if the fix is going to take a long time I can revert this PR. |
@nike4613 Any updates? If it looks like the fix is going to take time I'll revert this PR so that others can get merged. |
I haven't been working on it much. I'll see what I can figure out today though. |
If someone is willing to try this: master...Meivyn:HarmonyX:ci#diff-3d39eb790b32ee18c77608a6057e09e25bda2215d6ed915aa75855d5cfbd64fc I am unsure what this |
Yes, in my local repo I used detour to fix it. |
Uploaded RuntimeDetour 25.1.0-prerelease.2 with the above fix in it. |
It fixed .NET 3.5 support from what I could see with the repro case, but it still fails with Mono. More precisely, I found out that it doesn't seem to like the I do not have a game that makes use of net35 though, so I can't test on it, and I can't tell how that new bug will affect Harmony. I don't think it would though, considering that this seems rather... specific. And likely relevant to the method's body length, according to @nike4613. |
Original test case works fine on my side with both mono 6.12(+unity mono from 2022.3.9f1) and .net framework 3.5, |
I used the one in Unity 2019.4.28f1. I think it's 5.11? |
Ok, my bad, there is such a thing with short bodies with unity mono (original mono works). But I'm not so optimistic about the rarity of cases |
Thanks, I'll wait for those to be resolved then.
I think it sums Unity up pretty well :) |
Reverse patches seem to be broken somehow. This patch is failing on Harmony 2.11.0, and works fine on 2.10.2: https://github.com/Aeroluna/Heck/blob/master/Heck/HarmonyPatches/PlayViewInterrupter.cs#L76 It throws the exception. |
Details? Maybe it adds IL now? |
Problem is that I don't have more details. There's no error nor anything in Harmony logs that could help me figure it out. I'm not familiar with reverse patches, but that |
Fixes .NET 3.5 support broken by merging #79
Why this was released without a prior fix of |
Reverse patchers appear to work fine so we'd need an exact setup to reproduce the issue. |
Actually the issue might've been caused by my attempt at fixing the Here is my attempt at fixing it again, if you don't mind trying: master...Meivyn:HarmonyX:ci#diff-3d39eb790b32ee18c77608a6057e09e25bda2215d6ed915aa75855d5cfbd64fc I did try to make a test case, my patch looks like this: [HarmonyPatch(typeof(MainMenuViewController), "HandleMenuButton")]
internal class Patch
{
[HarmonyReversePatch]
private static void ReversePatch(MainMenuViewController.MenuButton menuButton)
{
throw new NotImplementedException("Reverse patch has not been executed.");
IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
return instructions;
}
}
} And it throws this when applying the patch, so I can't go further:
|
No description provided.