Skip to content

GME: Read per-track playlists of NEZplug rips - #557

Merged
kddlb merged 3 commits into
losnoco:mainfrom
pmaciel:fix/gme-per-track-playlists
Nov 18, 2026
Merged

kddlb merged 3 commits into
losnoco:mainfrom
pmaciel:fix/gme-per-track-playlists

Conversation

@pmaciel

@pmaciel pmaciel commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

I've been getting Game Boy soundtracks from https://www.zophar.net/music (Castlevania: The Adventure, Belmont's Revenge and Legends, among others). Each one is a zip with the GBS and an m3u per track, each holding a single line like DMG-CVJ.gbs::GBS,12,Start BGM,0:04,,1. After unzipping one and dropping the folder into Cog, I got every song of the GBS in the file's own order, all with the same length and titled after the file, so it was hard to tell what was what. And the songs that were in the m3us played the wrong song.

Two things were behind it:

  • The GME plugin only reads a playlist named after the file (DMG-CVJ.m3u here), so per-track playlists were never read. When there is none, it now gathers the lines naming the file from the playlists beside it, in Finder order. To list the folder, sources get an optional filesBesideURL:, which FileSource implements, so the sandbox handling stays where it already is.
  • libgme read GBS playlist track numbers as 1-based, while these count from 0, like KSS's do, so each entry played the song before the one it names. GBS is now flagged the same as KSS.

Tested with a Debug build: the unzipped rips list every track in the playlists' order with its title, length and fade.

I'll open a second PR for the zips themselves, which still add a single entry.

Playlists for GBS rips, as NEZplug defined them and Zophar's packs ship
them, number tracks from 0, the same as KSS. libgme took them as 1-based,
so every entry played the song before the one it names, and the first
entry pointed before the first song and played nothing.
A file can come with others it needs, such as playlists beside it. Add
an optional filesBesideURL: to CogSource, which FileSource answers by
listing the folder, with the sandbox access it already takes care of.
GBS, NSF and similar rips made for NEZplug often come with one playlist
per track ("01 Title.m3u" holding "Game.gbs::GBS,12,Title,0:04,,1")
rather than one named after the file. Only that one was read, so such a
rip listed its raw subsongs, all with the default length. When there is
no playlist named after the file, gather the lines that name it from the
playlists beside it, in Finder order, so the tracks get their order,
titles, lengths and fades.

The container, decoder and metadata reader share the loading, so all
three see the same tracks.
@pmaciel

pmaciel commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

There might have been a reason for GBS to be flagged the same as KSS, but I couldn't find it

@kddlb
kddlb merged commit c7c8b16 into losnoco:main Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants