From e6b84280aa19a7bdc08f51ba07358fad122d22a4 Mon Sep 17 00:00:00 2001 From: cam900 Date: Sat, 11 Mar 2023 18:55:32 +0900 Subject: [PATCH 1/8] Add Seta 2 Bankswitch support --- src/engine/platform/x1_010.cpp | 9 +++++++-- src/gui/sysConf.cpp | 10 ++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/engine/platform/x1_010.cpp b/src/engine/platform/x1_010.cpp index 091da9f1a0..4c6a451651 100644 --- a/src/engine/platform/x1_010.cpp +++ b/src/engine/platform/x1_010.cpp @@ -931,6 +931,10 @@ void DivPlatformX1_010::setFlags(const DivConfig& flags) { chipClock=50000000.0/3.0; break; // Other clock is used + case 2: // NTSC clock * 4 + // (see https://github.com/mamedev/mame/blob/master/src/mame/taito/champbwl.cpp#L620) + chipClock=COLOR_NTSC*4.0; + break; default: chipClock=16000000; break; @@ -938,6 +942,7 @@ void DivPlatformX1_010::setFlags(const DivConfig& flags) { CHECK_CUSTOM_CLOCK; rate=chipClock/512; stereo=flags.getBool("stereo",false); + isBanked=flags.getBool("isBanked",false); for (int i=0; i<16; i++) { oscBuf[i]->rate=rate; } @@ -970,7 +975,7 @@ bool DivPlatformX1_010::isSampleLoaded(int index, int sample) { } void DivPlatformX1_010::renderSamples(int sysID) { - memset(sampleMem,0,getSampleMemCapacity()); + memset(sampleMem,0,16777216); memset(sampleOffX1,0,256*sizeof(unsigned int)); memset(sampleLoaded,0,256*sizeof(bool)); @@ -1023,7 +1028,7 @@ int DivPlatformX1_010::init(DivEngine* p, int channels, int sugRate, const DivCo oscBuf[i]=new DivDispatchOscBuffer; } setFlags(flags); - sampleMem=new unsigned char[getSampleMemCapacity()]; + sampleMem=new unsigned char[16777216]; sampleMemLen=0; x1_010.reset(); reset(); diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index 7bdb61de86..6084ab1f3d 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -845,6 +845,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo case DIV_SYSTEM_X1_010: { int clockSel=flags.getInt("clockSel",0); bool stereo=flags.getBool("stereo",false); + bool isBanked=flags.getBool("isBanked",false); ImGui::Text("Clock rate:"); if (ImGui::RadioButton("16MHz (Seta 1)",clockSel==0)) { @@ -855,15 +856,24 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo clockSel=1; altered=true; } + if (ImGui::RadioButton("14.32MHz (NTSC)",clockSel==2)) { + clockSel=2; + altered=true; + } if (ImGui::Checkbox("Stereo",&stereo)) { altered=true; } + if (ImGui::Checkbox("Bankswitched (Seta 2)",&isBanked)) { + altered=true; + } + if (altered) { e->lockSave([&]() { flags.set("clockSel",clockSel); flags.set("stereo",stereo); + flags.set("isBanked",isBanked); }); } break; From c8c2704a99c605c63b9db23368dbac50862500d2 Mon Sep 17 00:00:00 2001 From: cam900 Date: Sun, 12 Mar 2023 11:56:19 +0900 Subject: [PATCH 2/8] Revert unnecessary change --- src/engine/platform/x1_010.cpp | 4 ---- src/gui/sysConf.cpp | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/engine/platform/x1_010.cpp b/src/engine/platform/x1_010.cpp index 4c6a451651..8824271ed3 100644 --- a/src/engine/platform/x1_010.cpp +++ b/src/engine/platform/x1_010.cpp @@ -931,10 +931,6 @@ void DivPlatformX1_010::setFlags(const DivConfig& flags) { chipClock=50000000.0/3.0; break; // Other clock is used - case 2: // NTSC clock * 4 - // (see https://github.com/mamedev/mame/blob/master/src/mame/taito/champbwl.cpp#L620) - chipClock=COLOR_NTSC*4.0; - break; default: chipClock=16000000; break; diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index 6084ab1f3d..a2e927cbe6 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -856,10 +856,6 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo clockSel=1; altered=true; } - if (ImGui::RadioButton("14.32MHz (NTSC)",clockSel==2)) { - clockSel=2; - altered=true; - } if (ImGui::Checkbox("Stereo",&stereo)) { altered=true; From 90fa977d2324bc54cf3bb1c431e60273ddfdb043 Mon Sep 17 00:00:00 2001 From: cam900 Date: Mon, 27 Mar 2023 15:07:35 +0900 Subject: [PATCH 3/8] Fix seta2 preset --- src/gui/presets.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/presets.cpp b/src/gui/presets.cpp index 3354914c19..1ab18819ec 100644 --- a/src/gui/presets.cpp +++ b/src/gui/presets.cpp @@ -2019,7 +2019,10 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Seta 2", { - CH(DIV_SYSTEM_X1_010, 1.0f, 0, "clockSel=1") + CH(DIV_SYSTEM_X1_010, 1.0f, 0, + "clockSel=1\n" + "isBanked=true\n" + ) } ); ENTRY( From 2a43272c66c6dcabbf6bad80454720297ec3ec7d Mon Sep 17 00:00:00 2001 From: cam900 Date: Mon, 27 Mar 2023 15:08:37 +0900 Subject: [PATCH 4/8] Spacing --- src/gui/presets.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/presets.cpp b/src/gui/presets.cpp index 1ab18819ec..7c2cfc50f4 100644 --- a/src/gui/presets.cpp +++ b/src/gui/presets.cpp @@ -2020,8 +2020,8 @@ void FurnaceGUI::initSystemPresets() { ENTRY( "Seta 2", { CH(DIV_SYSTEM_X1_010, 1.0f, 0, - "clockSel=1\n" - "isBanked=true\n" + "clockSel=1\n" + "isBanked=true\n" ) } ); From 36f542972cfc76e7eed07d15293289e94447e9fa Mon Sep 17 00:00:00 2001 From: cam900 Date: Thu, 20 Apr 2023 08:54:40 +0900 Subject: [PATCH 5/8] Fix possible issue when bank flag is changed --- src/engine/platform/x1_010.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/engine/platform/x1_010.cpp b/src/engine/platform/x1_010.cpp index 4fce8d288f..79f592cea3 100644 --- a/src/engine/platform/x1_010.cpp +++ b/src/engine/platform/x1_010.cpp @@ -942,7 +942,11 @@ void DivPlatformX1_010::setFlags(const DivConfig& flags) { CHECK_CUSTOM_CLOCK; rate=chipClock/512; stereo=flags.getBool("stereo",false); + bool prevBanked=isBanked; isBanked=flags.getBool("isBanked",false); + if (prevBanked|=isBanked) { + parent->renderSamples(); + } for (int i=0; i<16; i++) { oscBuf[i]->rate=rate; } From 213d6135348f979c9e267c1d4f44f83bdde1db0c Mon Sep 17 00:00:00 2001 From: cam900 Date: Thu, 20 Apr 2023 10:02:29 +0900 Subject: [PATCH 6/8] Fix regression --- src/engine/platform/x1_010.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/platform/x1_010.cpp b/src/engine/platform/x1_010.cpp index 79f592cea3..deb294f658 100644 --- a/src/engine/platform/x1_010.cpp +++ b/src/engine/platform/x1_010.cpp @@ -944,7 +944,7 @@ void DivPlatformX1_010::setFlags(const DivConfig& flags) { stereo=flags.getBool("stereo",false); bool prevBanked=isBanked; isBanked=flags.getBool("isBanked",false); - if (prevBanked|=isBanked) { + if (prevBanked!=isBanked) { parent->renderSamples(); } for (int i=0; i<16; i++) { From e0dc22a6f1b1fbc040f0b5100d7cf0bcca946d34 Mon Sep 17 00:00:00 2001 From: cam900 Date: Wed, 26 Jul 2023 19:39:13 +0900 Subject: [PATCH 7/8] Remove unnecessary functions --- src/engine/platform/x1_010.cpp | 4 ---- src/engine/platform/x1_010.h | 1 - 2 files changed, 5 deletions(-) diff --git a/src/engine/platform/x1_010.cpp b/src/engine/platform/x1_010.cpp index a0512f0624..ec0f5e898e 100644 --- a/src/engine/platform/x1_010.cpp +++ b/src/engine/platform/x1_010.cpp @@ -1018,10 +1018,6 @@ void DivPlatformX1_010::renderSamples(int sysID) { sampleMemLen=memPos+256; } -void DivPlatformX1_010::setBanked(bool banked) { - isBanked=banked; -} - int DivPlatformX1_010::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { parent=p; dumpWrites=false; diff --git a/src/engine/platform/x1_010.h b/src/engine/platform/x1_010.h index a3af7b2919..25e3e6c14f 100644 --- a/src/engine/platform/x1_010.h +++ b/src/engine/platform/x1_010.h @@ -152,7 +152,6 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf { bool isSampleLoaded(int index, int sample); void renderSamples(int chipID); const char** getRegisterSheet(); - void setBanked(bool banked); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); void quit(); DivPlatformX1_010(): From 8ad7a5bf7d58ca5de6842c81d1d25124644b4bda Mon Sep 17 00:00:00 2001 From: cam900 Date: Thu, 27 Jul 2023 21:10:45 +0900 Subject: [PATCH 8/8] Remove global rendersamples --- src/engine/platform/x1_010.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/engine/platform/x1_010.cpp b/src/engine/platform/x1_010.cpp index ec0f5e898e..85aee3571a 100644 --- a/src/engine/platform/x1_010.cpp +++ b/src/engine/platform/x1_010.cpp @@ -942,11 +942,7 @@ void DivPlatformX1_010::setFlags(const DivConfig& flags) { CHECK_CUSTOM_CLOCK; rate=chipClock/512; stereo=flags.getBool("stereo",false); - bool prevBanked=isBanked; isBanked=flags.getBool("isBanked",false); - if (prevBanked!=isBanked) { - parent->renderSamples(); - } for (int i=0; i<16; i++) { oscBuf[i]->rate=rate; }