From 26b72eb348bf174399a1e6afe36ddbb9380730ea Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 24 Jun 2024 03:04:02 -0500 Subject: [PATCH] S3M import: fix Bxx effect --- src/engine/fileOps/s3m.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/engine/fileOps/s3m.cpp b/src/engine/fileOps/s3m.cpp index f62f24aca..07b693ca4 100644 --- a/src/engine/fileOps/s3m.cpp +++ b/src/engine/fileOps/s3m.cpp @@ -61,12 +61,21 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) { unsigned char chanPan[16]; unsigned char defVol[256]; + unsigned char orders[256]; + bool doesPitchSlide[32]; bool doesVibrato[32]; bool doesPanning[32]; bool doesVolSlide[32]; bool doesArp[32]; + memset(chanSettings,0,32); + memset(insPtr,0,256*sizeof(unsigned int)); + memset(patPtr,0,256*sizeof(unsigned int)); + memset(chanPan,0,16); + memset(defVol,0,256); + memset(orders,0,256); + memset(doesPitchSlide,0,32*sizeof(bool)); memset(doesVibrato,0,32*sizeof(bool)); memset(doesPanning,0,32*sizeof(bool)); @@ -183,6 +192,8 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) { ds.subsong[curSubSong]->ordersLen=0; for (int i=0; iorders.ord[j][ds.subsong[curSubSong]->ordersLen]=nextOrder; } ds.subsong[curSubSong]->ordersLen++; + curOrder++; } logD("reading ins pointers..."); @@ -763,9 +775,8 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) { p->data[curRow][effectCol[chan]++]=effectVal; break; case 'B': // go to order - // TODO: handle subsongs and spacing p->data[curRow][effectCol[chan]++]=0x0b; - p->data[curRow][effectCol[chan]++]=effectVal; + p->data[curRow][effectCol[chan]++]=orders[effectVal]; break; case 'C': // next order p->data[curRow][effectCol[chan]++]=0x0d;