diff --git a/src/engine/platform/lynx.cpp b/src/engine/platform/lynx.cpp index 568a45cdcd..737392e807 100644 --- a/src/engine/platform/lynx.cpp +++ b/src/engine/platform/lynx.cpp @@ -236,6 +236,7 @@ void DivPlatformLynx::tick(bool sysTick) { } } chan[i].sampleFreq=off*parent->calcFreq(chan[i].sampleBaseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE); + if (dumpWrites) addWrite(0xffff0001+(i<<8),chan[i].sampleFreq); } else { if (chan[i].lfsr >= 0) { WRITE_LFSR(i, (chan[i].lfsr&0xff)); @@ -307,6 +308,7 @@ int DivPlatformLynx::dispatch(DivCommand c) { } else { chan[c.chan].samplePos=0; } + if (dumpWrites) addWrite(0xffff0000+(c.chan<<8),chan[c.chan].sample); } if (c.value!=DIV_NOTE_NULL) { chan[c.chan].baseFreq=NOTE_PERIODIC(c.value); @@ -331,6 +333,7 @@ int DivPlatformLynx::dispatch(DivCommand c) { chan[c.chan].macroInit(NULL); if (chan[c.chan].pcm) { chan[c.chan].pcm=false; + if (dumpWrites) addWrite(0xffff0002+(c.chan<<8),0); } break; case DIV_CMD_LYNX_LFSR_LOAD: diff --git a/src/engine/vgmOps.cpp b/src/engine/vgmOps.cpp index de2ca54557..1ec5125ed9 100644 --- a/src/engine/vgmOps.cpp +++ b/src/engine/vgmOps.cpp @@ -1358,6 +1358,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p bool writeNESSamples=false; bool writePCESamples=false; bool writeVOXSamples=false; + bool writeLynxSamples=false; DivDispatch* writeADPCM_OPNA[2]={NULL,NULL}; DivDispatch* writeADPCM_OPNB[2]={NULL,NULL}; DivDispatch* writeADPCM_Y8950[2]={NULL,NULL}; @@ -1687,8 +1688,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p if (!hasLynx) { hasLynx=disCont[i].dispatch->chipClock; willExport[i]=true; - // once again - writeDACSamples=true; + writeLynxSamples=true; } else if (!(hasLynx&0x40000000)) { isSecond[i]=true; willExport[i]=true; @@ -2234,6 +2234,17 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p } } + if (writeLynxSamples && !directStream) for (int i=0; iwriteC(0x67); + w->writeC(0x66); + w->writeC(8); + w->writeI(sample->length8); + for (unsigned int j=0; jlength8; j++) { + w->writeC(sample->data8[j]); + } + } + for (int i=0; i<2; i++) { // SegaPCM if (writeSegaPCM[i]!=NULL && writeSegaPCM[i]->getSampleMemUsage(0)>0) { @@ -2550,7 +2561,7 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p w->writeC(0x91); w->writeC(streamID); - w->writeC(0); + w->writeC(8); w->writeC(1); w->writeC(0);