diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index 7ae9da6a2..f822a6067 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -198,6 +198,7 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do case DIV_SYSTEM_OPLL_DRUMS: case DIV_SYSTEM_VRC7: dispatch=new DivPlatformOPLL; + ((DivPlatformOPLL*)dispatch)->setVRC7(sys==DIV_SYSTEM_VRC7); break; case DIV_SYSTEM_SAA1099: { int saaCore=eng->getConfInt("saaCore",0); diff --git a/src/engine/platform/opll.cpp b/src/engine/platform/opll.cpp index a9f98b535..7b15f7acd 100644 --- a/src/engine/platform/opll.cpp +++ b/src/engine/platform/opll.cpp @@ -610,6 +610,10 @@ void DivPlatformOPLL::toggleRegisterDump(bool enable) { DivDispatch::toggleRegisterDump(enable); } +void DivPlatformOPLL::setVRC7(bool vrc) { + vrc7=vrc; +} + void* DivPlatformOPLL::getChanState(int ch) { return &chan[ch]; } @@ -625,7 +629,11 @@ int DivPlatformOPLL::getRegisterPoolSize() { void DivPlatformOPLL::reset() { while (!writes.empty()) writes.pop(); memset(regPool,0,256); - OPLL_Reset(&fm,opll_type_ym2413); + if (vrc7) { + OPLL_Reset(&fm,opll_type_ds1001); + } else { + OPLL_Reset(&fm,opll_type_ym2413); + } if (dumpWrites) { addWrite(0xffffffff,0); } diff --git a/src/engine/platform/opll.h b/src/engine/platform/opll.h index 415cda8a4..cf2ba788c 100644 --- a/src/engine/platform/opll.h +++ b/src/engine/platform/opll.h @@ -76,6 +76,7 @@ class DivPlatformOPLL: public DivDispatch { bool useYMFM; bool drums; + bool vrc7; short oldWrites[256]; short pendingWrites[256]; @@ -102,6 +103,7 @@ class DivPlatformOPLL: public DivDispatch { bool keyOffAffectsArp(int ch); bool keyOffAffectsPorta(int ch); void toggleRegisterDump(bool enable); + void setVRC7(bool vrc); void setFlags(unsigned int flags); void notifyInsChange(int ins); void notifyInsDeletion(void* ins);