SO A LITTLE BACKGROUND HERE.
Currently, the common format for Game Boy and Game Boy Color ROMs (usually given the .gb/.gbc file extension) is just a raw binary dump of the ROM data from the cartridge. Unlike the NES, where some extra data must be tacked on to tell an emulator crucial details such as which of the hundreds of different mappers is used by the game, Nintendo's requirements for Game Boy developers specified an internal ROM header that must be populated with this information. So that's fine right? Emulators can just read the internal header! Nintendo, unintentionally, solved the problem and made emulation easier for everyone! Right??
NOT SO FAST BUBSY HERE COME UNLICENSED GAMES TO FUCK EVERYTHING UP
For, you see, the header being populated correctly is a Nintendo requirement, not a hardware one. A real Game Boy requires a few things to be correct - the header checksum, the Nintendo logo, GBC/SGB flags to enable enhancements for those systems - but doesn't care about things like cartridge type and ROM size. So if you're an unlicensed dev, you can put any old shit in there. You might even intentionally set incorrect values to fool copiers and emulators. And if your game uses some kind of custom unlicensed mapper or copy protection, it's probably not even possible to represent it within the specs of Nintendo's header format!
Until now, most Game Boy emulators have relied on heuristic auto-detection for these games, checking for certain signifiers present in the ROM that can somewhat-reliably identify a given type of non-standard cartridge. hhugboy also allows you to select a cartridge type manually, to run games that are not correctly auto-detected. So far, this has sort of been okay - hhugboy's auto-detection works correctly for the most part, with only a handful of dumps needing manual selection.
But the new unlicensed dumps just keep coming, and the heuristic approach is getting increasingly unwieldy. I've recently dumped a bunch of games from a Certain Developer, and while it's possible to reliably identify their games, I haven't found a way to distinguish between the ones that run on their publisher's custom mapper and the ones that don't, meaning at least one set of those would end up only working via manual selection. There are a bunch of other carts I haven't yet tackled that I foresee causing similar problems.
So what I've been thinking is: why not create a new Game Boy ROM format, allowing all this information to be specified outside of the internal header? Admittedly the use cases for such a format at this point are fairly niche, so it would have to be low-overhead, backwards-compatible if possible and unintrusive. But hopefully it would be a step towards making emulation of unlicensed Game Boy games (and a handful of licensed ones too!) a much nicer thing to deal with and much less of a mess of heuristics and hacked dumps.
Here's my proposal for the format, which I'm tentatively calling GBX. Any and all feedback would be greatly appreciated, just leave a comment below!
Even if you just want to call me a big dumbass or something!
(UPDATED 21/02/2018 current version 0.3)
When it's finalised, the next version of hhugboy will support it, and I'll probably make some kind of tool to allow for conversion to and from the new format, hashing, editing and other such stuff.