dev220: SNES anti-click

This commit is contained in:
tildearrow 2024-08-31 19:07:36 -05:00
parent eadb6daf81
commit 11935fb525
4 changed files with 31 additions and 3 deletions

View file

@ -52,10 +52,10 @@ class DivWorkPool;
#define EXTERN_BUSY_BEGIN_SOFT e->softLocked=true; e->isBusy.lock();
#define EXTERN_BUSY_END e->isBusy.unlock(); e->softLocked=false;
//#define DIV_UNSTABLE
#define DIV_UNSTABLE
#define DIV_VERSION "0.6.7"
#define DIV_ENGINE_VERSION 219
#define DIV_VERSION "dev220"
#define DIV_ENGINE_VERSION 220
// for imports
#define DIV_VERSION_MOD 0xff01
#define DIV_VERSION_FC 0xff02

View file

@ -2102,6 +2102,16 @@ bool DivEngine::loadFur(unsigned char* file, size_t len, int variantID) {
}
}
// SNES no anti-click
if (ds.version<220) {
for (int i=0; i<ds.systemLen; i++) {
if (ds.system[i]==DIV_SYSTEM_SNES) {
ds.systemFlags[i].set("antiClick",false);
}
}
}
if (active) quitDispatch();
BUSY_BEGIN_SOFT;
saveLock.lock();

View file

@ -255,6 +255,18 @@ void DivPlatformSNES::tick(bool sysTick) {
}
}
if (koff!=0) {
// TODO: improve
if (antiClick) {
for (int i=0; i<8; i++) {
if (koff&(1<<i)) {
logV("KOFF: %d",i);
chWrite(i,5,0);
chWrite(i,7,0x9f);
chan[i].shallWriteEnv=true;
}
}
rWriteDelay(0x7e,0,64);
}
rWriteDelay(0x5c,koff,8);
}
if (writeControl) {

View file

@ -1970,6 +1970,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
echoFilter[7]=flags.getInt("echoFilter7",0);
bool interpolationOff=flags.getBool("interpolationOff",false);
bool antiClick=flags.getBool("antiClick",true);
ImGui::Text(_("Volume scale:"));
if (CWSliderInt(_("Left##VolScaleL"),&vsL,0,127)) {
@ -2090,6 +2091,10 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
altered=true;
}
if (ImGui::Checkbox(_("Anti-click"),&antiClick)) {
altered=true;
}
if (altered) {
e->lockSave([&]() {
flags.set("volScaleL",127-vsL);
@ -2109,6 +2114,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
flags.set("echoFilter7",echoFilter[7]);
flags.set("echoMask",echoMask);
flags.set("interpolationOff",interpolationOff);
flags.set("antiClick",antiClick);
});
}