diff --git a/contrib/libxmp/src/loaders/gdm_load.c b/contrib/libxmp/src/loaders/gdm_load.c index f45bc5d32..55ee2cab4 100644 --- a/contrib/libxmp/src/loaders/gdm_load.c +++ b/contrib/libxmp/src/loaders/gdm_load.c @@ -60,6 +60,7 @@ static int gdm_test(HIO_HANDLE *f, char *t, const int start) void fix_effect(uint8 *fxt, uint8 *fxp) { + int h, l; switch (*fxt) { case 0x00: /* no effect */ *fxp = 0; @@ -80,9 +81,49 @@ void fix_effect(uint8 *fxt, uint8 *fxp) case 0x0b: case 0x0c: case 0x0d: - case 0x0e: case 0x0f: /* same as protracker */ break; + case 0x0e: + /* Convert some extended effects to their S3M equivalents. This is + * necessary because the continue effects were left as the original + * effect (e.g. FX_VOLSLIDE for the fine volume slides) by 2GDM! + * Otherwise, these should be the same as protracker. + */ + h = MSN(*fxp); + l = LSN(*fxp); + switch(h) { + case EX_F_PORTA_UP: + *fxt = FX_PORTA_UP; + *fxp = l | 0xF0; + break; + case EX_F_PORTA_DN: + *fxt = FX_PORTA_DN; + *fxp = l | 0xF0; + break; + case 0x8: /* extra fine portamento up */ + *fxt = FX_PORTA_UP; + *fxp = l | 0xE0; + break; + case 0x9: /* extra fine portamento down */ + *fxt = FX_PORTA_DN; + *fxp = l | 0xE0; + break; + case EX_F_VSLIDE_UP: + /* Don't convert 0 as it would turn into volume slide down... */ + if (l) { + *fxt = FX_VOLSLIDE; + *fxp = (l << 4) | 0xF; + } + break; + case EX_F_VSLIDE_DN: + /* Don't convert 0 as it would turn into volume slide up... */ + if (l) { + *fxt = FX_VOLSLIDE; + *fxp = l | 0xF0; + } + break; + } + break; case 0x10: /* arpeggio */ *fxt = FX_S3M_ARPEGGIO; break; @@ -367,7 +408,7 @@ static int gdm_load(struct module_data *m, HIO_HANDLE *f, const int start) return -1; } - m->quirk |= QUIRK_ARPMEM; + m->quirk |= QUIRK_ARPMEM | QUIRK_FINEFX; return 0; } diff --git a/contrib/patches/libxmp/16-libxmp-4.4.1-fix-gdm-fine-effects.patch b/contrib/patches/libxmp/16-libxmp-4.4.1-fix-gdm-fine-effects.patch new file mode 100644 index 000000000..a1df880d1 --- /dev/null +++ b/contrib/patches/libxmp/16-libxmp-4.4.1-fix-gdm-fine-effects.patch @@ -0,0 +1,72 @@ +diff --git a/src/loaders/gdm_load.c b/src/loaders/gdm_load.c +index a326c9fc..30907f63 100644 +--- a/src/loaders/gdm_load.c ++++ b/src/loaders/gdm_load.c +@@ -60,6 +60,7 @@ static int gdm_test(HIO_HANDLE *f, char *t, const int start) + + void fix_effect(uint8 *fxt, uint8 *fxp) + { ++ int h, l; + switch (*fxt) { + case 0x00: /* no effect */ + *fxp = 0; +@@ -80,9 +81,49 @@ void fix_effect(uint8 *fxt, uint8 *fxp) + case 0x0b: + case 0x0c: + case 0x0d: +- case 0x0e: + case 0x0f: /* same as protracker */ + break; ++ case 0x0e: ++ /* Convert some extended effects to their S3M equivalents. This is ++ * necessary because the continue effects were left as the original ++ * effect (e.g. FX_VOLSLIDE for the fine volume slides) by 2GDM! ++ * Otherwise, these should be the same as protracker. ++ */ ++ h = MSN(*fxp); ++ l = LSN(*fxp); ++ switch(h) { ++ case EX_F_PORTA_UP: ++ *fxt = FX_PORTA_UP; ++ *fxp = l | 0xF0; ++ break; ++ case EX_F_PORTA_DN: ++ *fxt = FX_PORTA_DN; ++ *fxp = l | 0xF0; ++ break; ++ case 0x8: /* extra fine portamento up */ ++ *fxt = FX_PORTA_UP; ++ *fxp = l | 0xE0; ++ break; ++ case 0x9: /* extra fine portamento down */ ++ *fxt = FX_PORTA_DN; ++ *fxp = l | 0xE0; ++ break; ++ case EX_F_VSLIDE_UP: ++ /* Don't convert 0 as it would turn into volume slide down... */ ++ if (l) { ++ *fxt = FX_VOLSLIDE; ++ *fxp = (l << 4) | 0xF; ++ } ++ break; ++ case EX_F_VSLIDE_DN: ++ /* Don't convert 0 as it would turn into volume slide up... */ ++ if (l) { ++ *fxt = FX_VOLSLIDE; ++ *fxp = l | 0xF0; ++ } ++ break; ++ } ++ break; + case 0x10: /* arpeggio */ + *fxt = FX_S3M_ARPEGGIO; + break; +@@ -367,7 +408,7 @@ static int gdm_load(struct module_data *m, HIO_HANDLE *f, const int start) + return -1; + } + +- m->quirk |= QUIRK_ARPMEM; ++ m->quirk |= QUIRK_ARPMEM | QUIRK_FINEFX; + + return 0; + } diff --git a/docs/changelog.txt b/docs/changelog.txt index 932d3c67e..8ae84eab2 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -34,6 +34,9 @@ USERS decreased the size of the output HTML files somewhat. + Fixed libxmp playback for S3Ms containing ADPCM4 samples. This fixes mm2flash.s3m in ZeuxDrop. ++ Fixed libxmp playback for GDMs where 100/200/A00 should + continue the fine portamento and fine volume slide commands. + This fixes LB2_7.GDM from Kikan. + Windows builds now attempt to load and call SetProcessDPIAware on startup. This should fix undesirable DPI-related scaling and fullscreen bugs.