Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Applying patches with the Interactive Disassembler?  (Read 1432 times)

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Applying patches with the Interactive Disassembler?
« on: December 05, 2012, 10:38:57 am »

Anyone know how to apply these patches (3 at the bottom)

http://dffd.wimbli.com/file.php?id=6741
using Interactive Disassembler to Dwarf Fortress?

Example patch
http://pastebin.com/8CfRwxae
« Last Edit: December 05, 2012, 10:41:27 am by thistleknot »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Applying patches with the Interactive Disassembler?
« Reply #1 on: December 05, 2012, 12:46:34 pm »

1. Get a hex-editor (such as this one), run it, and open Dwarf Fortress.exe.
2. Open the patch file in Notepad.
3. Each section of the patch consists of an address, a set of old byte values, a set of new byte values, and a description of what's being changed. Go to the address, verify that the old bytes match, then type in the new bytes (in the left pane).

For the example patch:
1. Open Dwarf Fortress.exe in your hex editor
2. Go to address 0x68a63
3. Make sure the 6 bytes there are "0F 85 58 01 00 00"
4. Replace those bytes with "90 90 90 90 90 90"
5. Go to address 0x3dcbf9
6. Make sure the 9 bytes there are "8B 0C 90 8B 81 80 00 00 00"
7. Replace those bytes with "8B 3C 90 8B 87 80 00 00 00"
8. Save and exit.

Alternatively, you can wait until the next DFHack release and use its "binpatch" program to do it for you.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: Applying patches with the Interactive Disassembler?
« Reply #2 on: December 05, 2012, 04:20:23 pm »

so all the .text + - and <<< and >>>> ignore? just change the address number hex changes?

nm. i see the rest is just explainingg the changes
« Last Edit: December 05, 2012, 04:48:29 pm by thistleknot »
Logged

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: Applying patches with the Interactive Disassembler?
« Reply #3 on: December 06, 2012, 02:10:34 am »

did all that work to setup my build environment just to put that cpp and lua file in, and I see that it's already in the latest release...

oh well, gonna have to build anyways...

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: Applying patches with the Interactive Disassembler?
« Reply #4 on: December 07, 2012, 11:44:11 pm »

so after a day's worth of work

I found a program that did exactly what I wanted without the tediousness of manually applying patches or trying to figure out IDA's many options

at first it was
http://epicgeeks.net/ida-patcher-for-windows/

but it kept crashing, I tried to find a 4.7.8 or whatever it was asking for .dll of mingw, but I failed...

then I found...

and built it using vc2010 (v7 is asked for)
and it WORKED!

https://github.com/QAston/IDA-binary-patcher

after that, I was able to patch the files, which led to this
http://www.reddit.com/r/dwarffortress/comments/14g2c9/patched_dwarf_fortressexe_to_include_3_additional/