From 629d229bc14df46de75565ffaf5edf74406f4ada Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 28 Jan 2022 18:12:56 -0500 Subject: [PATCH] i will finish this later today --- src/engine/engine.cpp | 15 ++-- src/engine/engine.h | 3 + src/engine/song.h | 12 ++-- src/gui/gui.cpp | 154 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 174 insertions(+), 10 deletions(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 535352843..392c06534 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -4744,16 +4744,19 @@ void DivEngine::setOrder(unsigned char order) { isBusy.unlock(); } +void DivEngine::setSysFlags(int system, unsigned int flags) { + isBusy.lock(); + song.systemFlags[system]=flags; + disCont[system].dispatch->setFlags(song.systemFlags[system]); + disCont[system].setRates(got.rate); + isBusy.unlock(); +} + void DivEngine::setSongRate(int hz, bool pal) { isBusy.lock(); song.pal=!pal; song.hz=hz; song.customTempo=(song.hz!=50 && song.hz!=60); - for (int i=0; isetFlags((!song.pal) || (song.customTempo!=0 && song.hz<53)); - disCont[i].setRates(got.rate); - } divider=60; if (song.customTempo) { divider=song.hz; @@ -4804,7 +4807,7 @@ void DivEngine::switchMaster() { void DivEngine::initDispatch() { isBusy.lock(); for (int i=0; isong.systemLen; i++) { + if (ImGui::TreeNode(fmt::sprintf("%d. %s##_SYSP%d",i+1,getSystemName(e->song.system[i]),i).c_str())) { + unsigned int flags=e->song.systemFlags[i]; + bool sysPal=flags&1; + switch (e->song.system[i]) { + case DIV_SYSTEM_GENESIS: + case DIV_SYSTEM_GENESIS_EXT: + if (ImGui::RadioButton("NTSC (7.67MHz)",flags==0)) { + e->setSysFlags(i,0); + } + if (ImGui::RadioButton("PAL (7.61MHz)",flags==1)) { + e->setSysFlags(i,1); + } + if (ImGui::RadioButton("FM Towns (8MHz)",flags==2)) { + e->setSysFlags(i,2); + } + break; + case DIV_SYSTEM_SMS: + ImGui::Text("Clock rate:"); + if (ImGui::RadioButton("NTSC (3.58MHz)",(flags&3)==0)) { + e->setSysFlags(i,(flags&(~3))|0); + } + if (ImGui::RadioButton("PAL (3.55MHz)",(flags&3)==1)) { + e->setSysFlags(i,(flags&(~3))|1); + } + if (ImGui::RadioButton("BBC Micro (4MHz)",(flags&3)==2)) { + e->setSysFlags(i,(flags&(~3))|2); + } + ImGui::Text("Chip type:"); + if (ImGui::RadioButton("Sega VDP/Master System",(flags>>2)==0)) { + e->setSysFlags(i,(flags&3)|0); + } + if (ImGui::RadioButton("TI SN76489",(flags>>2)==1)) { + e->setSysFlags(i,(flags&3)|4); + } + if (ImGui::RadioButton("TI SN76489 with Atari-like short noise",(flags>>2)==2)) { + e->setSysFlags(i,(flags&3)|8); + } + if (ImGui::RadioButton("Game Gear",(flags>>2)==3)) { + e->setSysFlags(i,(flags&3)|12); + } + break; + case DIV_SYSTEM_ARCADE: + case DIV_SYSTEM_YM2151: + if (ImGui::RadioButton("NTSC (3.58MHz)",flags==0)) { + e->setSysFlags(i,0); + } + if (ImGui::RadioButton("PAL (3.55MHz)",flags==1)) { + e->setSysFlags(i,1); + } + if (ImGui::RadioButton("X68000 (4MHz)",flags==2)) { + e->setSysFlags(i,2); + } + break; + case DIV_SYSTEM_NES: + if (ImGui::RadioButton("NTSC (1.79MHz)",flags==0)) { + e->setSysFlags(i,0); + } + if (ImGui::RadioButton("PAL (1.67MHz)",flags==1)) { + e->setSysFlags(i,1); + } + if (ImGui::RadioButton("Dendy (1.77MHz)",flags==2)) { + e->setSysFlags(i,2); + } + break; + case DIV_SYSTEM_AY8910: + case DIV_SYSTEM_AY8930: { + ImGui::Text("Clock rate:"); + if (ImGui::RadioButton("1.79MHz (ZX Spectrum/MSX NTSC)",(flags&15)==0)) { + e->setSysFlags(i,(flags&(~15))|0); + } + if (ImGui::RadioButton("1.77MHz (ZX Spectrum/MSX PAL)",(flags&15)==1)) { + e->setSysFlags(i,(flags&(~15))|1); + } + if (ImGui::RadioButton("1.75MHz (ZX Spectrum)",(flags&15)==2)) { + e->setSysFlags(i,(flags&(~15))|2); + } + if (ImGui::RadioButton("2MHz (Atari ST)",(flags&15)==3)) { + e->setSysFlags(i,(flags&(~15))|3); + } + if (ImGui::RadioButton("1.5MHz (Vectrex)",(flags&15)==4)) { + e->setSysFlags(i,(flags&(~15))|4); + } + if (ImGui::RadioButton("1MHz (Amstrad CPC)",(flags&15)==5)) { + e->setSysFlags(i,(flags&(~15))|5); + } + if (ImGui::RadioButton("0.89MHz (Sunsoft 5B)",(flags&15)==6)) { + e->setSysFlags(i,(flags&(~15))|6); + } + if (ImGui::RadioButton("1.67MHz (?)",(flags&15)==7)) { + e->setSysFlags(i,(flags&(~15))|7); + } + if (ImGui::RadioButton("0.83MHz (Sunsoft 5B on PAL)",(flags&15)==8)) { + e->setSysFlags(i,(flags&(~15))|8); + } + if (e->song.system[i]==DIV_SYSTEM_AY8910) { + ImGui::Text("Chip type:"); + if (ImGui::RadioButton("AY-3-8910",(flags&0x30)==0)) { + e->setSysFlags(i,(flags&(~0x30))|0); + } + if (ImGui::RadioButton("YM2149(F)",(flags&0x30)==16)) { + e->setSysFlags(i,(flags&(~0x30))|16); + } + if (ImGui::RadioButton("Sunsoft 5B",(flags&0x30)==32)) { + e->setSysFlags(i,(flags&(~0x30))|32); + } + } + bool stereo=flags&0x40; + if (ImGui::Checkbox("Stereo##_AY_STEREO",&stereo)) { + e->setSysFlags(i,(flags&(~0x40))|(stereo?0x40:0)); + } + break; + } + case DIV_SYSTEM_SAA1099: + if (ImGui::RadioButton("SAM Coupé (8MHz)",flags==0)) { + e->setSysFlags(i,0); + } + if (ImGui::RadioButton("NTSC (7.15MHz)",flags==1)) { + e->setSysFlags(i,1); + } + if (ImGui::RadioButton("PAL (7.09MHz)",flags==2)) { + e->setSysFlags(i,2); + } + break; + case DIV_SYSTEM_AMIGA: + if (ImGui::RadioButton("Amiga 500 (OCS)",(flags&2)==0)) { + e->setSysFlags(i,flags&1); + } + if (ImGui::RadioButton("Amiga 1200 (AGA)",(flags&2)==2)) { + e->setSysFlags(i,(flags&1)|2); + } + sysPal=flags&1; + if (ImGui::Checkbox("PAL",&sysPal)) { + e->setSysFlags(i,(flags&2)|sysPal); + } + break; + case DIV_SYSTEM_GB: + case DIV_SYSTEM_YM2610: + case DIV_SYSTEM_YM2610_EXT: + case DIV_SYSTEM_YMU759: + ImGui::Text("nothing to configure"); + break; + default: + if (ImGui::Checkbox("PAL",&sysPal)) { + e->setSysFlags(i,sysPal); + } + break; + } + ImGui::TreePop(); + } + } + ImGui::EndMenu(); + } if (ImGui::BeginMenu("change system...")) { for (int i=0; isong.systemLen; i++) { if (ImGui::BeginMenu(fmt::sprintf("%d. %s##_SYSC%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {