From 8d8bdfd1f71dcb60b8949be16b3096c9d4126c59 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 7 Nov 2022 18:39:04 -0500 Subject: [PATCH] dev125 - prepare for ExtCh FM macros --- src/engine/engine.h | 4 ++-- src/engine/fileOps.cpp | 15 +++++++++++++++ src/engine/platform/genesis.cpp | 1 + src/engine/platform/genesis.h | 2 +- src/engine/platform/ym2203.cpp | 1 + src/engine/platform/ym2203.h | 2 +- src/engine/platform/ym2608.cpp | 1 + src/engine/platform/ym2608.h | 2 +- src/engine/platform/ym2610shared.h | 3 ++- src/gui/sysConf.cpp | 31 ++++++++++++++++++++++++++++++ 10 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/engine/engine.h b/src/engine/engine.h index 3dd058cf..8f57c579 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -47,8 +47,8 @@ #define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock(); #define BUSY_END isBusy.unlock(); softLocked=false; -#define DIV_VERSION "dev124" -#define DIV_ENGINE_VERSION 124 +#define DIV_VERSION "dev125" +#define DIV_ENGINE_VERSION 125 // for imports #define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_FC 0xff02 diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index 0ff76653..bc80da32 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -2616,6 +2616,21 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { } } + // ExtCh compat flag + if (ds.version<125) { + for (int i=0; isample_rate(chipClock); for (int i=0; i<6; i++) { oscBuf[i]->rate=rate; diff --git a/src/engine/platform/ym2203.h b/src/engine/platform/ym2203.h index b51a4234..b93e45dd 100644 --- a/src/engine/platform/ym2203.h +++ b/src/engine/platform/ym2203.h @@ -91,7 +91,7 @@ class DivPlatformYM2203: public DivPlatformOPN { DivPlatformAY8910* ay; unsigned char sampleBank; - bool extMode; + bool extMode, noExtMacros; unsigned char prescale; friend void putDispatchChip(void*,int); diff --git a/src/engine/platform/ym2608.cpp b/src/engine/platform/ym2608.cpp index 79ae9511..a58bad8d 100644 --- a/src/engine/platform/ym2608.cpp +++ b/src/engine/platform/ym2608.cpp @@ -1394,6 +1394,7 @@ void DivPlatformYM2608::setFlags(const DivConfig& flags) { ayDiv=32; break; } + noExtMacros=flags.getBool("noExtMacros",false); rate=fm->sample_rate(chipClock); for (int i=0; i<16; i++) { oscBuf[i]->rate=rate; diff --git a/src/engine/platform/ym2608.h b/src/engine/platform/ym2608.h index 7a9eefa9..f4c101c2 100644 --- a/src/engine/platform/ym2608.h +++ b/src/engine/platform/ym2608.h @@ -106,7 +106,7 @@ class DivPlatformYM2608: public DivPlatformOPN { unsigned char writeRSSOff, writeRSSOn; int globalRSSVolume; - bool extMode; + bool extMode, noExtMacros; unsigned char prescale; double NOTE_OPNB(int ch, int note); diff --git a/src/engine/platform/ym2610shared.h b/src/engine/platform/ym2610shared.h index 3641306c..4b69920c 100644 --- a/src/engine/platform/ym2610shared.h +++ b/src/engine/platform/ym2610shared.h @@ -141,7 +141,7 @@ template class DivPlatformYM2610Base: public DivPlatformOPN { unsigned char sampleBank; - bool extMode; + bool extMode, noExtMacros; unsigned char writeADPCMAOff, writeADPCMAOn; int globalADPCMAVolume; @@ -269,6 +269,7 @@ template class DivPlatformYM2610Base: public DivPlatformOPN { chipClock=8000000.0; break; } + noExtMacros=flags.getBool("noExtMacros",false); rate=chipClock/16; for (int i=0; irate=rate; diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index 967624a5..79d7344c 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -32,6 +32,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo case DIV_SYSTEM_YM2612_FRAC_EXT: { int clockSel=flags.getInt("clockSel",0); bool ladder=flags.getBool("ladderEffect",0); + bool noExtMacros=flags.getBool("noExtMacros",false); if (ImGui::RadioButton("NTSC (7.67MHz)",clockSel==0)) { clockSel=0; @@ -56,11 +57,17 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo if (ImGui::Checkbox("Enable DAC distortion",&ladder)) { altered=true; } + if (type==DIV_SYSTEM_YM2612_EXT || type==DIV_SYSTEM_YM2612_FRAC_EXT) { + if (ImGui::Checkbox("Disable ExtCh FM macros (compatibility)",&noExtMacros)) { + altered=true; + } + } if (altered) { e->lockSave([&]() { flags.set("clockSel",clockSel); flags.set("ladderEffect",ladder); + flags.set("noExtMacros",noExtMacros); }); } break; @@ -439,6 +446,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo case DIV_SYSTEM_YM2610B: case DIV_SYSTEM_YM2610B_EXT: { int clockSel=flags.getInt("clockSel",0); + bool noExtMacros=flags.getBool("noExtMacros",false); if (ImGui::RadioButton("8MHz (Neo Geo MVS)",clockSel==0)) { clockSel=0; @@ -449,9 +457,16 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo altered=true; } + if (type==DIV_SYSTEM_YM2610_EXT || type==DIV_SYSTEM_YM2610_FULL_EXT || type==DIV_SYSTEM_YM2610B_EXT) { + if (ImGui::Checkbox("Disable ExtCh FM macros (compatibility)",&noExtMacros)) { + altered=true; + } + } + if (altered) { e->lockSave([&]() { flags.set("clockSel",clockSel); + flags.set("noExtMacros",noExtMacros); }); } break; @@ -789,6 +804,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo case DIV_SYSTEM_OPN_EXT: { int clockSel=flags.getInt("clockSel",0); int prescale=flags.getInt("prescale",0); + bool noExtMacros=flags.getBool("noExtMacros",false); ImGui::Text("Clock rate:"); if (ImGui::RadioButton("3.58MHz (NTSC)",clockSel==0)) { @@ -829,10 +845,17 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo altered=true; } + if (type==DIV_SYSTEM_OPN_EXT) { + if (ImGui::Checkbox("Disable ExtCh FM macros (compatibility)",&noExtMacros)) { + altered=true; + } + } + if (altered) { e->lockSave([&]() { flags.set("clockSel",clockSel); flags.set("prescale",prescale); + flags.set("noExtMacros",noExtMacros); }); } break; @@ -841,6 +864,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo case DIV_SYSTEM_PC98_EXT: { int clockSel=flags.getInt("clockSel",0); int prescale=flags.getInt("prescale",0); + bool noExtMacros=flags.getBool("noExtMacros",false); ImGui::Text("Clock rate:"); if (ImGui::RadioButton("8MHz (Arcade)",clockSel==0)) { @@ -865,10 +889,17 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo altered=true; } + if (type==DIV_SYSTEM_PC98_EXT) { + if (ImGui::Checkbox("Disable ExtCh FM macros (compatibility)",&noExtMacros)) { + altered=true; + } + } + if (altered) { e->lockSave([&]() { flags.set("clockSel",clockSel); flags.set("prescale",prescale); + flags.set("noExtMacros",noExtMacros); }); } break;