Page 1 of 1

Writing a [DISABLE] script

Posted: Thu Jan 03, 2019 2:45 pm
by jmh
I am using mono dissection if that matters. I have written a script that nop outs a jl command. The original jl command is
CraftingWindowController:OnCraftButtonClicked+11f - jl CraftingWindowController:OnCraftButtonClicked+26b

The address resolves to different bytes every time the game is started. How do I get the address in my script so that I can restore it when the option is disabled?

Thanks,
JMH

Re: Writing a [DISABLE] script

Posted: Thu Jan 03, 2019 4:04 pm
by Chucky

Re: Writing a [DISABLE] script

Posted: Thu Jan 03, 2019 4:20 pm
by SunBeam
Your game uses Unity, thus IL, thus code compiled when needed. The reason these are not always constants..
CraftingWindowController:OnCraftButtonClicked+11f - jl CraftingWindowController:OnCraftButtonClicked+26b
..is the compiled code might use optimizations.

1) Try to write down that piece of code on every 5-6 runs of the game and see what and how it changes when you check it out in Memory View.

2) Check my script for BattleTech; I'm using a method to get to the prologue of the function (where it starts), then scanning for stuff inside the function to pin-point the location of my hook ;) Might work for you as well.

Re: Writing a [DISABLE] script

Posted: Sat Jan 12, 2019 3:01 pm
by Csimbi
jmh wrote:
Thu Jan 03, 2019 2:45 pm
I am using mono dissection if that matters. I have written a script that nop outs a jl command. The original jl command is
CraftingWindowController:OnCraftButtonClicked+11f - jl CraftingWindowController:OnCraftButtonClicked+26b

The address resolves to different bytes every time the game is started. How do I get the address in my script so that I can restore it when the option is disabled?

Thanks,
JMH
Why would you bother with that?
Just save a copy of the original code and restore that on disable.
That's my take on it anyway.
Saves a lot of headaches and works on all code, not just jumps.