VGM export: fix OPNAB CSM

issue #2557
This commit is contained in:
tildearrow 2025-06-14 18:08:58 -05:00
parent 4089fd6594
commit d856580f90

View file

@ -188,6 +188,8 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
case DIV_SYSTEM_YM2610_EXT: case DIV_SYSTEM_YM2610_EXT:
case DIV_SYSTEM_YM2610_FULL_EXT: case DIV_SYSTEM_YM2610_FULL_EXT:
case DIV_SYSTEM_YM2610B_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 // TODO: YM2610B channels 1 and 4 and ADPCM-B
for (int i=0; i<2; i++) { // set SL and RR to highest for (int i=0; i<2; i++) { // set SL and RR to highest
w->writeC(8|baseAddr1); w->writeC(8|baseAddr1);
@ -264,6 +266,7 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
break; break;
case DIV_SYSTEM_YM2203: case DIV_SYSTEM_YM2203:
case DIV_SYSTEM_YM2203_EXT: case DIV_SYSTEM_YM2203_EXT:
case DIV_SYSTEM_YM2203_CSM:
for (int i=0; i<3; i++) { // set SL and RR to highest for (int i=0; i<3; i++) { // set SL and RR to highest
w->writeC(5|baseAddr1); w->writeC(5|baseAddr1);
w->writeC(0x80+i); 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_EXT:
case DIV_SYSTEM_YM2610_FULL_EXT: case DIV_SYSTEM_YM2610_FULL_EXT:
case DIV_SYSTEM_YM2610B_EXT: case DIV_SYSTEM_YM2610B_EXT:
case DIV_SYSTEM_YM2610_CSM:
case DIV_SYSTEM_YM2610B_CSM:
switch (write.addr>>8) { switch (write.addr>>8) {
case 0: // port 0 case 0: // port 0
w->writeC(8|baseAddr1); w->writeC(8|baseAddr1);
@ -992,12 +997,14 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
break; break;
case DIV_SYSTEM_YM2203: case DIV_SYSTEM_YM2203:
case DIV_SYSTEM_YM2203_EXT: case DIV_SYSTEM_YM2203_EXT:
case DIV_SYSTEM_YM2203_CSM:
w->writeC(5|baseAddr1); w->writeC(5|baseAddr1);
w->writeC(write.addr&0xff); w->writeC(write.addr&0xff);
w->writeC(write.val); w->writeC(write.val);
break; break;
case DIV_SYSTEM_YM2608: case DIV_SYSTEM_YM2608:
case DIV_SYSTEM_YM2608_EXT: case DIV_SYSTEM_YM2608_EXT:
case DIV_SYSTEM_YM2608_CSM:
switch (write.addr>>8) { switch (write.addr>>8) {
case 0: // port 0 case 0: // port 0
w->writeC(6|baseAddr1); 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_EXT:
case DIV_SYSTEM_YM2610_FULL_EXT: case DIV_SYSTEM_YM2610_FULL_EXT:
case DIV_SYSTEM_YM2610B_EXT: case DIV_SYSTEM_YM2610B_EXT:
case DIV_SYSTEM_YM2610_CSM:
case DIV_SYSTEM_YM2610B_CSM:
if (!hasOPNB) { if (!hasOPNB) {
hasOPNB=disCont[i].dispatch->chipClock; hasOPNB=disCont[i].dispatch->chipClock;
CHIP_VOL(8,1.0); CHIP_VOL(8,1.0);
@ -1531,7 +1540,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
hasOPNB|=0x40000000; hasOPNB|=0x40000000;
howManyChips++; 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; hasOPNB|=0x80000000;
} }
break; break;
@ -1627,6 +1636,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
break; break;
case DIV_SYSTEM_YM2203: case DIV_SYSTEM_YM2203:
case DIV_SYSTEM_YM2203_EXT: case DIV_SYSTEM_YM2203_EXT:
case DIV_SYSTEM_YM2203_CSM:
if (!hasOPN) { if (!hasOPN) {
hasOPN=disCont[i].dispatch->chipClock; hasOPN=disCont[i].dispatch->chipClock;
willExport[i]=true; willExport[i]=true;
@ -1643,6 +1653,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
break; break;
case DIV_SYSTEM_YM2608: case DIV_SYSTEM_YM2608:
case DIV_SYSTEM_YM2608_EXT: case DIV_SYSTEM_YM2608_EXT:
case DIV_SYSTEM_YM2608_CSM:
if (!hasOPNA) { if (!hasOPNA) {
hasOPNA=disCont[i].dispatch->chipClock; hasOPNA=disCont[i].dispatch->chipClock;
CHIP_VOL(7,1.0); CHIP_VOL(7,1.0);