Prepare to YMF289B OPL3-L support

This commit is contained in:
cam900 2023-01-05 08:40:44 +09:00
parent 560ec19176
commit e5d81bd694
3 changed files with 43 additions and 2 deletions

View file

@ -1722,13 +1722,29 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) {
case 0x04:
chipClock=15000000.0;
break;
case 0x05:
chipClock=33868800.0;
break;
default:
chipClock=COLOR_NTSC*4.0;
break;
}
CHECK_CUSTOM_CLOCK;
rate=chipClock/288;
chipRateBase=rate;
switch (flags.getInt("chipType",0)) {
case 1: // YMF289B
chipFreqBase=32768*684;
rate=chipClock/684;
chipRateBase=chipClock/768;
downsample=true;
break;
default: // YMF262
chipFreqBase=32768*288;
rate=chipClock/288;
chipRateBase=rate;
downsample=false;
break;
}
reset();
break;
case 4:
switch (flags.getInt("clockSel",0)) {

View file

@ -2248,6 +2248,16 @@ void FurnaceGUI::initSystemPresets() {
CH(DIV_SYSTEM_OPL3_DRUMS, 64, 0, "")
}
);
ENTRY(
"Yamaha YMF289B (OPL3-L)", {
CH(DIV_SYSTEM_OPL3, 64, 0, "chipType=1")
}
);
ENTRY(
"Yamaha YMF289B (drums mode)", {
CH(DIV_SYSTEM_OPL3_DRUMS, 64, 0, "chipType=1")
}
);
if (settings.hiddenSystems) {
ENTRY(
"Yamaha YMU759 (MA-2)", {

View file

@ -1182,6 +1182,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
case DIV_SYSTEM_OPL3:
case DIV_SYSTEM_OPL3_DRUMS: {
int clockSel=flags.getInt("clockSel",0);
int chipType=flags.getInt("chipType",0);
ImGui::Text("Clock rate:");
if (ImGui::RadioButton("14.32MHz (NTSC)",clockSel==0)) {
@ -1204,10 +1205,24 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
clockSel=4;
altered=true;
}
if (ImGui::RadioButton("33.8688MHz (OPL3-L)",clockSel==5)) {
clockSel=5;
altered=true;
}
ImGui::Text("Chip type:");
if (ImGui::RadioButton("OPL3 (YMF262)",chipType==0)) {
chipType=0;
altered=true;
}
if (ImGui::RadioButton("OPL3-L (YMF289B)",chipType==1)) {
chipType=1;
altered=true;
}
if (altered) {
e->lockSave([&]() {
flags.set("clockSel",clockSel);
flags.set("chipType",chipType);
});
}
break;