Merge pull request #1022 from tildearrow/x1_010_bank

Add Seta 2 Bankswitch support
This commit is contained in:
tildearrow 2023-08-30 02:22:18 -05:00 committed by GitHub
commit ff3cebfffd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 8 deletions

View file

@ -947,6 +947,7 @@ void DivPlatformX1_010::setFlags(const DivConfig& flags) {
CHECK_CUSTOM_CLOCK; CHECK_CUSTOM_CLOCK;
rate=chipClock/512; rate=chipClock/512;
stereo=flags.getBool("stereo",false); stereo=flags.getBool("stereo",false);
isBanked=flags.getBool("isBanked",false);
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;
} }
@ -979,7 +980,7 @@ bool DivPlatformX1_010::isSampleLoaded(int index, int sample) {
} }
void DivPlatformX1_010::renderSamples(int sysID) { void DivPlatformX1_010::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity()); memset(sampleMem,0,16777216);
memset(sampleOffX1,0,256*sizeof(unsigned int)); memset(sampleOffX1,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool)); memset(sampleLoaded,0,256*sizeof(bool));
@ -1018,10 +1019,6 @@ void DivPlatformX1_010::renderSamples(int sysID) {
sampleMemLen=memPos+256; sampleMemLen=memPos+256;
} }
void DivPlatformX1_010::setBanked(bool banked) {
isBanked=banked;
}
int DivPlatformX1_010::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { int DivPlatformX1_010::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
parent=p; parent=p;
dumpWrites=false; dumpWrites=false;
@ -1032,7 +1029,7 @@ int DivPlatformX1_010::init(DivEngine* p, int channels, int sugRate, const DivCo
oscBuf[i]=new DivDispatchOscBuffer; oscBuf[i]=new DivDispatchOscBuffer;
} }
setFlags(flags); setFlags(flags);
sampleMem=new unsigned char[getSampleMemCapacity()]; sampleMem=new unsigned char[16777216];
sampleMemLen=0; sampleMemLen=0;
x1_010.reset(); x1_010.reset();
reset(); reset();

View file

@ -153,7 +153,6 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf {
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
void renderSamples(int chipID); void renderSamples(int chipID);
const char** getRegisterSheet(); const char** getRegisterSheet();
void setBanked(bool banked);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
DivPlatformX1_010(): DivPlatformX1_010():

View file

@ -2101,7 +2101,10 @@ void FurnaceGUI::initSystemPresets() {
); );
ENTRY( ENTRY(
"Seta 2", { "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( ENTRY(

View file

@ -1016,6 +1016,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
case DIV_SYSTEM_X1_010: { case DIV_SYSTEM_X1_010: {
int clockSel=flags.getInt("clockSel",0); int clockSel=flags.getInt("clockSel",0);
bool stereo=flags.getBool("stereo",false); bool stereo=flags.getBool("stereo",false);
bool isBanked=flags.getBool("isBanked",false);
ImGui::Text("Clock rate:"); ImGui::Text("Clock rate:");
ImGui::Indent(); ImGui::Indent();
@ -1037,10 +1038,15 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
altered=true; altered=true;
} }
if (ImGui::Checkbox("Bankswitched (Seta 2)",&isBanked)) {
altered=true;
}
if (altered) { if (altered) {
e->lockSave([&]() { e->lockSave([&]() {
flags.set("clockSel",clockSel); flags.set("clockSel",clockSel);
flags.set("stereo",stereo); flags.set("stereo",stereo);
flags.set("isBanked",isBanked);
}); });
} }
break; break;