C64: add chip flag to set env reset time

2 by default
1 for .dmf and old Furnace songs
This commit is contained in:
tildearrow 2023-10-29 04:14:54 -05:00
parent 7fd54775bb
commit f05d1693f8
4 changed files with 29 additions and 3 deletions

View file

@ -1062,9 +1062,10 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
ds.systemFlags[0].set("dpcmMode",false); ds.systemFlags[0].set("dpcmMode",false);
} }
// C64 no key priority // C64 no key priority and reset time
if (ds.system[0]==DIV_SYSTEM_C64_8580 || ds.system[0]==DIV_SYSTEM_C64_6581) { if (ds.system[0]==DIV_SYSTEM_C64_8580 || ds.system[0]==DIV_SYSTEM_C64_6581) {
ds.systemFlags[0].set("keyPriority",false); ds.systemFlags[0].set("keyPriority",false);
ds.systemFlags[0].set("initResetTime",1);
} }
// OPM broken pitch // OPM broken pitch
@ -3033,6 +3034,15 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
} }
} }
// C64 original reset time
if (ds.version<187) {
for (int i=0; i<ds.systemLen; i++) {
if (ds.system[i]==DIV_SYSTEM_C64_8580 || ds.system[i]==DIV_SYSTEM_C64_6581) {
ds.systemFlags[i].set("initResetTime",1);
}
}
}
if (active) quitDispatch(); if (active) quitDispatch();
BUSY_BEGIN_SOFT; BUSY_BEGIN_SOFT;
saveLock.lock(); saveLock.lock();

View file

@ -678,7 +678,7 @@ void DivPlatformC64::reset() {
filtControl=7; filtControl=7;
filtRes=0; filtRes=0;
filtCut=2047; filtCut=2047;
resetTime=1; resetTime=initResetTime;
vol=15; vol=15;
chanOrder[0]=0; chanOrder[0]=0;
@ -728,6 +728,8 @@ void DivPlatformC64::setFlags(const DivConfig& flags) {
no1EUpdate=flags.getBool("no1EUpdate",false); no1EUpdate=flags.getBool("no1EUpdate",false);
testAD=((flags.getInt("testAttack",0)&15)<<4)|(flags.getInt("testDecay",0)&15); testAD=((flags.getInt("testAttack",0)&15)<<4)|(flags.getInt("testDecay",0)&15);
testSR=((flags.getInt("testSustain",0)&15)<<4)|(flags.getInt("testRelease",0)&15); testSR=((flags.getInt("testSustain",0)&15)<<4)|(flags.getInt("testRelease",0)&15);
initResetTime=flags.getInt("initResetTime",2);
if (initResetTime<0) initResetTime=1;
// init fake filter table // init fake filter table
// taken from dSID // taken from dSID

View file

@ -75,7 +75,7 @@ class DivPlatformC64: public DivDispatch {
unsigned char filtControl, filtRes, vol; unsigned char filtControl, filtRes, vol;
unsigned char writeOscBuf; unsigned char writeOscBuf;
unsigned char sidCore; unsigned char sidCore;
int filtCut, resetTime; int filtCut, resetTime, initResetTime;
bool keyPriority, sidIs6581, needInitTables, no1EUpdate; bool keyPriority, sidIs6581, needInitTables, no1EUpdate;
unsigned char chanOrder[3]; unsigned char chanOrder[3];

View file

@ -591,6 +591,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
int testDecay=flags.getInt("testDecay",0); int testDecay=flags.getInt("testDecay",0);
int testSustain=flags.getInt("testSustain",0); int testSustain=flags.getInt("testSustain",0);
int testRelease=flags.getInt("testRelease",0); int testRelease=flags.getInt("testRelease",0);
int initResetTime=flags.getInt("initResetTime",2);
ImGui::Text("Clock rate:"); ImGui::Text("Clock rate:");
@ -645,6 +646,18 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
altered=true; altered=true;
} }
ImGui::Text("Envelope reset time:");
pushWarningColor(initResetTime<1 || initResetTime>4);
if (CWSliderInt("##InitReset",&initResetTime,0,16)) {
if (initResetTime<0) initResetTime=0;
if (initResetTime>16) initResetTime=16;
altered=true;
}
popWarningColor();
ImGui::Text("- 0 disables envelope reset. not recommended!\n- 1 may trigger SID envelope bugs.\n- values that are too high may result in notes being skipped.");
if (ImGui::Checkbox("Disable 1Exy env update (compatibility)",&no1EUpdate)) { if (ImGui::Checkbox("Disable 1Exy env update (compatibility)",&no1EUpdate)) {
altered=true; altered=true;
} }
@ -658,6 +671,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
flags.set("testDecay",testDecay); flags.set("testDecay",testDecay);
flags.set("testSustain",testSustain); flags.set("testSustain",testSustain);
flags.set("testRelease",testRelease); flags.set("testRelease",testRelease);
flags.set("initResetTime",initResetTime);
}); });
} }
break; break;