From 3ff8f3d8602335d6585bfd6b0284e3047728c2f8 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 25 Jul 2022 19:09:42 -0500 Subject: [PATCH] FC loader: read slides --- src/engine/fileOps.cpp | 43 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index 71b8f90d1..30a9db943 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -2292,10 +2292,10 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) { DivSong ds; ds.tuning=436.0; ds.version=DIV_VERSION_FC; - ds.linearPitch=0; - ds.noSlidesOnFirstTick=true; - ds.rowResetsArpPos=true; - ds.ignoreJumpAtEnd=false; + //ds.linearPitch=0; + //ds.noSlidesOnFirstTick=true; + //ds.rowResetsArpPos=true; + //ds.ignoreJumpAtEnd=false; // load here if (!reader.seek(0,SEEK_SET)) { @@ -2436,6 +2436,9 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) { p->data[0][9]=seq[i].speed; } + bool ignoreNext=false; + bool isSliding=false; + for (int k=0; k<32; k++) { FCPattern& fp=pat[seq[i].pat[j]]; if (fp.note[k]>0 && fp.note[k]<0x49) { @@ -2449,9 +2452,37 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) { octave&=0xff; p->data[k][0]=note; p->data[k][1]=octave; - if (fp.val[k]) { + if (isSliding) { + isSliding=false; + p->data[k][4]=2; + p->data[k][5]=0; + } + } + if (fp.val[k]) { + if (ignoreNext) { + ignoreNext=false; + } else { if (fp.val[k]&0xe0) { - + if (fp.val[k]&0x40) { + p->data[k][4]=2; + p->data[k][5]=0; + isSliding=false; + } else if (fp.val[k]&0x80) { + isSliding=true; + if (k<31) { + if (fp.val[k+1]&0x20) { + p->data[k][4]=2; + p->data[k][5]=fp.val[k+1]&0x1f; + } else { + p->data[k][4]=1; + p->data[k][5]=fp.val[k+1]&0x1f; + } + ignoreNext=true; + } else { + p->data[k][4]=2; + p->data[k][5]=0; + } + } } else { p->data[k][2]=fp.val[k]-1; }