From d856580f90f5907b77b68a0eadcfdd385ab43660 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 14 Jun 2025 18:08:58 -0500 Subject: [PATCH] VGM export: fix OPNAB CSM issue #2557 --- src/engine/vgmOps.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/engine/vgmOps.cpp b/src/engine/vgmOps.cpp index 09b06bb25..3ed2a888b 100644 --- a/src/engine/vgmOps.cpp +++ b/src/engine/vgmOps.cpp @@ -188,6 +188,8 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write case DIV_SYSTEM_YM2610_EXT: case DIV_SYSTEM_YM2610_FULL_EXT: case DIV_SYSTEM_YM2610B_EXT: + case DIV_SYSTEM_YM2610_CSM: + case DIV_SYSTEM_YM2610B_CSM: // TODO: YM2610B channels 1 and 4 and ADPCM-B for (int i=0; i<2; i++) { // set SL and RR to highest w->writeC(8|baseAddr1); @@ -264,6 +266,7 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write break; case DIV_SYSTEM_YM2203: case DIV_SYSTEM_YM2203_EXT: + case DIV_SYSTEM_YM2203_CSM: for (int i=0; i<3; i++) { // set SL and RR to highest w->writeC(5|baseAddr1); w->writeC(0x80+i); @@ -977,6 +980,8 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write case DIV_SYSTEM_YM2610_EXT: case DIV_SYSTEM_YM2610_FULL_EXT: case DIV_SYSTEM_YM2610B_EXT: + case DIV_SYSTEM_YM2610_CSM: + case DIV_SYSTEM_YM2610B_CSM: switch (write.addr>>8) { case 0: // port 0 w->writeC(8|baseAddr1); @@ -992,12 +997,14 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write break; case DIV_SYSTEM_YM2203: case DIV_SYSTEM_YM2203_EXT: + case DIV_SYSTEM_YM2203_CSM: w->writeC(5|baseAddr1); w->writeC(write.addr&0xff); w->writeC(write.val); break; case DIV_SYSTEM_YM2608: case DIV_SYSTEM_YM2608_EXT: + case DIV_SYSTEM_YM2608_CSM: switch (write.addr>>8) { case 0: // port 0 w->writeC(6|baseAddr1); @@ -1516,6 +1523,8 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p case DIV_SYSTEM_YM2610_EXT: case DIV_SYSTEM_YM2610_FULL_EXT: case DIV_SYSTEM_YM2610B_EXT: + case DIV_SYSTEM_YM2610_CSM: + case DIV_SYSTEM_YM2610B_CSM: if (!hasOPNB) { hasOPNB=disCont[i].dispatch->chipClock; CHIP_VOL(8,1.0); @@ -1531,7 +1540,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p hasOPNB|=0x40000000; howManyChips++; } - if (((song.system[i]==DIV_SYSTEM_YM2610B) || (song.system[i]==DIV_SYSTEM_YM2610B_EXT)) && (!(hasOPNB&0x80000000))) { // YM2610B flag + if (((song.system[i]==DIV_SYSTEM_YM2610B) || (song.system[i]==DIV_SYSTEM_YM2610B_EXT) || (song.system[i]==DIV_SYSTEM_YM2610B_CSM)) && (!(hasOPNB&0x80000000))) { // YM2610B flag hasOPNB|=0x80000000; } break; @@ -1627,6 +1636,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p break; case DIV_SYSTEM_YM2203: case DIV_SYSTEM_YM2203_EXT: + case DIV_SYSTEM_YM2203_CSM: if (!hasOPN) { hasOPN=disCont[i].dispatch->chipClock; willExport[i]=true; @@ -1643,6 +1653,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p break; case DIV_SYSTEM_YM2608: case DIV_SYSTEM_YM2608_EXT: + case DIV_SYSTEM_YM2608_CSM: if (!hasOPNA) { hasOPNA=disCont[i].dispatch->chipClock; CHIP_VOL(7,1.0);