Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Seta 2 Bankswitch support #1022

Merged
merged 16 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/engine/platform/x1_010.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,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;
}
Expand Down Expand Up @@ -974,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));

Expand Down Expand Up @@ -1013,10 +1014,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;
Expand All @@ -1027,7 +1024,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();
Expand Down
1 change: 0 additions & 1 deletion src/engine/platform/x1_010.h
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
5 changes: 4 additions & 1 deletion src/gui/presets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,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(
Expand Down
6 changes: 6 additions & 0 deletions src/gui/sysConf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,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)) {
Expand All @@ -950,10 +951,15 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
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;
Expand Down