diff --git a/src/engine/platform/amiga.cpp b/src/engine/platform/amiga.cpp index 9555019bd..905fcd787 100644 --- a/src/engine/platform/amiga.cpp +++ b/src/engine/platform/amiga.cpp @@ -922,11 +922,22 @@ bool DivPlatformAmiga::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformAmiga::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformAmiga::renderSamples(int sysID) { memset(sampleMem,0,2097152); memset(sampleOff,0,256*sizeof(unsigned int)); memset(sampleLoaded,0,256*sizeof(bool)); + memCompo=DivMemoryComposition(); + memCompo.name="Chip Memory"; + + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_WAVE_RAM,"Wave RAM",-1,0,1024)); + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_RESERVED,"End of Sample",-1,1024,1026)); + // first 1024 bytes reserved for wavetable // the next 2 bytes are reserved for end of sample size_t memPos=1026; @@ -947,6 +958,7 @@ void DivPlatformAmiga::renderSamples(int sysID) { if (actualLength>0) { sampleOff[i]=memPos; memcpy(&sampleMem[memPos],s->data8,actualLength); + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength)); memPos+=actualLength; } // align memPos to short @@ -954,6 +966,9 @@ void DivPlatformAmiga::renderSamples(int sysID) { sampleLoaded[i]=true; } sampleMemLen=memPos; + + memCompo.capacity=1<song.sampleLen; i++) { DivSample* s=parent->song.sample[i]; @@ -658,6 +666,7 @@ void DivPlatformC140::renderSamples(int sysID) { } sampleOff[i]=memPos>>1; sampleLoaded[i]=true; + memCompo.entries.push_back(DivMemoryEntry((DivMemoryEntryType)(DIV_MEMORY_BANK0+((memPos>>17)&3)),"Sample",i,memPos,memPos+length)); memPos+=length; } else { // C140 (16-bit) unsigned int length=s->length16+4; @@ -704,10 +713,14 @@ void DivPlatformC140::renderSamples(int sysID) { } sampleOff[i]=memPos>>1; sampleLoaded[i]=true; + memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+length)); memPos+=length; } } sampleMemLen=memPos+256; + + memCompo.used=sampleMemLen; + memCompo.capacity=getSampleMemCapacity(0); } void DivPlatformC140::set219(bool is_219) { diff --git a/src/engine/platform/c140.h b/src/engine/platform/c140.h index ecd8bc239..fb385c5eb 100644 --- a/src/engine/platform/c140.h +++ b/src/engine/platform/c140.h @@ -74,6 +74,7 @@ class DivPlatformC140: public DivDispatch { FixedQueue writes; struct c140_t c140; struct c219_t c219; + DivMemoryComposition memCompo; unsigned char regPool[512]; char bankLabel[4][4]; friend void putDispatchChip(void*,int); @@ -108,6 +109,7 @@ class DivPlatformC140: public DivDispatch { size_t getSampleMemCapacity(int index = 0); size_t getSampleMemUsage(int index = 0); bool isSampleLoaded(int index, int sample); + const DivMemoryComposition* getMemCompo(int index); void renderSamples(int chipID); int getClockRangeMin(); int getClockRangeMax(); diff --git a/src/engine/platform/es5506.cpp b/src/engine/platform/es5506.cpp index 5a7c01c08..7b3b04d21 100644 --- a/src/engine/platform/es5506.cpp +++ b/src/engine/platform/es5506.cpp @@ -1203,6 +1203,11 @@ bool DivPlatformES5506::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformES5506::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformES5506::renderSamples(int sysID) { memset(sampleMem,0,getSampleMemCapacity()); memset(sampleOffES5506,0,256*sizeof(unsigned int)); diff --git a/src/engine/platform/es5506.h b/src/engine/platform/es5506.h index b51ee9f2c..04ed8beae 100644 --- a/src/engine/platform/es5506.h +++ b/src/engine/platform/es5506.h @@ -278,6 +278,7 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf { unsigned char initChanMax, chanMax; es5506_core es5506; + DivMemoryComposition memCompo; unsigned char regPool[4*16*128]; // 7 bit page x 16 registers per page x 32 bit per registers friend void putDispatchChip(void*,int); @@ -315,6 +316,7 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf { virtual size_t getSampleMemCapacity(int index = 0) override; virtual size_t getSampleMemUsage(int index = 0) override; virtual bool isSampleLoaded(int index, int sample) override; + virtual const DivMemoryComposition* getMemCompo(int index) override; virtual void renderSamples(int sysID) override; virtual const char** getRegisterSheet() override; virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override; diff --git a/src/engine/platform/ga20.cpp b/src/engine/platform/ga20.cpp index 2098f140b..ae03d9e5b 100644 --- a/src/engine/platform/ga20.cpp +++ b/src/engine/platform/ga20.cpp @@ -441,6 +441,11 @@ bool DivPlatformGA20::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformGA20::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformGA20::renderSamples(int sysID) { memset(sampleMem,0x00,getSampleMemCapacity()); memset(sampleOffGA20,0,256*sizeof(unsigned int)); diff --git a/src/engine/platform/ga20.h b/src/engine/platform/ga20.h index 995a7cc15..51617849f 100644 --- a/src/engine/platform/ga20.h +++ b/src/engine/platform/ga20.h @@ -66,6 +66,7 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf { unsigned char* sampleMem; size_t sampleMemLen; iremga20_device ga20; + DivMemoryComposition memCompo; unsigned char regPool[32]; friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); @@ -97,6 +98,7 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf { virtual size_t getSampleMemCapacity(int index = 0) override; virtual size_t getSampleMemUsage(int index = 0) override; virtual bool isSampleLoaded(int index, int sample) override; + virtual const DivMemoryComposition* getMemCompo(int index) override; virtual void renderSamples(int chipID) override; virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override; virtual void quit() override; diff --git a/src/engine/platform/k007232.cpp b/src/engine/platform/k007232.cpp index 3f3ebc6d9..2eb357195 100644 --- a/src/engine/platform/k007232.cpp +++ b/src/engine/platform/k007232.cpp @@ -528,6 +528,11 @@ bool DivPlatformK007232::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformK007232::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformK007232::renderSamples(int sysID) { memset(sampleMem,0xc0,getSampleMemCapacity()); memset(sampleOffK007232,0,256*sizeof(unsigned int)); diff --git a/src/engine/platform/k007232.h b/src/engine/platform/k007232.h index 379d41106..1bc54fb48 100644 --- a/src/engine/platform/k007232.h +++ b/src/engine/platform/k007232.h @@ -74,6 +74,7 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf { unsigned char* sampleMem; size_t sampleMemLen; k007232_core k007232; + DivMemoryComposition memCompo; unsigned char regPool[20]; friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); @@ -105,6 +106,7 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf { size_t getSampleMemCapacity(int index = 0); size_t getSampleMemUsage(int index = 0); bool isSampleLoaded(int index, int sample); + const DivMemoryComposition* getMemCompo(int index); void renderSamples(int chipID); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); void quit(); diff --git a/src/engine/platform/k053260.cpp b/src/engine/platform/k053260.cpp index 68704c9ee..180a531f5 100644 --- a/src/engine/platform/k053260.cpp +++ b/src/engine/platform/k053260.cpp @@ -466,6 +466,11 @@ bool DivPlatformK053260::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformK053260::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformK053260::renderSamples(int sysID) { memset(sampleMem,0,getSampleMemCapacity()); memset(sampleOffK053260,0,256*sizeof(unsigned int)); diff --git a/src/engine/platform/k053260.h b/src/engine/platform/k053260.h index 4f1afea2d..8001d7eeb 100644 --- a/src/engine/platform/k053260.h +++ b/src/engine/platform/k053260.h @@ -52,6 +52,7 @@ class DivPlatformK053260: public DivDispatch, public k053260_intf { unsigned char* sampleMem; size_t sampleMemLen; k053260_core k053260; + DivMemoryComposition memCompo; unsigned char regPool[64]; void updatePanning(unsigned char mask); @@ -84,6 +85,7 @@ class DivPlatformK053260: public DivDispatch, public k053260_intf { virtual size_t getSampleMemCapacity(int index = 0) override; virtual size_t getSampleMemUsage(int index = 0) override; virtual bool isSampleLoaded(int index, int sample) override; + virtual const DivMemoryComposition* getMemCompo(int index) override; virtual void renderSamples(int chipID) override; virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override; virtual void quit() override; diff --git a/src/engine/platform/msm6295.cpp b/src/engine/platform/msm6295.cpp index a8c30b3e1..a19e37914 100644 --- a/src/engine/platform/msm6295.cpp +++ b/src/engine/platform/msm6295.cpp @@ -370,6 +370,11 @@ bool DivPlatformMSM6295::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformMSM6295::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformMSM6295::renderSamples(int sysID) { unsigned int sampleOffVOX[256]; diff --git a/src/engine/platform/msm6295.h b/src/engine/platform/msm6295.h index 51e052a81..5664adb7d 100644 --- a/src/engine/platform/msm6295.h +++ b/src/engine/platform/msm6295.h @@ -69,6 +69,8 @@ class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf { phrase(0), length(0) {} } bankedPhrase[256]; + + DivMemoryComposition memCompo; friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); @@ -99,6 +101,7 @@ class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf { virtual size_t getSampleMemCapacity(int index) override; virtual size_t getSampleMemUsage(int index) override; virtual bool isSampleLoaded(int index, int sample) override; + virtual const DivMemoryComposition* getMemCompo(int index) override; virtual void renderSamples(int chipID) override; virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override; diff --git a/src/engine/platform/nes.cpp b/src/engine/platform/nes.cpp index 526944a3d..8a6b55bcd 100644 --- a/src/engine/platform/nes.cpp +++ b/src/engine/platform/nes.cpp @@ -839,6 +839,11 @@ bool DivPlatformNES::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformNES::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformNES::renderSamples(int sysID) { memset(dpcmMem,0,getSampleMemCapacity(0));\ memset(sampleLoaded,0,256*sizeof(bool)); diff --git a/src/engine/platform/nes.h b/src/engine/platform/nes.h index 43377fee2..a2c1ed8ab 100644 --- a/src/engine/platform/nes.h +++ b/src/engine/platform/nes.h @@ -67,6 +67,7 @@ class DivPlatformNES: public DivDispatch { xgm::NES_DMC* nes2_NP; unsigned char regPool[128]; unsigned int sampleOffDPCM[256]; + DivMemoryComposition memCompo; friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); @@ -101,6 +102,7 @@ class DivPlatformNES: public DivDispatch { size_t getSampleMemCapacity(int index); size_t getSampleMemUsage(int index); bool isSampleLoaded(int index, int sample); + const DivMemoryComposition* getMemCompo(int index); void renderSamples(int chipID); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); void quit(); diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index d62161827..18d5525e5 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -2539,6 +2539,12 @@ bool DivPlatformOPL::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformOPL::getMemCompo(int index) { + if (adpcmChan<0) return NULL; + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformOPL::renderSamples(int sysID) { if (adpcmChan<0) return; memset(adpcmBMem,0,getSampleMemCapacity(0)); diff --git a/src/engine/platform/opl.h b/src/engine/platform/opl.h index 7beb3532d..5f2fd7d28 100644 --- a/src/engine/platform/opl.h +++ b/src/engine/platform/opl.h @@ -126,6 +126,8 @@ class DivPlatformOPL: public DivDispatch { fmopl2_t fm_lle2; fmopl3_t fm_lle3; + DivMemoryComposition memCompo; + int octave(int freq); int toFreq(int freq); double NOTE_ADPCMB(int note); @@ -174,6 +176,7 @@ class DivPlatformOPL: public DivDispatch { size_t getSampleMemCapacity(int index); size_t getSampleMemUsage(int index); bool isSampleLoaded(int index, int sample); + const DivMemoryComposition* getMemCompo(int index); void renderSamples(int chipID); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); void quit(); diff --git a/src/engine/platform/qsound.cpp b/src/engine/platform/qsound.cpp index 152afb932..f0a3a1712 100644 --- a/src/engine/platform/qsound.cpp +++ b/src/engine/platform/qsound.cpp @@ -735,6 +735,11 @@ const char* DivPlatformQSound::getSampleMemName(int index) { return index == 0 ? "PCM" : index == 1 ? "ADPCM" : NULL; } +const DivMemoryComposition* DivPlatformQSound::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformQSound::renderSamples(int sysID) { memset(sampleMem,0,getSampleMemCapacity()); memset(sampleLoaded,0,256*sizeof(bool)); diff --git a/src/engine/platform/qsound.h b/src/engine/platform/qsound.h index 929411402..3d817606a 100644 --- a/src/engine/platform/qsound.h +++ b/src/engine/platform/qsound.h @@ -58,6 +58,8 @@ class DivPlatformQSound: public DivDispatch { unsigned int offPCM[256]; unsigned int offBS[256]; + DivMemoryComposition memCompo; + friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); @@ -89,6 +91,7 @@ class DivPlatformQSound: public DivDispatch { size_t getSampleMemCapacity(int index = 0); size_t getSampleMemUsage(int index = 0); bool isSampleLoaded(int index, int sample); + const DivMemoryComposition* getMemCompo(int index); void renderSamples(int chipID); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); void quit(); diff --git a/src/engine/platform/rf5c68.cpp b/src/engine/platform/rf5c68.cpp index 148df4c28..5bb70f026 100644 --- a/src/engine/platform/rf5c68.cpp +++ b/src/engine/platform/rf5c68.cpp @@ -415,6 +415,11 @@ bool DivPlatformRF5C68::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformRF5C68::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformRF5C68::renderSamples(int sysID) { memset(sampleMem,0,getSampleMemCapacity()); memset(sampleOffRFC,0,256*sizeof(unsigned int)); diff --git a/src/engine/platform/rf5c68.h b/src/engine/platform/rf5c68.h index 3ae081017..e87d1eb7c 100644 --- a/src/engine/platform/rf5c68.h +++ b/src/engine/platform/rf5c68.h @@ -50,6 +50,7 @@ class DivPlatformRF5C68: public DivDispatch { unsigned char* sampleMem; size_t sampleMemLen; rf5c68_device rf5c68; + DivMemoryComposition memCompo; unsigned char regPool[144]; friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); @@ -80,6 +81,7 @@ class DivPlatformRF5C68: public DivDispatch { size_t getSampleMemCapacity(int index = 0); size_t getSampleMemUsage(int index = 0); bool isSampleLoaded(int index, int sample); + const DivMemoryComposition* getMemCompo(int index); void renderSamples(int chipID); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); void quit(); diff --git a/src/engine/platform/segapcm.cpp b/src/engine/platform/segapcm.cpp index 19ec2bbb7..439bfd154 100644 --- a/src/engine/platform/segapcm.cpp +++ b/src/engine/platform/segapcm.cpp @@ -479,6 +479,11 @@ void DivPlatformSegaPCM::reset() { } } +const DivMemoryComposition* DivPlatformSegaPCM::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformSegaPCM::renderSamples(int sysID) { size_t memPos=0; diff --git a/src/engine/platform/segapcm.h b/src/engine/platform/segapcm.h index f99da7317..1c117c266 100644 --- a/src/engine/platform/segapcm.h +++ b/src/engine/platform/segapcm.h @@ -80,6 +80,8 @@ class DivPlatformSegaPCM: public DivDispatch { unsigned int sampleOffSegaPCM[256]; unsigned char sampleEndSegaPCM[256]; bool sampleLoaded[256]; + + DivMemoryComposition memCompo; friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); @@ -110,6 +112,7 @@ class DivPlatformSegaPCM: public DivDispatch { size_t getSampleMemCapacity(int index=0); size_t getSampleMemUsage(int index=0); bool isSampleLoaded(int index, int sample); + const DivMemoryComposition* getMemCompo(int index); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); void quit(); ~DivPlatformSegaPCM(); diff --git a/src/engine/platform/su.cpp b/src/engine/platform/su.cpp index 8a80ee7c2..83e268cfc 100644 --- a/src/engine/platform/su.cpp +++ b/src/engine/platform/su.cpp @@ -657,6 +657,11 @@ bool DivPlatformSoundUnit::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformSoundUnit::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformSoundUnit::renderSamples(int sysID) { memset(sampleMem,0,sampleMemSize?65536:8192); memset(sampleOffSU,0,256*sizeof(unsigned int)); diff --git a/src/engine/platform/su.h b/src/engine/platform/su.h index f39a59cc7..0456f42f7 100644 --- a/src/engine/platform/su.h +++ b/src/engine/platform/su.h @@ -99,6 +99,7 @@ class DivPlatformSoundUnit: public DivDispatch { unsigned char* sampleMem; size_t sampleMemLen; unsigned char regPool[128]; + DivMemoryComposition memCompo; double NOTE_SU(int ch, int note); void writeControl(int ch); void writeControlUpper(int ch); @@ -129,6 +130,7 @@ class DivPlatformSoundUnit: public DivDispatch { size_t getSampleMemCapacity(int index); size_t getSampleMemUsage(int index); bool isSampleLoaded(int index, int sample); + const DivMemoryComposition* getMemCompo(int index); void renderSamples(int chipID); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); void quit(); diff --git a/src/engine/platform/x1_010.cpp b/src/engine/platform/x1_010.cpp index 9ac523f6f..24ae09119 100644 --- a/src/engine/platform/x1_010.cpp +++ b/src/engine/platform/x1_010.cpp @@ -995,6 +995,11 @@ bool DivPlatformX1_010::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformX1_010::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformX1_010::renderSamples(int sysID) { memset(sampleMem,0,16777216); memset(sampleOffX1,0,256*sizeof(unsigned int)); diff --git a/src/engine/platform/x1_010.h b/src/engine/platform/x1_010.h index f4a815455..413aba3e8 100644 --- a/src/engine/platform/x1_010.h +++ b/src/engine/platform/x1_010.h @@ -119,6 +119,8 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf { unsigned int sampleOffX1[256]; bool sampleLoaded[256]; + DivMemoryComposition memCompo; + unsigned char regPool[0x2000]; double NoteX1_010(int ch, int note); void updateWave(int ch); @@ -151,6 +153,7 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf { size_t getSampleMemCapacity(int index = 0); size_t getSampleMemUsage(int index = 0); bool isSampleLoaded(int index, int sample); + const DivMemoryComposition* getMemCompo(int index); void renderSamples(int chipID); const char** getRegisterSheet(); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); diff --git a/src/engine/platform/ym2608.cpp b/src/engine/platform/ym2608.cpp index 0a6168cd2..36f8c36d2 100644 --- a/src/engine/platform/ym2608.cpp +++ b/src/engine/platform/ym2608.cpp @@ -1605,6 +1605,11 @@ bool DivPlatformYM2608::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformYM2608::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformYM2608::renderSamples(int sysID) { memset(adpcmBMem,0,getSampleMemCapacity(0)); memset(sampleOffB,0,256*sizeof(unsigned int)); diff --git a/src/engine/platform/ym2608.h b/src/engine/platform/ym2608.h index 2b51da1d6..2e95ebcae 100644 --- a/src/engine/platform/ym2608.h +++ b/src/engine/platform/ym2608.h @@ -64,6 +64,8 @@ class DivPlatformYM2608: public DivPlatformOPN { bool extMode, noExtMacros; unsigned char prescale, nukedMult; + + DivMemoryComposition memCompo; double NOTE_OPNB(int ch, int note); double NOTE_ADPCMB(int note); @@ -100,6 +102,7 @@ class DivPlatformYM2608: public DivPlatformOPN { size_t getSampleMemCapacity(int index); size_t getSampleMemUsage(int index); bool isSampleLoaded(int index, int sample); + const DivMemoryComposition* getMemCompo(int index); void renderSamples(int chipID); void setFlags(const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); diff --git a/src/engine/platform/ym2610shared.h b/src/engine/platform/ym2610shared.h index 0c96e5447..9a1d05ca7 100644 --- a/src/engine/platform/ym2610shared.h +++ b/src/engine/platform/ym2610shared.h @@ -73,6 +73,9 @@ class DivPlatformYM2610Base: public DivPlatformOPN { unsigned char writeADPCMAOff, writeADPCMAOn; int globalADPCMAVolume; + DivMemoryComposition memCompoA; + DivMemoryComposition memCompoB; + double NOTE_OPNB(int ch, int note) { if (ch>=adpcmBChanOffs) { // ADPCM return NOTE_ADPCMB(note); @@ -144,6 +147,12 @@ class DivPlatformYM2610Base: public DivPlatformOPN { if (sample<0 || sample>255) return false; return sampleLoaded[index][sample]; } + + const DivMemoryComposition* getMemCompo(int index) { + if (index==0) return &memCompoA; + if (index==1) return &memCompoB; + return NULL; + } void renderSamples(int sysID) { memset(adpcmAMem,0,getSampleMemCapacity(0)); diff --git a/src/engine/platform/ymz280b.cpp b/src/engine/platform/ymz280b.cpp index 878ed0f0d..ea7aec15a 100644 --- a/src/engine/platform/ymz280b.cpp +++ b/src/engine/platform/ymz280b.cpp @@ -442,6 +442,11 @@ bool DivPlatformYMZ280B::isSampleLoaded(int index, int sample) { return sampleLoaded[sample]; } +const DivMemoryComposition* DivPlatformYMZ280B::getMemCompo(int index) { + if (index!=0) return NULL; + return &memCompo; +} + void DivPlatformYMZ280B::renderSamples(int sysID) { memset(sampleMem,0,getSampleMemCapacity()); memset(sampleOff,0,256*sizeof(unsigned int)); diff --git a/src/engine/platform/ymz280b.h b/src/engine/platform/ymz280b.h index 703cef6c8..abb16123a 100644 --- a/src/engine/platform/ymz280b.h +++ b/src/engine/platform/ymz280b.h @@ -50,6 +50,7 @@ class DivPlatformYMZ280B: public DivDispatch { unsigned char* sampleMem; size_t sampleMemLen; ymz280b_device ymz280b; + DivMemoryComposition memCompo; unsigned char regPool[256]; friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); @@ -80,6 +81,7 @@ class DivPlatformYMZ280B: public DivDispatch { size_t getSampleMemCapacity(int index = 0); size_t getSampleMemUsage(int index = 0); bool isSampleLoaded(int index, int sample); + const DivMemoryComposition* getMemCompo(int index); void renderSamples(int chipID); void setFlags(const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); diff --git a/src/gui/guiConst.cpp b/src/gui/guiConst.cpp index 49bd19cbd..b17688032 100644 --- a/src/gui/guiConst.cpp +++ b/src/gui/guiConst.cpp @@ -1118,14 +1118,14 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={ D(GUI_COLOR_MEMORY_WAVE_RAM,"",ImVec4(1.0f,0.5f,0.1f,1.0f)), D(GUI_COLOR_MEMORY_WAVE_STATIC,"",ImVec4(1.0f,0.3f,0.1f,1.0f)), D(GUI_COLOR_MEMORY_ECHO,"",ImVec4(0.2f,1.0f,1.0f,1.0f)), - D(GUI_COLOR_MEMORY_BANK0,"",ImVec4(1.0f,1.0f,1.0f,1.0f)), - D(GUI_COLOR_MEMORY_BANK1,"",ImVec4(1.0f,1.0f,1.0f,1.0f)), - D(GUI_COLOR_MEMORY_BANK2,"",ImVec4(1.0f,1.0f,1.0f,1.0f)), - D(GUI_COLOR_MEMORY_BANK3,"",ImVec4(1.0f,1.0f,1.0f,1.0f)), - D(GUI_COLOR_MEMORY_BANK4,"",ImVec4(1.0f,1.0f,1.0f,1.0f)), - D(GUI_COLOR_MEMORY_BANK5,"",ImVec4(1.0f,1.0f,1.0f,1.0f)), - D(GUI_COLOR_MEMORY_BANK6,"",ImVec4(1.0f,1.0f,1.0f,1.0f)), - D(GUI_COLOR_MEMORY_BANK7,"",ImVec4(1.0f,1.0f,1.0f,1.0f)), + D(GUI_COLOR_MEMORY_BANK0,"",ImVec4(1.0f,0.1f,0.1f,1.0f)), + D(GUI_COLOR_MEMORY_BANK1,"",ImVec4(1.0f,0.5f,0.1f,1.0f)), + D(GUI_COLOR_MEMORY_BANK2,"",ImVec4(1.0f,1.0f,0.1f,1.0f)), + D(GUI_COLOR_MEMORY_BANK3,"",ImVec4(0.1f,1.0f,0.1f,1.0f)), + D(GUI_COLOR_MEMORY_BANK4,"",ImVec4(0.1f,1.0f,1.0f,1.0f)), + D(GUI_COLOR_MEMORY_BANK5,"",ImVec4(0.1f,0.1f,1.0f,1.0f)), + D(GUI_COLOR_MEMORY_BANK6,"",ImVec4(0.5f,0.1f,1.0f,1.0f)), + D(GUI_COLOR_MEMORY_BANK7,"",ImVec4(1.0f,0.1f,1.0f,1.0f)), D(GUI_COLOR_LOGLEVEL_ERROR,"",ImVec4(1.0f,0.2f,0.2f,1.0f)), D(GUI_COLOR_LOGLEVEL_WARNING,"",ImVec4(1.0f,1.0f,0.2f,1.0f)), diff --git a/src/gui/memory.cpp b/src/gui/memory.cpp index 5bbbe8562..c98c3f127 100644 --- a/src/gui/memory.cpp +++ b/src/gui/memory.cpp @@ -84,9 +84,20 @@ void FurnaceGUI::drawMemory() { const DivMemoryEntry& entry=mc->entries[curHover]; if (ImGui::BeginTooltip()) { switch (entry.type) { - case DIV_MEMORY_SAMPLE: { + case DIV_MEMORY_SAMPLE: + case DIV_MEMORY_BANK0: + case DIV_MEMORY_BANK1: + case DIV_MEMORY_BANK2: + case DIV_MEMORY_BANK3: + case DIV_MEMORY_BANK4: + case DIV_MEMORY_BANK5: + case DIV_MEMORY_BANK6: + case DIV_MEMORY_BANK7: { DivSample* sample=e->getSample(entry.asset); ImGui::Text("%d: %s",curHover,sample->name.c_str()); + if ((int)entry.type>=(int)DIV_MEMORY_BANK0) { + ImGui::Text("bank %d",(int)entry.type-(int)DIV_MEMORY_BANK0); + } ImGui::Text("%d-%d ($%x-$%x): %d bytes ($%x)",(int)entry.begin,(int)entry.end-1,(int)entry.begin,(int)entry.end-1,(int)(entry.end-entry.begin),(int)(entry.end-entry.begin)); ImGui::Text("click to open sample editor"); break; diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index cc9db0461..283862ee2 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -3666,6 +3666,29 @@ void FurnaceGUI::drawSettings() { ImGui::TreePop(); } + if (ImGui::TreeNode("Memory Composition")) { + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BG,"Background"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_FREE,"Unknown"); + //UI_COLOR_CONFIG(GUI_COLOR_MEMORY_PADDING,""); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_RESERVED,"Reserved"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE,"Sample"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE_ALT1,"Sample (alternate 1)"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE_ALT2,"Sample (alternate 2)"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE_ALT3,"Sample (alternate 3)"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_WAVE_RAM,"Wave RAM"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_WAVE_STATIC,"Wavetable (static)"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_ECHO,"Echo buffer"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK0,"Sample (bank 0)"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK1,"Sample (bank 1)"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK2,"Sample (bank 2)"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK3,"Sample (bank 3)"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK4,"Sample (bank 4)"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK5,"Sample (bank 5)"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK6,"Sample (bank 6)"); + UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK7,"Sample (bank 7)"); + + ImGui::TreePop(); + } if (ImGui::TreeNode("Log Viewer")) { UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_ERROR,"Log level: Error"); UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_WARNING,"Log level: Warning");