Post subject: Comparing two ROMs?
Editor, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I asked this on IRC yesterday, but there didn't seem to be an easy way to do this... The idea is to compare two ROMs to see what changes where made between two versions of the same game (what is different between v1.0 and v1.1 of the same game?), similar to diffs in wiki pages. I got this idea long ago, when I was reading this: http://starmen.net/mother2/gameinfo/antipiracy/ I recently found a cool bug in Super Mario Land which worked in v1.0 but not in v1.1 and perhaps this could have been found a lot sooner. I have a lot of games I would want to test for this... A problem would be to analyse the code and to actually comprehend the difference which I don't think I'm really good at. Well, thoughts?
Joined: 10/3/2005
Posts: 1332
Some hex editors do that. Couldn't name one offhand, though. I used to use one called "hexplorer", though you'd probably find something better googling "binary diff hex editor". More to the point of what you want to do, you might also run a disassembly tool on both roms, and then use the UNIX tool "diff" on the outputs. Not sure where you'd get diff for windows, if that's your platform, but I know it exists and shouldn't be hard to find.
xPi
Joined: 8/1/2008
Posts: 58
I got HxD hex editor to compare 2 binary files. you could use the fc /B file1 file2 command in windows.. but if the bytes got shifted then that becomes useless bsdiff and xdelta3 can be used for binary diffs.. although I just use them to make patches of things
Editor, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Thanks for your help. I got hex-editor neo and csdiff and it works well. But, as I expected, I cannot interpret what the changes mean. I can only see where they are in memory and how numerous they are. I managed to find another version difference between Super Mario Land v1.0 and v1.1, aside from the OOB glitch that only works in v1.0, but this was not found by using these programs (The dying sound is more significant on v1.1). I guess all I can ask right now is how to interpret the changes between two roms. How to find out what purpose a certain memory address is used for? All I could do is trying to edit the value in memory addresses to find out how the game reacts. I would be glad for more responses. edit: When opening a rom in the hex-editor, all I get is all the memory address values there are. But aren't there also some kind of algorithms in the game?
Joined: 10/3/2005
Posts: 1332
Did you try a disassembler? I don't know how much you know about this kind of thing, but It basically translates the hex digits in the ROM into something more comprehensible to humans. My suggestion is to do this in a command prompt, substituting "disasm" for whichever disassembler executable, and the .gb's with actual roms: $ disasm rom1.gb > rom1.disasm $ disasm rom2.gb > rom2.disasm $ diff rom1.disasm rom2.disasm ...And hopefully you'll get a small set of functions in the code that differ. That would be useful, since you could then could breakpoint those functions in a debugging emulator, step through the code to see which memory addresses they use, and then pin the values of those addresses with whatever cheat tool in the emu to get an idea of what they're for. You wouldn't even really need to understand the ASM output from the disassembler— the memory addresses themselves might tell you as much as you'd ever want to know. Though, whether you'd find exploits from doing that is anybody's guess.
arflech
He/Him
Joined: 5/3/2008
Posts: 1120
Dromiceius wrote:
Not sure where you'd get diff for windows, if that's your platform, but I know it exists and shouldn't be hard to find.
GnuWin32 is made of win: http://gnuwin32.sourceforge.net/packages/diffutils.htm
i imgur com/QiCaaH8 png