How do emulators determine the correct mapper number when the iNES ROM file header is bad. For example, I've got a dump of Dick Tracy with the following values:
$Address: $06 = $21
$Address: $07 = $44
The above (according to the iNES file format) would result in a mapper number of $42. But really it should be $02 (UNROM).
My VeriNES emulator does not properly play the game because it doesn't recognize the mapper number. However, if I load the same ROM into Nestopia it plays the game fine. How does Nestopia know that it's really not mapper $42 ????????????
The low nibble of byte 7 is a dead giveaway of a bad header.
Since it's 4, it's a bad header, throw away the high nibble.
You look at bits #2 and #3 of Byte #7 of the header.
....xx.. <- 00 = okay, 10 = Nes 2.0
Anything else: throw out byte #7 of the header because it's a "DiskDude!" rom.
"DiskDude!" roms have 01 for those two bits.
44 in hex is an uppercase D.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Nestopia (and some other emulators as well) check the CRC against an internal database, if a match is found, it uses its own info instead of the header. This is most likely what's happening in this case.
That's really cool. I'd certainly like to do that with my emu (eventually). Is there a database available of Game-to-CRC mappings somewhere that I could use in the future? Or does anyone know where Nestopia stores this lookup-table so I could just steal it (lol, giving credit where credit is due of course)?
jwdonal wrote:That's really cool. I'd certainly like to do that with my emu (eventually). Is there a database available of Game-to-CRC mappings somewhere that I could use in the future?
You might want to talk to bootgod about that. His NesCartDB (sample entry) has a CRC for every game. It'd be a lot cheaper than buying all the games and dumping them in CopyNES.
Anyway, that is an awesome site! Never been there before. That must have taken him a heck of a long time to create! I was able to download the zipped XML file from his homepage. I'm not sure if he has it in any other formats but I can easily parse the XML. I'll wait to see if he replies to this post before bugging him.
notice that the checksums in that xml file are calculated *without* the header. so you have to ignore the first 0x10 bytes of the file if you want to recognize those crc.
XML is the only external format I have right now. It doesn't get as in depth as the website profiles do, but should have everything you need as far as emulation is concerned.