Reloader icon indicating copy to clipboard operation
Reloader copied to clipboard

Patching freezes game

Open Epicguru opened this issue 5 years ago • 1 comments

I got the reloader to build by updating it to .NET 4.7.2 to match the Rimworld version, which fixes an missing reference caused by attempting to build against 3.5.

The reloader loads correctly (I see the logs in-game). When I try to reload my method, the game freezes and has to be killed.

I went back into the Reloader code and tried to fix the patching method by changing the Memory.cs class to the newer Harmony 2 Memory.cs, taking out all methods apart from WriteJump and GetMethodStart which are the only ones used in this project. I then had to add a reference to Mono.Ceil because that's what Harmony uses.

I compiled again, and exact same result. It imports and loads correctly into Rimworld, but patching freezes the game when calling WriteJump.

Do you know how I can fix this, or what is happening? I'm sure this project is not your focus, but if you could point me in the right direction I could try to fix this and create a pull request.

Edit: More specifically, the entire game freezes permanently after the line DetourHelper.Native.Apply(data);

in WriteJump in Memory.cs (taken from Harmony, here)

Epicguru avatar Apr 10 '20 10:04 Epicguru

Due to the changes in Unity RimWorld loads assemblies different. So I guess Reloader is broken. I don’t have the time/priority for finding a fix for it right now but your welcome to do it.

Like any other mod, it should depend on the Harmony mod instead of packing its own harmony lib. Why the game freezes, I have no idea.

pardeike avatar Apr 10 '20 11:04 pardeike