libmodplug icon indicating copy to clipboard operation
libmodplug copied to clipboard

Add BWSB General Digital Music (GDM) module loader.

Open AliceLR opened this issue 3 years ago • 5 comments

This patch adds a loader for the GDM module format, which was the internal module format of Bells, Whistles, and Sound Boards. Due to the usage of BWSB as the module library of MegaZeux from 1996 through 2004, hundreds of GDM modules exist, many without their corresponding original MOD/S3M/etc files. When MegaZeux switched to libmodplug in late 2004, for some reason that I'm sure made sense, the devs at the time wrote a GDM→S3M converter instead of a GDM loader for libmodplug. So, from the MegaZeux project, here's a brand new GDM loader 17 years late. :-)

While libopenmpt, libxmp, and MikMod all have very good support for GDM, some notable projects such as SDL_mixer and VLC use libmodplug, which doesn't support GDM without this patch. Full disclosure, while I implemented this loader almost entirely off of MenTaLguY's GDM.TXT document, some of my knowledge of specific quirks of the format comes from having checked 2GDM/BWSB and working with other GDM loaders in the past. The main places I used this knowledge (16-bit samples hack and unsupported sample flags; quirks in effects conversion) I commented, and I'm not sure there's a reasonable alternative way of implementing these sections.

Test modules:

I'm going to go ahead and mark this as a draft since I'm still testing it.

AliceLR avatar Jun 10 '21 23:06 AliceLR

I converted this so that it applies and builds/works with SDL_sound (https://hg.icculus.org/icculus/SDL_sound/), seems to work fine with the files you attached: SDL_sound.patch.txt (not yet applied.) If you see any gotchas in there, please tell me.

sezero avatar Jun 19 '21 10:06 sezero

The conversion of the loader itself looks fine to me. The only thing "wrong" I noticed is it looks like their CMakeLists.txt and Makefile.os2 have the rest of the loaders in alphabetical order... :)

This loader has been pretty thoroughly fuzzed and I think I'm done tweaking it, so I'll go ahead and mark it ready for review as well.

AliceLR avatar Jun 19 '21 11:06 AliceLR

Applied this to SDL_mixer, SDL_sound, and to my libmodplug fork.

sezero avatar Jun 20 '21 00:06 sezero

Is there any chance that this gets in ?

sezero avatar Jan 30 '22 13:01 sezero

Is there any chance that this gets in ?

Yes, this is a great addition, however will need a version update - trying to get all the fixes in first.

Konstanty avatar Jan 31 '22 02:01 Konstanty