My Rom Hacking Method (vids)

ekorz

Multi Boyz 4 Pi
Immortal
Multi Boyz
Joined
Aug 21, 2016
Messages
5,429
Reaction score
8,492
Location
Boston, MA
Since that poll showed so much interest (thanks!) I decided to record a few videos detailing a hack and going through the basics of my tooling/setup. If you can handle my rambling and poor video editing skills (i.e. there are no edits...) then please let me know and I'll consider adding more videos. For me, this style of video is easiest to make. I basically just turned on my recording device and started working on a hack from scratch. That means you'll have to put up with my stream-of-consciousness programming, but you'll also see every little step, mistakes and all.

Playlist link. Here's what is inside:

These three videos detail my setup and show a free play hack for Explosive Breaker, where I tie the functionality into a dip switch:
Part 1
Part 2
Part 3 (very short)

This final video is just a little more in-depth on 68k, opcodes, disassembly:
M68K Stuff #1

Here are my resources -
Sublime Text: https://www.sublimetext.com/
HxD: https://mh-nexus.de/en/hxd/
Pugsy Cheats: https://www.mamecheat.co.uk/
Jester M68k: https://mrjester.hapisan.com/04_MC68/
ts_rom_tool: https://github.com/twistedsymphony/ts_rom_tool (direct link -> .py file) (thanks @twistedsymphony!)

The final .py file you'll see me building is attached, as well as an opcode library for m68k.

Finally, I'm sure there are more optimal ways/tools to do these kinds of things - I don't consider myself a strong programmer at all. But there are surely less optimal ways that I have personally suffered through, too! In the end, this workflow has allowed me to make some pretty large and complicated hacks with very little overhead. Anyway, the point is, I'm publishing this not just to teach but also to see if anyone can improve upon this. So if you have an improvement to share, please share! There are a lot of rom-hacking ideas out there (free plays, trainers, conversions, ports, fun mods, etc.) and not nearly enough hackers. If this guide helps a few (otherwise talented) programmers get into this particular slice of the hobby, we'll be better for it.
 

Attachments

Last edited:
some posts in the poll thread that make more sense here
Just watching these now. In the first video around the 8:50 mark you're talking about hex ROM size. I have a handy cross-reference chart I made for myself. Literally I have this printed out and taped up next to my monitor makes it easy to determine file size vs size in mame vs what EPROM it likely uses.

ts-eprom-xref_v1.1.png


I think I posted the original v1.0 of this chart before this is a v1.1 that made a few few adjustments and made the colors a little more printer friendly.




I just finished watching through. definitely learned a few things. As someone who tends to patch by hand I really like your patch array python script. usually I'll have a text file with the bytes and location to modify then go through and tweak my joined.bin from notes before de-interleaving for test. your method is also great for essentially self-documenting the patch as well. I'll definitely be stealing that. Also learned a few shortcuts you use that I wasn't aware of.

I'd love to find a good op-code database, some are pretty straight forward to modify (like the ones you used in this video) some are not (like if you need to do something with D2 vs D0). when I was doing the Metro VG420 and VG460 input patches I ran into a lot of opcodes that I needed that I couldn't find examples of in the disassembly and need to disassemble a few other games to find good examples.

When I did my GunFrontier conversion I ran into the same issue and ended up finding a 68K compiler to generate the opcodes for me. if I recall it was a real pain to get setup though so I haven't revisited that method.
It would be cool to have a FULL library.

The files in my thread the txt from opcode.zip does have a lot of opcodes, and they're pretty easily searchable once you get used to it. One thing I've gotten used to is that the codes themselves are usually guess-able once you get to know them, because they're ordered. Take "move byte to a data register". you can see the only thing that changes is the second digit, and they increment by skipping every other digit.

move.b #<DATA> to D0 (W+W) - 103C + #Data
move.b #<DATA> to D1 (W+W) - 123C + #Data
move.b #<DATA> to D2 (W+W) - 143C + #Data
move.b #<DATA> to D3 (W+W) - 163C + #Data
move.b #<DATA> to D4 (W+W) - 183C + #Data
move.b #<DATA> to D5 (W+W) - 1A3C + #Data
move.b #<DATA> to D6 (W+W) - 1C3C + #Data
move.b #<DATA> to D7 (W+W) - 1E3C + #Data

so if I have a similar opcode and need to change some part of it, I can sometimes guess (and let mame's debugger disassemble my guess... and tell me if I was right).
 
FYI I was doing some patch work today and used your python patching script, it worked perfectly. so much better than doing it by hand!
 
Back
Top