Have you considered using the same XML format Nestopia does?
Honestly, I think it looks really good for the most part.
But there are a few changes that I would have to make.
I've defined an XML markup for all systems I emulate: NES, SNES, GB, GBC, GBA. And although there are necessary concessions for each system, there are consistent elements that this spec doesn't match.
For instance, from Nestopia:
Code: Select all
<cartridge system="Famicom" dump="ok" crc="078CED30" sha1="445EF49C918183F17EEF3D80C6FAF6E0CA8AC19E">
<board type="HVC-SKROM" mapper="1">
<prg size="128k" />
<chr size="128k" />
<wram size="8k" battery="1" />
<chip type="MMC1B2" />
</board>
</cartridge>
In this example, I use SHA256 because it's harder to fake. And will likely use SHA3 when it is out.
My size parameters are in decimal or hex notation, but there is no k/m/g modifiers.
This avoids getting into arguments with SI unit proponents ("Hey, let's call it 131.072KiB!" ... Yeah, let's not.)
So I would have prg size="131072".
Next, I try and avoid getting into "describe this memory chip's type or purpose", so "wram" or "sram" would be out.
Instead, I just call it "ram".
"battery" is a nice argument, but I wouldn't go with "0" or "1", but "true" or "false".
And further, it breaks down at the GBA level: FlashROM, EEPROM and FeRAM memory do not have a battery.
What the behavior is actually saying is, "this data is non-volatile and needs to be saved between runs."
So for now, I add nonvolatile="true" to the RAM argument to tell it to be preserved. Defaults to false if omitted so you can avoid the double-negative of nonvolatile="false". All the same, I don't like my name for that, but it is what it is.
My last, and most important, qualm with his format is that it's back to the useless mapper="number" system.
I want to do away with mapper numbers entirely. The big problem with this is that some of these boards are nameless.
My solution is basically to make up names for their board types, eg "BANDAI-FCG".
And I know the obvious problem with that: everyone will want to make their own names as well. Can't be helped.
I'd rather a descriptive text label than a magic number. If all we wanted were magic numbers, we could use a 16-bit value that becomes a specific board+chip size+pinout configuration. Which would be ugly.
Chip type is tricky, too. A lot of these boards are honestly just discrete logic chips in certain configurations.
In a sense it'd be nice to lose board entirely (except for aesthetics), and set up the board based on what chips it has, but then I don't think anyone is going to emulate a 74LS directly in XML ...
But right now, we're basically omitting chip entirely unless it's a complicated one like an MMC.