From 049ab065449d4237734ff6fb2214fe09482d255f Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 4 Aug 2022 23:37:28 -0500 Subject: [PATCH] PCE: add option to pick A/non-A revision of chip --- src/engine/platform/pce.cpp | 13 +++++++++++-- src/gui/sysConf.cpp | 7 +++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/engine/platform/pce.cpp b/src/engine/platform/pce.cpp index a61b61836..d46e012ce 100644 --- a/src/engine/platform/pce.cpp +++ b/src/engine/platform/pce.cpp @@ -569,6 +569,12 @@ void DivPlatformPCE::setFlags(unsigned int flags) { for (int i=0; i<6; i++) { oscBuf[i]->rate=rate; } + + if (pce!=NULL) { + delete pce; + pce=NULL; + } + pce=new PCE_PSG(tempL,tempR,(flags&4)?PCE_PSG::REVISION_HUC6280A:PCE_PSG::REVISION_HUC6280); } void DivPlatformPCE::poke(unsigned int addr, unsigned short val) { @@ -587,8 +593,8 @@ int DivPlatformPCE::init(DivEngine* p, int channels, int sugRate, unsigned int f isMuted[i]=false; oscBuf[i]=new DivDispatchOscBuffer; } + pce=NULL; setFlags(flags); - pce=new PCE_PSG(tempL,tempR,PCE_PSG::REVISION_HUC6280A); reset(); return 6; } @@ -597,7 +603,10 @@ void DivPlatformPCE::quit() { for (int i=0; i<6; i++) { delete oscBuf[i]; } - delete pce; + if (pce!=NULL) { + delete pce; + pce=NULL; + } } DivPlatformPCE::~DivPlatformPCE() { diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index 7c624f309..4cc1784a6 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -118,6 +118,13 @@ void FurnaceGUI::drawSysConf(int chan, DivSystem type, unsigned int& flags, bool if (ImGui::Checkbox("Disable anti-click",&antiClick)) { copyOfFlags=(flags&(~8))|(antiClick<<3); } + ImGui::Text("Chip revision:"); + if (ImGui::RadioButton("HuC6280 (original)",(flags&4)==0)) { + copyOfFlags=(flags&(~4))|0; + } + if (ImGui::RadioButton("HuC6280A (SuperGrafx)",(flags&4)==4)) { + copyOfFlags=(flags&(~4))|4; + } break; } case DIV_SYSTEM_SOUND_UNIT: {