support ymfm (NO LLE SUPPORT, WHO NEEDS EMULATION THAT ACCURATE)

This commit is contained in:
host12prog 2025-07-10 18:06:05 +07:00
parent 8dd9ede0d0
commit ccfb3d3407
2 changed files with 21 additions and 3 deletions

View file

@ -458,6 +458,7 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
((DivPlatformYM2203Ext*)dispatch)->setCombo(eng->getConfInt("opn1Core", 1)); ((DivPlatformYM2203Ext*)dispatch)->setCombo(eng->getConfInt("opn1Core", 1));
} }
((DivPlatformYM2203Ext*)dispatch)->setCSM(1); ((DivPlatformYM2203Ext*)dispatch)->setCSM(1);
((DivPlatformYM2203Ext*)dispatch)->setExtSSG(1);
break; break;
case DIV_SYSTEM_YM2608: case DIV_SYSTEM_YM2608:
dispatch=new DivPlatformYM2608; dispatch=new DivPlatformYM2608;

View file

@ -268,6 +268,7 @@ void DivPlatformYM2203::acquire_combo(short** buf, size_t len) {
void DivPlatformYM2203::acquire_ymfm(short** buf, size_t len) { void DivPlatformYM2203::acquire_ymfm(short** buf, size_t len) {
thread_local int os; thread_local int os;
thread_local int os1, os2;
ymfm::ym2203::fm_engine* fme=fm->debug_fm_engine(); ymfm::ym2203::fm_engine* fme=fm->debug_fm_engine();
@ -310,12 +311,27 @@ void DivPlatformYM2203::acquire_ymfm(short** buf, size_t len) {
fm->generate(&fmout); fm->generate(&fmout);
iface.clock(24); iface.clock(24);
os=((fmout.data[0]*fmVol)>>8)+(((fmout.data[1]+fmout.data[2]+fmout.data[3])*ssgVol)>>8); os=((fmout.data[0]*fmVol)>>8);
if (os<-32768) os=-32768; if (os<-32768) os=-32768;
if (os>32767) os=32767; if (os>32767) os=32767;
buf[0][h]=os;
if (stereo) {
// so ugly
os1=((fmout.data[1]+((fmout.data[2]*centerVol+fmout.data[3]*sideVol)>>8))*ssgVol)>>8;
os2=((((fmout.data[1]*sideVol+fmout.data[2]*centerVol)>>8)+fmout.data[3])*ssgVol)>>8;
if (os1<-32768) os1=-32768;
if (os1>32767) os1=32767;
if (os2<-32768) os2=-32768;
if (os2>32767) os2=32767;
buf[0][h]=os+os1;
buf[1][h]=os+os2;
} else {
os+=((fmout.data[1]+fmout.data[2]+fmout.data[3])*ssgVol)>>8;
if (os<-32768) os=-32768;
if (os>32767) os=32767;
buf[0][h]=os;
if (extendedSSG) buf[1][h]=os;
}
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
int out=(fmChan[i]->debug_output(0)+fmChan[i]->debug_output(1))<<1; int out=(fmChan[i]->debug_output(0)+fmChan[i]->debug_output(1))<<1;
@ -493,6 +509,7 @@ void DivPlatformYM2203::acquire_lle(short** buf, size_t len) {
if (outL>32767) outL=32767; if (outL>32767) outL=32767;
buf[0][h]=outL; buf[0][h]=outL;
if (extendedSSG) buf[1][h]=outL;
} }
for (int i=0; i<7; i++) { for (int i=0; i<7; i++) {