This commit is contained in:
cam900 2022-08-21 14:07:37 +09:00
commit b96ad65d58
3 changed files with 25 additions and 21 deletions

View file

@ -179,7 +179,8 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
switch (sys) { switch (sys) {
case DIV_SYSTEM_YMU759: case DIV_SYSTEM_YMU759:
dispatch=new DivPlatformOPL(759,false); dispatch=new DivPlatformOPL;
((DivPlatformOPL*)dispatch)->setOPLType(759,false);
break; break;
case DIV_SYSTEM_YM2612: case DIV_SYSTEM_YM2612:
dispatch=new DivPlatformGenesis; dispatch=new DivPlatformGenesis;
@ -277,20 +278,36 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
((DivPlatformOPLL*)dispatch)->setProperDrums(sys==DIV_SYSTEM_OPLL_DRUMS); ((DivPlatformOPLL*)dispatch)->setProperDrums(sys==DIV_SYSTEM_OPLL_DRUMS);
break; break;
case DIV_SYSTEM_OPL: case DIV_SYSTEM_OPL:
dispatch=new DivPlatformOPL;
((DivPlatformOPL*)dispatch)->setOPLType(1,false);
break;
case DIV_SYSTEM_OPL_DRUMS: case DIV_SYSTEM_OPL_DRUMS:
dispatch=new DivPlatformOPL(1,sys==DIV_SYSTEM_OPL_DRUMS); dispatch=new DivPlatformOPL;
((DivPlatformOPL*)dispatch)->setOPLType(1,true);
break; break;
case DIV_SYSTEM_OPL2: case DIV_SYSTEM_OPL2:
dispatch=new DivPlatformOPL;
((DivPlatformOPL*)dispatch)->setOPLType(2,false);
break;
case DIV_SYSTEM_OPL2_DRUMS: case DIV_SYSTEM_OPL2_DRUMS:
dispatch=new DivPlatformOPL(2,sys==DIV_SYSTEM_OPL2_DRUMS); dispatch=new DivPlatformOPL;
((DivPlatformOPL*)dispatch)->setOPLType(2,true);
break; break;
case DIV_SYSTEM_OPL3: case DIV_SYSTEM_OPL3:
dispatch=new DivPlatformOPL;
((DivPlatformOPL*)dispatch)->setOPLType(3,false);
break;
case DIV_SYSTEM_OPL3_DRUMS: case DIV_SYSTEM_OPL3_DRUMS:
dispatch=new DivPlatformOPL(3,sys==DIV_SYSTEM_OPL3_DRUMS); dispatch=new DivPlatformOPL;
((DivPlatformOPL*)dispatch)->setOPLType(3,true);
break; break;
case DIV_SYSTEM_Y8950: case DIV_SYSTEM_Y8950:
dispatch=new DivPlatformOPL;
((DivPlatformOPL*)dispatch)->setOPLType(8950,false);
break;
case DIV_SYSTEM_Y8950_DRUMS: case DIV_SYSTEM_Y8950_DRUMS:
dispatch=new DivPlatformOPL(8950,sys==DIV_SYSTEM_Y8950_DRUMS); dispatch=new DivPlatformOPL;
((DivPlatformOPL*)dispatch)->setOPLType(8950,true);
break; break;
case DIV_SYSTEM_OPZ: case DIV_SYSTEM_OPZ:
dispatch=new DivPlatformTX81Z; dispatch=new DivPlatformTX81Z;

View file

@ -1580,14 +1580,6 @@ void DivPlatformOPL::setOPLType(int type, bool drums) {
pretendYMU=false; pretendYMU=false;
downsample=false; downsample=false;
adpcmChan=-1; adpcmChan=-1;
// Vaild type value:
// 1 (YM3526)
// 2 (YM3812)
// 3 (YMF262)
// 4 (YMF278; Not implemented)
// 289 (YMF289; Not implemented)
// 759 (YMU759)
// 8950 (Y8950)
switch (type) { switch (type) {
case 1: case 2: case 8950: case 1: case 2: case 8950:
slotsNonDrums=slotsOPL2; slotsNonDrums=slotsOPL2;
@ -1603,7 +1595,7 @@ void DivPlatformOPL::setOPLType(int type, bool drums) {
adpcmChan=drums?11:9; adpcmChan=drums?11:9;
} }
break; break;
case 3: case 4: case 289: case 759: case 3: case 4: case 759:
slotsNonDrums=slotsOPL3; slotsNonDrums=slotsOPL3;
slotsDrums=slotsOPL3Drums; slotsDrums=slotsOPL3Drums;
slots=drums?slotsDrums:slotsNonDrums; slots=drums?slotsDrums:slotsNonDrums;
@ -1616,14 +1608,14 @@ void DivPlatformOPL::setOPLType(int type, bool drums) {
if (type==759) { if (type==759) {
pretendYMU=true; pretendYMU=true;
adpcmChan=16; adpcmChan=16;
} else if (type==4 || type==289) { } else if (type==4) {
chipFreqBase=32768*684; chipFreqBase=32768*684;
downsample=true; downsample=true;
} }
break; break;
} }
chipType=type; chipType=type;
if (type==759 || type==289 || type==4) { if (type==759 || type==4) {
oplType=3; oplType=3;
} else if (type==8950) { } else if (type==8950) {
oplType=1; oplType=1;
@ -1706,7 +1698,6 @@ void DivPlatformOPL::setFlags(unsigned int flags) {
chipRateBase=rate; chipRateBase=rate;
break; break;
case 4: case 4:
case 289:
switch (flags&0xff) { switch (flags&0xff) {
case 0x01: case 0x01:
chipClock=COLOR_PAL*32.0/5.0; chipClock=COLOR_PAL*32.0/5.0;

View file

@ -151,10 +151,6 @@ class DivPlatformOPL: public DivDispatch {
void renderSamples(); void renderSamples();
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
void quit(); void quit();
DivPlatformOPL(int type, bool drums):
DivDispatch() {
setOPLType(type,drums);
}
~DivPlatformOPL(); ~DivPlatformOPL();
}; };
#endif #endif