i will finish this later today

This commit is contained in:
tildearrow 2022-01-28 18:12:56 -05:00
parent 09ebadf479
commit 629d229bc1
4 changed files with 174 additions and 10 deletions

View file

@ -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; i<song.systemLen; i++) {
// TODO
disCont[i].dispatch->setFlags((!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; i<song.systemLen; i++) {
disCont[i].init(song.system[i],this,getChannelCount(song.system[i]),got.rate,(!song.pal) || (song.customTempo!=0 && song.hz<53));
disCont[i].init(song.system[i],this,getChannelCount(song.system[i]),got.rate,song.systemFlags[i]);
disCont[i].setRates(got.rate);
disCont[i].setQuality(lowQuality);
}

View file

@ -451,6 +451,9 @@ class DivEngine {
// go to order
void setOrder(unsigned char order);
// set system flags
void setSysFlags(int system, unsigned int flags);
// set Hz
void setSongRate(int hz, bool pal);

View file

@ -100,8 +100,11 @@ struct DivSong {
// - 1: PAL
// - 2: Dendy
// - SMS/SN76489:
// - bit 0: PAL
// - bit 1-2: noise type
// - bit 0-1: clock rate
// - 0: NTSC (3.58MHz)
// - 1: PAL (3.55MHz)
// - 2: Other (4MHz)
// - bit 2-3: noise type
// - 0: Sega VDP (16-bit noise)
// - 1: real SN76489 (15-bit noise)
// - 2: real SN76489 with Atari-like short noise buzz (15-bit noise)
@ -126,6 +129,7 @@ struct DivSong {
// - 5: 1MHz (Amstrad CPC)
// - 6: 0.89MHz (Sunsoft 5B)
// - 7: 1.67MHz
// - 8: 0.83MHz (Sunsoft 5B on PAL)
// - bit 4-5: chip type (ignored on AY8930)
// - 0: AY-3-8910 or similar
// - 1: YM2149
@ -139,10 +143,10 @@ struct DivSong {
// - 1: 7.15MHz
// - 2: 7.09MHz
// - Amiga:
// - bit 0-1: clock rate
// - bit 0: clock rate
// - 0: 7.15MHz (NTSC)
// - 1: 7.09MHz (PAL)
// - bit 2: model
// - bit 1: model
// - 0: Amiga 500
// - 1: Amiga 1200
unsigned int systemFlags[32];

View file

@ -4541,6 +4541,160 @@ bool FurnaceGUI::loop() {
sysAddOption(DIV_SYSTEM_AY8930);
ImGui::EndMenu();
}
if (ImGui::BeginMenu("configure system...")) {
for (int i=0; i<e->song.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; i<e->song.systemLen; i++) {
if (ImGui::BeginMenu(fmt::sprintf("%d. %s##_SYSC%d",i+1,getSystemName(e->song.system[i]),i).c_str())) {