Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[target/wswan] Homebrew metadata format #14

Open
asiekierka opened this issue Sep 4, 2023 · 5 comments
Open

[target/wswan] Homebrew metadata format #14

asiekierka opened this issue Sep 4, 2023 · 5 comments
Labels
enhancement New feature or request feedback request Feedback, thoughts, etc. are requested and appreciated on this issue target: wswan Affects the wswan/wwitch targets

Comments

@asiekierka
Copy link
Contributor

asiekierka commented Sep 4, 2023

For various tools that work with WonderSwan software, it'd be good to define a common format of homebrew metadata (name, author, etc) that can be contained within the ROM.

It'd be good for it to be simple enough to be parseable on-device (but that's not a particularly low bar, the WS does have some power).

I'd say the primary "prior art" here is the SDSC header, but arguably a better solution would be to use a RIFF chunk pointer or Vorbis comments, with a small footer placed just before the official WonderSwan footer. Notes from Maxim/SMS Power on that regard:

I mean, it’s OK and a bit sympathetic to assembler syntax but I think it’d be better to do something more “standard” if possible. Check out the tagging formats used in media, like the Vorbis comment
Producing a valid SDSC header in a basic assembler from decades ago is a lot easier than producing a valid Vorbis comment but maybe it’s easier for others to decode if it’s a standard
SDSC limits you to nn.nn version numbers, three text fields and a date. The number parts can all have ill-formed values, like version FF.A7 and date AB/CD/DEF0
I recently took the liberty to at least specify the text is UTF-8 now…
So yeah, SDSC header is a crappy old-fashioned inextensible format. If we were to extend it we might start putting machine-readable text in the comment I suppose.
https://www.xiph.org/vorbis/doc/v-comment.html for reference. It's a bit unclear but basically, followed by many , where each UTF-8 text is in the form KEY=value. You might use the vendor string part to act as a locator or you might make a well-known offset for a pointer to the tag. But this will naturally take more bytes than a more efficient format.

I'd arrange it as follows:

Offset Length Description
$...E0 4 'WFHB' magic
$...E4 4 Build day/month/year (4 bytes, BCD)
$...E8 4 Pointer in ROM's physical address space to the RIFF chunk starting point
$...EC 4 Reserved? Got any ideas?

As for the RIFF chunks (or Vorbis comments), they could have an official list of types (name, auth, desc, etc), but also allow people to define custom ones according to their needs.

Do you think this is overengineered? What would you propose?

@asiekierka asiekierka added enhancement New feature or request target: wswan Affects the wswan/wwitch targets feedback request Feedback, thoughts, etc. are requested and appreciated on this issue labels Sep 4, 2023
@ISSOtm
Copy link

ISSOtm commented Sep 4, 2023

Imo, a good starting point would be listing out what kind of metadata should be supported, and why—why it should be embedded within the ROM itself, in particular. Then, from that, we can decide how it should be formatted.

@asiekierka
Copy link
Contributor Author

asiekierka commented Sep 4, 2023

Thus why I'm asking for feedback: "general text fields" like name, author, description is an obvious one, but is there anything else of note? The console-relevant ROM metadata itself (mapper, bus speed, etc.) is contained in the official header, after all.

@ISSOtm
Copy link

ISSOtm commented Sep 4, 2023

I'm not sure about "description", I think some kind of tag list would be more appropriate: genre, series, kind (game, demo, music, languages, ...)

Taking a page from the Game Boy's header, I'd add a version/revision field.

The other thing that I think can be useful to put in such a header, is anything that would trigger emulator enhancements; for example, on the GB, a bitmap to be displayed around the game, SGB-border-style. (Not sure how applicable that is to WS, but I think you get my point. Maybe "default screen orientation"?)

@asiekierka
Copy link
Contributor Author

The default screen orientation and revision are contained in the official header. What isn't is a game name/author - there are byte-sized "game developer" and "game ID from given developer" fields, but these were allocated by Bandai and they're much too small for the needs of a homebrew community. Here's the Bandai ROM header spec - these we don't need to duplicate.

As for emulator enhancements, I don't really think we have any of note yet.

@AntonioND
Copy link

AntonioND commented Sep 4, 2023

There are some platforms, like the GBA, where the official header doesn't contain all information you need to emulate the game. For example, the save type, or the presence of RTC. Just based on this, it should be possible to specify metadata blocks with technical information about the ROM.

However, I think most of the metadata should be related to the creation of the ROM. Name/Author/Build date are important, but I would even add a field to add a string that describes the SDK used (compiler name, or even the SDK name). The reason to include the SDK is that it may be useful for emulator developers that find some issue with their emulators and want to search across a lot of ROMs looking for more ROMs generated the same way.

Information about additional emulation hacks is secondary, but I guess there is no harm in supporting unofficial blocks that have that information.

But, at the end of the day, the important thing is to make the format extensible, so that new blocks can be defined in the future as they are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feedback request Feedback, thoughts, etc. are requested and appreciated on this issue target: wswan Affects the wswan/wwitch targets
Projects
None yet
Development

No branches or pull requests

3 participants