Skip to content
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

Future of the armory binpatches #546

Closed
scamtank opened this issue Feb 10, 2015 · 4 comments

Comments

@scamtank
Copy link
Contributor

commented Feb 10, 2015

Comparing two executables against one another, I'm slowly snooping out where Angavrilov's old binary patches go in the current Windows version.

http://www.bay12games.com/dwarves/mantisbt/view.php?id=1445#c23694

weaponrack-unassign moved down by 0xFF3C0, so the chunks of code in 0x4C05C4 and 0x4C06A1 are now found in 0x5BF984 and 0x5BFA61 respectively. I've manually altered my own .exe and can see it works.

The parts in armorstand-capacity that involve altering old stuff (and not adding extra detours into empty space) look like they have jumped down by 0x24220. The old addresses 0x34D91, 0x34E53 and 0x34EF3 and their surroundings look an awful lot like v40.24's 0x58FB1, 0x59073 and 0x59113. There seem to be empty CC CC CC CC patches offset by 0x24220 like the rest, but I'm still a little uncertain how to make the relocated instructions point to the right places again.

Lethosor put forward the reasonable thought that these should be deprecated in favor of doing the thing with DFHack's own tools, but that's where I'm in over my head. I'm okay at detective work like this, but all I know about C is what Sesame Street taught me.

@lethosor lethosor added the idea label Feb 10, 2015

@scamtank

This comment has been minimized.

Copy link
Contributor Author

commented Feb 12, 2015

I've taken a harder look at armorstand-capacity and I think I've managed to reroute all the old links. The problem was that when the old ones were hanging around 0x17000 and then 0x35000, the current version has them closer to 0x2A000 and 0x58000. All the relative-distance CALL and JMP instructions needed new values to account for the much wider and inconsistent gaps between the addresses. One JMP that was pointing to some unmentioned section of original code had to be tracked down too. Thank goodness it was a fairly unique instance of code that showed up quickly.

@Weisemann

This comment has been minimized.

Copy link

commented May 1, 2015

So, how can I use these patches now?

@scamtank

This comment has been minimized.

Copy link
Contributor Author

commented May 1, 2015

Well, the fact of the matter is that I failed to bring the armorstand-capacity patch back online. I got a grip on where the important bits were, but couldn't wrangle the assembly instructions to point at the moved empty space. My notes are such a mess that I'd probably have to retrace my steps to say where they were.

I have a functioning version of the critical weapon rack fix for Windows, however. I haven't gotten around to making a pull request, what with the fact that the military currently doesn't feel like doing anything besides training on their days off and the deprecation of binary patches as a thing, but here it is anyway.
http://pastebin.com/raw.php?i=zdAbuVWS

Remember how binary patches worked? Put this file (weaponrack-unassign.dif) in /hack/patches/v0.40.24 SDL/ and run it with "binpatch apply weaponrack-unassign".

@Weisemann

This comment has been minimized.

Copy link

commented May 1, 2015

Thanks!

PeridexisErrant added a commit to PeridexisErrant/dfhack that referenced this issue Sep 25, 2015

Consolidate binpatch docs. Closes DFHack#546
Binpatches aren't used much at the moment, so this has two purposes:
collate information so it's easier to write them again, and remove it
from other sections where it's useless.

Note that if the standalone binpatch.exe is removed, the 'patching on
disk' section can be cleanly removed from 'Using a patch' by deleting
lines 44-47 & 61-90.

PeridexisErrant added a commit to PeridexisErrant/dfhack that referenced this issue Sep 26, 2015

Consolidate binpatch docs. Closes DFHack#546
Binpatches aren't used much at the moment, so this has two purposes:
collate information so it's easier to write them again, and remove it
from other sections where it's useless.

Note that if the standalone binpatch.exe is removed, the 'patching on
disk' section can be cleanly removed from 'Using a patch' by deleting
lines 44-47 & 61-90.

@expwnent expwnent closed this Sep 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.