From 0be58356450832496d5bc8660afe9f52724b7d4d Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 6 Mar 2024 03:42:21 -0500 Subject: [PATCH] memory composition, part 5 almost there --- src/engine/platform/k007232.cpp | 7 +++++++ src/engine/platform/k053260.cpp | 8 ++++++++ src/engine/platform/msm6295.cpp | 10 ++++++++++ src/engine/platform/nes.cpp | 9 ++++++++- src/engine/platform/opl.cpp | 7 +++++++ src/engine/platform/qsound.cpp | 8 ++++++++ src/engine/platform/rf5c68.cpp | 7 +++++++ src/engine/platform/segapcm.cpp | 7 +++++++ src/engine/platform/su.cpp | 11 +++++++++++ src/engine/platform/x1_010.cpp | 7 +++++++ src/engine/platform/ym2608.cpp | 7 +++++++ src/engine/platform/ym2610shared.h | 14 ++++++++++++++ src/engine/platform/ymz280b.cpp | 7 +++++++ 13 files changed, 108 insertions(+), 1 deletion(-) diff --git a/src/engine/platform/k007232.cpp b/src/engine/platform/k007232.cpp index 2eb357195..5bd3dc47c 100644 --- a/src/engine/platform/k007232.cpp +++ b/src/engine/platform/k007232.cpp @@ -538,6 +538,9 @@ void DivPlatformK007232::renderSamples(int sysID) { memset(sampleOffK007232,0,256*sizeof(unsigned int)); memset(sampleLoaded,0,256*sizeof(bool)); + memCompo=DivMemoryComposition(); + memCompo.name="Sample ROM"; + size_t memPos=0; for (int i=0; isong.sampleLen; i++) { DivSample* s=parent->song.sample[i]; @@ -556,6 +559,7 @@ void DivPlatformK007232::renderSamples(int sysID) { memPos=(memPos+0x1ffff)&0xfe0000; } sampleOffK007232[i]=memPos; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength+1)); for (int j=0; jdata8[j])^0x80; @@ -573,6 +577,9 @@ void DivPlatformK007232::renderSamples(int sysID) { } } sampleMemLen=memPos; + + memCompo.used=sampleMemLen; + memCompo.capacity=16777216; } int DivPlatformK007232::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { diff --git a/src/engine/platform/k053260.cpp b/src/engine/platform/k053260.cpp index 180a531f5..58ae1003e 100644 --- a/src/engine/platform/k053260.cpp +++ b/src/engine/platform/k053260.cpp @@ -476,6 +476,9 @@ void DivPlatformK053260::renderSamples(int sysID) { memset(sampleOffK053260,0,256*sizeof(unsigned int)); memset(sampleLoaded,0,256*sizeof(bool)); + memCompo=DivMemoryComposition(); + memCompo.name="Sample ROM"; + size_t memPos=1; // for avoid silence for (int i=0; isong.sampleLen; i++) { DivSample* s=parent->song.sample[i]; @@ -491,6 +494,7 @@ void DivPlatformK053260::renderSamples(int sysID) { actualLength=MIN((int)(getSampleMemCapacity()-memPos-1),length); if (actualLength>0) { sampleOffK053260[i]=memPos-1; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength+1)); for (int j=0; jdataK[j]; } @@ -501,6 +505,7 @@ void DivPlatformK053260::renderSamples(int sysID) { actualLength=MIN((int)(getSampleMemCapacity()-memPos-1),length); if (actualLength>0) { sampleOffK053260[i]=memPos-1; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength+1)); for (int j=0; jdata8[j]; } @@ -514,6 +519,9 @@ void DivPlatformK053260::renderSamples(int sysID) { sampleLoaded[i]=true; } sampleMemLen=memPos; + + memCompo.capacity=2097152; + memCompo.used=sampleMemLen; } int DivPlatformK053260::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { diff --git a/src/engine/platform/msm6295.cpp b/src/engine/platform/msm6295.cpp index a19e37914..916234f0e 100644 --- a/src/engine/platform/msm6295.cpp +++ b/src/engine/platform/msm6295.cpp @@ -386,6 +386,11 @@ void DivPlatformMSM6295::renderSamples(int sysID) { bankedPhrase[i].phrase=0; } + memCompo=DivMemoryComposition(); + memCompo.name="Sample ROM"; + + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_RESERVED,"Phrase Book",-1,0,128*8)); + // sample data size_t memPos=128*8; if (isBanked) { @@ -424,6 +429,7 @@ void DivPlatformMSM6295::renderSamples(int sysID) { bankedPhrase[i].bank=bankInd; bankedPhrase[i].phrase=phraseInd; bankedPhrase[i].length=paddedLen; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+paddedLen)); memPos+=paddedLen; phraseInd++; } @@ -465,6 +471,7 @@ void DivPlatformMSM6295::renderSamples(int sysID) { sampleLoaded[i]=true; } sampleOffVOX[i]=memPos; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+paddedLen)); memPos+=paddedLen; } adpcmMemLen=memPos+256; @@ -481,6 +488,9 @@ void DivPlatformMSM6295::renderSamples(int sysID) { adpcmMem[5+i*8]=(endPos)&0xff; } } + + memCompo.capacity=getSampleMemCapacity(0); + memCompo.used=adpcmMemLen; } void DivPlatformMSM6295::setFlags(const DivConfig& flags) { diff --git a/src/engine/platform/nes.cpp b/src/engine/platform/nes.cpp index 8a6b55bcd..c5993c624 100644 --- a/src/engine/platform/nes.cpp +++ b/src/engine/platform/nes.cpp @@ -845,9 +845,12 @@ const DivMemoryComposition* DivPlatformNES::getMemCompo(int index) { } void DivPlatformNES::renderSamples(int sysID) { - memset(dpcmMem,0,getSampleMemCapacity(0));\ + memset(dpcmMem,0,getSampleMemCapacity(0)); memset(sampleLoaded,0,256*sizeof(bool)); + memCompo=DivMemoryComposition(); + memCompo.name="DPCM"; + size_t memPos=0; for (int i=0; isong.sampleLen; i++) { DivSample* s=parent->song.sample[i]; @@ -876,9 +879,13 @@ void DivPlatformNES::renderSamples(int sysID) { sampleLoaded[i]=true; } sampleOffDPCM[i]=memPos; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+paddedLen)); memPos+=paddedLen; } dpcmMemLen=memPos; + + memCompo.capacity=262144; + memCompo.used=dpcmMemLen; } int DivPlatformNES::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index 18d5525e5..e01d4d264 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -2551,6 +2551,9 @@ void DivPlatformOPL::renderSamples(int sysID) { memset(sampleOffB,0,256*sizeof(unsigned int)); memset(sampleLoaded,0,256*sizeof(bool)); + memCompo=DivMemoryComposition(); + memCompo.name="Sample Memory"; + size_t memPos=0; for (int i=0; isong.sampleLen; i++) { DivSample* s=parent->song.sample[i]; @@ -2575,9 +2578,13 @@ void DivPlatformOPL::renderSamples(int sysID) { sampleLoaded[i]=true; } sampleOffB[i]=memPos; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+paddedLen)); memPos+=paddedLen; } adpcmBMemLen=memPos+256; + + memCompo.used=adpcmBMemLen; + memCompo.capacity=getSampleMemCapacity(0); } int DivPlatformOPL::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { diff --git a/src/engine/platform/qsound.cpp b/src/engine/platform/qsound.cpp index f0a3a1712..cdd8fc6b2 100644 --- a/src/engine/platform/qsound.cpp +++ b/src/engine/platform/qsound.cpp @@ -745,6 +745,9 @@ void DivPlatformQSound::renderSamples(int sysID) { memset(sampleLoaded,0,256*sizeof(bool)); memset(sampleLoadedBS,0,256*sizeof(bool)); + memCompo=DivMemoryComposition(); + memCompo.name="Sample ROM"; + size_t memPos=0; for (int i=0; isong.sampleLen; i++) { DivSample* s=parent->song.sample[i]; @@ -776,6 +779,7 @@ void DivPlatformQSound::renderSamples(int sysID) { sampleLoaded[i]=true; } offPCM[i]=memPos^0x8000; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"PCM",i,memPos,memPos+length)); memPos+=length+16; } sampleMemLen=memPos+256; @@ -813,9 +817,13 @@ void DivPlatformQSound::renderSamples(int sysID) { sampleLoadedBS[i]=true; } offBS[i]=memPos; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE_ALT1,"ADPCM",i,memPos,memPos+length)); memPos+=length+16; } sampleMemLenBS=memPos+256; + + memCompo.used=sampleMemLenBS; + memCompo.capacity=getSampleMemCapacity(0); } int DivPlatformQSound::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { diff --git a/src/engine/platform/rf5c68.cpp b/src/engine/platform/rf5c68.cpp index 5bb70f026..e8887f156 100644 --- a/src/engine/platform/rf5c68.cpp +++ b/src/engine/platform/rf5c68.cpp @@ -425,6 +425,9 @@ void DivPlatformRF5C68::renderSamples(int sysID) { memset(sampleOffRFC,0,256*sizeof(unsigned int)); memset(sampleLoaded,0,256*sizeof(bool)); + memCompo=DivMemoryComposition(); + memCompo.name="Sample Memory"; + size_t memPos=0; for (int i=0; isong.sampleLen; i++) { DivSample* s=parent->song.sample[i]; @@ -437,6 +440,7 @@ void DivPlatformRF5C68::renderSamples(int sysID) { int actualLength=MIN((int)(getSampleMemCapacity()-memPos)-32,length); if (actualLength>0) { sampleOffRFC[i]=memPos; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength+32)); for (int j=0; jdata8[j]; @@ -456,6 +460,9 @@ void DivPlatformRF5C68::renderSamples(int sysID) { sampleLoaded[i]=true; } sampleMemLen=memPos; + + memCompo.used=sampleMemLen; + memCompo.capacity=getSampleMemCapacity(0); } int DivPlatformRF5C68::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { diff --git a/src/engine/platform/segapcm.cpp b/src/engine/platform/segapcm.cpp index 439bfd154..3f8598c43 100644 --- a/src/engine/platform/segapcm.cpp +++ b/src/engine/platform/segapcm.cpp @@ -491,6 +491,9 @@ void DivPlatformSegaPCM::renderSamples(int sysID) { memset(sampleLoaded,0,256*sizeof(bool)); memset(sampleOffSegaPCM,0,256*sizeof(unsigned int)); memset(sampleEndSegaPCM,0,256); + + memCompo=DivMemoryComposition(); + memCompo.name="Sample ROM"; for (int i=0; isong.sampleLen; i++) { DivSample* sample=parent->getSample(i); @@ -506,6 +509,7 @@ void DivPlatformSegaPCM::renderSamples(int sysID) { sampleLoaded[i]=true; if (memPos>=2097152) break; sampleOffSegaPCM[i]=memPos; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+alignedSize)); for (unsigned int j=0; j=sample->samples) { sampleMem[memPos++]=0; @@ -519,6 +523,9 @@ void DivPlatformSegaPCM::renderSamples(int sysID) { if (memPos>=2097152) break; } sampleMemLen=memPos; + + memCompo.used=sampleMemLen; + memCompo.capacity=getSampleMemCapacity(0); } void DivPlatformSegaPCM::setFlags(const DivConfig& flags) { diff --git a/src/engine/platform/su.cpp b/src/engine/platform/su.cpp index 83e268cfc..9425f8787 100644 --- a/src/engine/platform/su.cpp +++ b/src/engine/platform/su.cpp @@ -667,6 +667,9 @@ void DivPlatformSoundUnit::renderSamples(int sysID) { memset(sampleOffSU,0,256*sizeof(unsigned int)); memset(sampleLoaded,0,256*sizeof(bool)); + memCompo=DivMemoryComposition(); + memCompo.name="Sample RAM"; + size_t memPos=0; for (int i=0; isong.sampleLen; i++) { DivSample* s=parent->song.sample[i]; @@ -689,12 +692,20 @@ void DivPlatformSoundUnit::renderSamples(int sysID) { sampleLoaded[i]=true; } sampleOffSU[i]=memPos; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+paddedLen)); memPos+=paddedLen; } sampleMemLen=memPos; sysIDCache=sysID; memcpy(su->pcm,sampleMem,sampleMemSize?65536:8192); + + memCompo.used=sampleMemLen; + memCompo.capacity=sampleMemSize?65536:8192; + + if (initIlSize&64) { + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_ECHO,"Echo Buffer",-1,memCompo.capacity-((1+(initIlSize&63))<<7),memCompo.capacity)); + } } int DivPlatformSoundUnit::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { diff --git a/src/engine/platform/x1_010.cpp b/src/engine/platform/x1_010.cpp index 24ae09119..104203420 100644 --- a/src/engine/platform/x1_010.cpp +++ b/src/engine/platform/x1_010.cpp @@ -1005,6 +1005,9 @@ void DivPlatformX1_010::renderSamples(int sysID) { memset(sampleOffX1,0,256*sizeof(unsigned int)); memset(sampleLoaded,0,256*sizeof(bool)); + memCompo=DivMemoryComposition(); + memCompo.name="Sample ROM"; + size_t memPos=0; for (int i=0; isong.sampleLen; i++) { DivSample* s=parent->song.sample[i]; @@ -1035,9 +1038,13 @@ void DivPlatformX1_010::renderSamples(int sysID) { sampleLoaded[i]=true; } sampleOffX1[i]=memPos; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+paddedLen)); memPos+=paddedLen; } sampleMemLen=memPos+256; + + memCompo.used=sampleMemLen; + memCompo.capacity=getSampleMemCapacity(0); } int DivPlatformX1_010::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { diff --git a/src/engine/platform/ym2608.cpp b/src/engine/platform/ym2608.cpp index 36f8c36d2..378ce4a43 100644 --- a/src/engine/platform/ym2608.cpp +++ b/src/engine/platform/ym2608.cpp @@ -1615,6 +1615,9 @@ void DivPlatformYM2608::renderSamples(int sysID) { memset(sampleOffB,0,256*sizeof(unsigned int)); memset(sampleLoaded,0,256*sizeof(bool)); + memCompo=DivMemoryComposition(); + memCompo.name="ADPCM"; + size_t memPos=0; for (int i=0; isong.sampleLen; i++) { DivSample* s=parent->song.sample[i]; @@ -1639,9 +1642,13 @@ void DivPlatformYM2608::renderSamples(int sysID) { sampleLoaded[i]=true; } sampleOffB[i]=memPos; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+paddedLen)); memPos+=paddedLen; } adpcmBMemLen=memPos+256; + + memCompo.used=adpcmBMemLen; + memCompo.capacity=getSampleMemCapacity(0); } void DivPlatformYM2608::setFlags(const DivConfig& flags) { diff --git a/src/engine/platform/ym2610shared.h b/src/engine/platform/ym2610shared.h index 9a1d05ca7..63dd3ecc6 100644 --- a/src/engine/platform/ym2610shared.h +++ b/src/engine/platform/ym2610shared.h @@ -160,6 +160,12 @@ class DivPlatformYM2610Base: public DivPlatformOPN { memset(sampleOffB,0,256*sizeof(unsigned int)); memset(sampleLoaded,0,256*2*sizeof(bool)); + memCompoA=DivMemoryComposition(); + memCompoA.name="ADPCM-A"; + + memCompoB=DivMemoryComposition(); + memCompoB.name="ADPCM-B"; + size_t memPos=0; for (int i=0; isong.sampleLen; i++) { DivSample* s=parent->song.sample[i]; @@ -184,10 +190,14 @@ class DivPlatformYM2610Base: public DivPlatformOPN { sampleLoaded[0][i]=true; } sampleOffA[i]=memPos; + memCompoA.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+paddedLen)); memPos+=paddedLen; } adpcmAMemLen=memPos+256; + memCompoA.used=adpcmAMemLen; + memCompoA.capacity=getSampleMemCapacity(0); + memset(adpcmBMem,0,getSampleMemCapacity(1)); memPos=0; @@ -214,9 +224,13 @@ class DivPlatformYM2610Base: public DivPlatformOPN { sampleLoaded[1][i]=true; } sampleOffB[i]=memPos; + memCompoB.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+paddedLen)); memPos+=paddedLen; } adpcmBMemLen=memPos+256; + + memCompoB.used=adpcmBMemLen; + memCompoB.capacity=getSampleMemCapacity(1); } void setFlags(const DivConfig& flags) { diff --git a/src/engine/platform/ymz280b.cpp b/src/engine/platform/ymz280b.cpp index ea7aec15a..b95e8a9d3 100644 --- a/src/engine/platform/ymz280b.cpp +++ b/src/engine/platform/ymz280b.cpp @@ -452,6 +452,9 @@ void DivPlatformYMZ280B::renderSamples(int sysID) { memset(sampleOff,0,256*sizeof(unsigned int)); memset(sampleLoaded,0,256*sizeof(bool)); + memCompo=DivMemoryComposition(); + memCompo.name="Sample ROM"; + size_t memPos=0; for (int i=0; isong.sampleLen; i++) { DivSample* s=parent->song.sample[i]; @@ -476,6 +479,7 @@ void DivPlatformYMZ280B::renderSamples(int sysID) { } #endif sampleOff[i]=memPos; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+length)); memPos+=length; } if (actualLength