How can I read/edit rom dumps?

Cool



Lets look at a simple example. I want to modify Ms Pac to have different ghost names. Doing that changes the CRC and MAME pukes. How do I get MAME to recognize a "new" version of ms Pac

If thats all you are trying to do, check out this attachment, as for running it in mame i think it will crab about the crc and make you say OK run it anyway.
 

Attachments

  • pacnames.zip
    44.3 KB · Views: 22
Lets look at a simple example. I want to modify Ms Pac to have different ghost names. Doing that changes the CRC and MAME pukes. How do I get MAME to recognize a "new" version of ms Pac

MAME computes a SHA for each ROM it loads. You can have it ignore any mismatches (at least in debug you can). You could also change the SHA in the driver to match your new ROM and then recompile.
But that's the easy part.... The game code itself will typically have checksum routines and will prevent the game from playing if code has been altered. You either need to find the checksum routine and disable it (or patch the sum it is expecting), or make changes to unused code space so that the original sum is preserved. They usually do an 8-bit or 16-bit sum on an entire physical ROM (although some may break it up into smaller blocks).
 
Quick answer: unless you really know what you're doing, you can't.

Instead of using a hex editor to patch roms, I just wrote some quick C code to go binary -> hex and hex -> binary, and some other code that'll read in a binary, check for a byte at a given location, then write new data there to patch binaries directly (so I can patch roms w/o doing a full disassembly & reassembly).

Assemblers / disassemblers depend on what platform you're running on. I do all my work in linux, and have different tools for different CPUs (some from the net, some I wrote myself).

A lot of stuff, i'll just hand assemble by editing the hex files using a disassembly as an opcode reference, but for big stuff I use an assembler... it gets tedious computing relative jump offsets in your head when hand assembling. :)
 
MAME should still run, it'll just complain that the CRC doesn't match. I had some modified Tapper ROMs that had Simpsons characters in it, and while MAME complained, it still ran just fine.

I know, but I want to see if I can have it run without the errors...
 
I forgot about the ROM checks Ms Pac does when the game itself starts up...that would prevent it from running :( Apparently Tapper doesn't have that ROM check on startup, as only MAME complains about the wrong ROM checksum.
 
I forgot about the ROM checks Ms Pac does when the game itself starts up...that would prevent it from running :( Apparently Tapper doesn't have that ROM check on startup, as only MAME complains about the wrong ROM checksum.

Tapper does have a ROM check, but only PROGRAM ROMs get tested... you can do anything you want to the graphics ROMs, and the game code is none the wiser....
 
"Its the PAC6E.532 rom for pacman"

Pac, location 6E, 2532 rom. When saving your rom dumps, name them this way so all the info is right in the filename.
 
When rom hacking on a windows based system I use the following tools:

1) a custom compiled version of mame with the SHA checksum functionality removed and my "new" games added. as matt said, this is the easy part.

2) to change a few bytes in raw binary mode I use the Neo Hex Editor. i paid for the full version but the free works well and was just lacking some of the time saving functionality i found myself using frequently.

http://www.hhdsoftware.com/Products/home/hex-editor-free.html

3) mame uses the 7-zip library for accessing the rom zip file so I use the command line version to create new rom zips for testing via batch after my compiles complete

http://www.7-zip.org/

Here's some sample syntax from my make.bat file
Code:
7z.exe -tzip u D:\mame\roms\tempest.zip C:\AVG\tempest\latest\9000dfff.bin

4) most of my debugging and disassembly is done right in mame (mame.exe -d). if you're just patching the game it's not hard to get a quick feel for the key elements in the code. a complete disassembly is a real pain and you'll end up "helping" the disassembler get it right more often than not.


I am really focused on the 6502 architecture (Atari) but know z80 as well from back in the day. Hopefully someone out there finds this info useful.


-- Steve
 
There's actually no need to zip up your ROM images in order for MAME to use them. If there is a directory under your MAME "ROMS" directory that matches the game you're running (e.g. "gyruss") then it will read the uncompressed images from there first before looking for a zip file.
 
There's actually no need to zip up your ROM images

Good to know Matt! When I first played with mame (DOS) we had roms in the named directories as you described. When I revisited mame a few years ago it had all changed to the compact named zip files and my original roms no longer works (naming convention issues). After struggling to get my original roms to work I gave up and found it easier to simply replace them.
 
I just *really wish* the mame debugger would allow you to edit the ROMs on the fly...

They already have the facilities built in to modify RAM in the debugger -- why not ROMs? :)
 
I just *really wish* the mame debugger would allow you to edit the ROMs on the fly...

They already have the facilities built in to modify RAM in the debugger -- why not ROMs? :)


+1 to that!

Seriously, I'll bet that's a moderately simple fix. We would just need mame to allow loading ROM data into RAM (may already do this) and then modify the game driver to map extra RAM and load the ROM files to this new R/W space.

Of course, a poorly constructed program could attempt an invalid write to what should be ROM and really screw up the virtual machine execution. But hey, what's the odds of that happening?
icon10.gif



.
 
I just *really wish* the mame debugger would allow you to edit the ROMs on the fly...

They already have the facilities built in to modify RAM in the debugger -- why not ROMs? :)

Because ROM stands for "Read Only Memory"? :D

Yeah, I'm a smartass. But after working on Death Race all day and being covered in 30 year old rat poop from Destruction Derby, I feel entitled!
 
I just *really wish* the mame debugger would allow you to edit the ROMs on the fly...

They already have the facilities built in to modify RAM in the debugger -- why not ROMs? :)

Mame since at least version 0.111 has been able to modify the ROM region.

Go into the memory window select the "REGION" for the specific CPU, that allows direct modding of the loaded ROM. The newer versions actually show the name of the CPU region too.

- James
 
Because ROM stands for "Read Only Memory"? :D

Yeah, I'm a smartass. But after working on Death Race all day and being covered in 30 year old rat poop from Destruction Derby, I feel entitled!

...read only to the CPU... doesn't mean i shouldn't be able to write to it manually ;)
 
Back
Top Bottom