memory composition, part 3

This commit is contained in:
tildearrow 2024-03-05 18:55:18 -05:00
parent a200d464a6
commit 92ec6f6651
36 changed files with 190 additions and 9 deletions

View file

@ -922,11 +922,22 @@ bool DivPlatformAmiga::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformAmiga::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformAmiga::renderSamples(int sysID) { void DivPlatformAmiga::renderSamples(int sysID) {
memset(sampleMem,0,2097152); memset(sampleMem,0,2097152);
memset(sampleOff,0,256*sizeof(unsigned int)); memset(sampleOff,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool)); 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 // first 1024 bytes reserved for wavetable
// the next 2 bytes are reserved for end of sample // the next 2 bytes are reserved for end of sample
size_t memPos=1026; size_t memPos=1026;
@ -947,6 +958,7 @@ void DivPlatformAmiga::renderSamples(int sysID) {
if (actualLength>0) { if (actualLength>0) {
sampleOff[i]=memPos; sampleOff[i]=memPos;
memcpy(&sampleMem[memPos],s->data8,actualLength); memcpy(&sampleMem[memPos],s->data8,actualLength);
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength));
memPos+=actualLength; memPos+=actualLength;
} }
// align memPos to short // align memPos to short
@ -954,6 +966,9 @@ void DivPlatformAmiga::renderSamples(int sysID) {
sampleLoaded[i]=true; sampleLoaded[i]=true;
} }
sampleMemLen=memPos; sampleMemLen=memPos;
memCompo.capacity=1<<chipMem;
memCompo.used=sampleMemLen;
} }
int DivPlatformAmiga::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { int DivPlatformAmiga::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {

View file

@ -113,6 +113,8 @@ class DivPlatformAmiga: public DivDispatch {
unsigned short regPool[256]; unsigned short regPool[256];
DivMemoryComposition memCompo;
unsigned char* sampleMem; unsigned char* sampleMem;
size_t sampleMemLen; size_t sampleMemLen;
@ -162,6 +164,7 @@ class DivPlatformAmiga: public DivDispatch {
size_t getSampleMemCapacity(int index=0); size_t getSampleMemCapacity(int index=0);
size_t getSampleMemUsage(int index=0); size_t getSampleMemUsage(int index=0);
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
}; };

View file

@ -595,11 +595,19 @@ bool DivPlatformC140::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformC140::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformC140::renderSamples(int sysID) { void DivPlatformC140::renderSamples(int sysID) {
memset(sampleMem,0,is219?524288:16777216); memset(sampleMem,0,is219?524288:16777216);
memset(sampleOff,0,256*sizeof(unsigned int)); memset(sampleOff,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool)); memset(sampleLoaded,0,256*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Sample ROM";
size_t memPos=0; size_t memPos=0;
for (int i=0; i<parent->song.sampleLen; i++) { for (int i=0; i<parent->song.sampleLen; i++) {
DivSample* s=parent->song.sample[i]; DivSample* s=parent->song.sample[i];
@ -658,6 +666,7 @@ void DivPlatformC140::renderSamples(int sysID) {
} }
sampleOff[i]=memPos>>1; sampleOff[i]=memPos>>1;
sampleLoaded[i]=true; sampleLoaded[i]=true;
memCompo.entries.push_back(DivMemoryEntry((DivMemoryEntryType)(DIV_MEMORY_BANK0+((memPos>>17)&3)),"Sample",i,memPos,memPos+length));
memPos+=length; memPos+=length;
} else { // C140 (16-bit) } else { // C140 (16-bit)
unsigned int length=s->length16+4; unsigned int length=s->length16+4;
@ -704,10 +713,14 @@ void DivPlatformC140::renderSamples(int sysID) {
} }
sampleOff[i]=memPos>>1; sampleOff[i]=memPos>>1;
sampleLoaded[i]=true; sampleLoaded[i]=true;
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+length));
memPos+=length; memPos+=length;
} }
} }
sampleMemLen=memPos+256; sampleMemLen=memPos+256;
memCompo.used=sampleMemLen;
memCompo.capacity=getSampleMemCapacity(0);
} }
void DivPlatformC140::set219(bool is_219) { void DivPlatformC140::set219(bool is_219) {

View file

@ -74,6 +74,7 @@ class DivPlatformC140: public DivDispatch {
FixedQueue<QueuedWrite,2048> writes; FixedQueue<QueuedWrite,2048> writes;
struct c140_t c140; struct c140_t c140;
struct c219_t c219; struct c219_t c219;
DivMemoryComposition memCompo;
unsigned char regPool[512]; unsigned char regPool[512];
char bankLabel[4][4]; char bankLabel[4][4];
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
@ -108,6 +109,7 @@ class DivPlatformC140: public DivDispatch {
size_t getSampleMemCapacity(int index = 0); size_t getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0); size_t getSampleMemUsage(int index = 0);
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID); void renderSamples(int chipID);
int getClockRangeMin(); int getClockRangeMin();
int getClockRangeMax(); int getClockRangeMax();

View file

@ -1203,6 +1203,11 @@ bool DivPlatformES5506::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformES5506::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformES5506::renderSamples(int sysID) { void DivPlatformES5506::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity()); memset(sampleMem,0,getSampleMemCapacity());
memset(sampleOffES5506,0,256*sizeof(unsigned int)); memset(sampleOffES5506,0,256*sizeof(unsigned int));

View file

@ -278,6 +278,7 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
unsigned char initChanMax, chanMax; unsigned char initChanMax, chanMax;
es5506_core es5506; es5506_core es5506;
DivMemoryComposition memCompo;
unsigned char regPool[4*16*128]; // 7 bit page x 16 registers per page x 32 bit per registers unsigned char regPool[4*16*128]; // 7 bit page x 16 registers per page x 32 bit per registers
friend void putDispatchChip(void*,int); 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 getSampleMemCapacity(int index = 0) override;
virtual size_t getSampleMemUsage(int index = 0) override; virtual size_t getSampleMemUsage(int index = 0) override;
virtual bool isSampleLoaded(int index, int sample) override; virtual bool isSampleLoaded(int index, int sample) override;
virtual const DivMemoryComposition* getMemCompo(int index) override;
virtual void renderSamples(int sysID) override; virtual void renderSamples(int sysID) override;
virtual const char** getRegisterSheet() override; virtual const char** getRegisterSheet() override;
virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override; virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override;

View file

@ -441,6 +441,11 @@ bool DivPlatformGA20::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformGA20::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformGA20::renderSamples(int sysID) { void DivPlatformGA20::renderSamples(int sysID) {
memset(sampleMem,0x00,getSampleMemCapacity()); memset(sampleMem,0x00,getSampleMemCapacity());
memset(sampleOffGA20,0,256*sizeof(unsigned int)); memset(sampleOffGA20,0,256*sizeof(unsigned int));

View file

@ -66,6 +66,7 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf {
unsigned char* sampleMem; unsigned char* sampleMem;
size_t sampleMemLen; size_t sampleMemLen;
iremga20_device ga20; iremga20_device ga20;
DivMemoryComposition memCompo;
unsigned char regPool[32]; unsigned char regPool[32];
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,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 getSampleMemCapacity(int index = 0) override;
virtual size_t getSampleMemUsage(int index = 0) override; virtual size_t getSampleMemUsage(int index = 0) override;
virtual bool isSampleLoaded(int index, int sample) override; virtual bool isSampleLoaded(int index, int sample) override;
virtual const DivMemoryComposition* getMemCompo(int index) override;
virtual void renderSamples(int chipID) override; virtual void renderSamples(int chipID) override;
virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override; virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override;
virtual void quit() override; virtual void quit() override;

View file

@ -528,6 +528,11 @@ bool DivPlatformK007232::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformK007232::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformK007232::renderSamples(int sysID) { void DivPlatformK007232::renderSamples(int sysID) {
memset(sampleMem,0xc0,getSampleMemCapacity()); memset(sampleMem,0xc0,getSampleMemCapacity());
memset(sampleOffK007232,0,256*sizeof(unsigned int)); memset(sampleOffK007232,0,256*sizeof(unsigned int));

View file

@ -74,6 +74,7 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf {
unsigned char* sampleMem; unsigned char* sampleMem;
size_t sampleMemLen; size_t sampleMemLen;
k007232_core k007232; k007232_core k007232;
DivMemoryComposition memCompo;
unsigned char regPool[20]; unsigned char regPool[20];
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,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 getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0); size_t getSampleMemUsage(int index = 0);
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID); void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();

View file

@ -466,6 +466,11 @@ bool DivPlatformK053260::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformK053260::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformK053260::renderSamples(int sysID) { void DivPlatformK053260::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity()); memset(sampleMem,0,getSampleMemCapacity());
memset(sampleOffK053260,0,256*sizeof(unsigned int)); memset(sampleOffK053260,0,256*sizeof(unsigned int));

View file

@ -52,6 +52,7 @@ class DivPlatformK053260: public DivDispatch, public k053260_intf {
unsigned char* sampleMem; unsigned char* sampleMem;
size_t sampleMemLen; size_t sampleMemLen;
k053260_core k053260; k053260_core k053260;
DivMemoryComposition memCompo;
unsigned char regPool[64]; unsigned char regPool[64];
void updatePanning(unsigned char mask); 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 getSampleMemCapacity(int index = 0) override;
virtual size_t getSampleMemUsage(int index = 0) override; virtual size_t getSampleMemUsage(int index = 0) override;
virtual bool isSampleLoaded(int index, int sample) override; virtual bool isSampleLoaded(int index, int sample) override;
virtual const DivMemoryComposition* getMemCompo(int index) override;
virtual void renderSamples(int chipID) override; virtual void renderSamples(int chipID) override;
virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override; virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override;
virtual void quit() override; virtual void quit() override;

View file

@ -370,6 +370,11 @@ bool DivPlatformMSM6295::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformMSM6295::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformMSM6295::renderSamples(int sysID) { void DivPlatformMSM6295::renderSamples(int sysID) {
unsigned int sampleOffVOX[256]; unsigned int sampleOffVOX[256];

View file

@ -69,6 +69,8 @@ class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf {
phrase(0), phrase(0),
length(0) {} length(0) {}
} bankedPhrase[256]; } bankedPhrase[256];
DivMemoryComposition memCompo;
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,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 getSampleMemCapacity(int index) override;
virtual size_t getSampleMemUsage(int index) override; virtual size_t getSampleMemUsage(int index) override;
virtual bool isSampleLoaded(int index, int sample) override; virtual bool isSampleLoaded(int index, int sample) override;
virtual const DivMemoryComposition* getMemCompo(int index) override;
virtual void renderSamples(int chipID) override; virtual void renderSamples(int chipID) override;
virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override; virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override;

View file

@ -839,6 +839,11 @@ bool DivPlatformNES::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformNES::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformNES::renderSamples(int sysID) { void DivPlatformNES::renderSamples(int sysID) {
memset(dpcmMem,0,getSampleMemCapacity(0));\ memset(dpcmMem,0,getSampleMemCapacity(0));\
memset(sampleLoaded,0,256*sizeof(bool)); memset(sampleLoaded,0,256*sizeof(bool));

View file

@ -67,6 +67,7 @@ class DivPlatformNES: public DivDispatch {
xgm::NES_DMC* nes2_NP; xgm::NES_DMC* nes2_NP;
unsigned char regPool[128]; unsigned char regPool[128];
unsigned int sampleOffDPCM[256]; unsigned int sampleOffDPCM[256];
DivMemoryComposition memCompo;
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);
@ -101,6 +102,7 @@ class DivPlatformNES: public DivDispatch {
size_t getSampleMemCapacity(int index); size_t getSampleMemCapacity(int index);
size_t getSampleMemUsage(int index); size_t getSampleMemUsage(int index);
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID); void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();

View file

@ -2539,6 +2539,12 @@ bool DivPlatformOPL::isSampleLoaded(int index, int sample) {
return sampleLoaded[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) { void DivPlatformOPL::renderSamples(int sysID) {
if (adpcmChan<0) return; if (adpcmChan<0) return;
memset(adpcmBMem,0,getSampleMemCapacity(0)); memset(adpcmBMem,0,getSampleMemCapacity(0));

View file

@ -126,6 +126,8 @@ class DivPlatformOPL: public DivDispatch {
fmopl2_t fm_lle2; fmopl2_t fm_lle2;
fmopl3_t fm_lle3; fmopl3_t fm_lle3;
DivMemoryComposition memCompo;
int octave(int freq); int octave(int freq);
int toFreq(int freq); int toFreq(int freq);
double NOTE_ADPCMB(int note); double NOTE_ADPCMB(int note);
@ -174,6 +176,7 @@ class DivPlatformOPL: public DivDispatch {
size_t getSampleMemCapacity(int index); size_t getSampleMemCapacity(int index);
size_t getSampleMemUsage(int index); size_t getSampleMemUsage(int index);
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID); void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();

View file

@ -735,6 +735,11 @@ const char* DivPlatformQSound::getSampleMemName(int index) {
return index == 0 ? "PCM" : index == 1 ? "ADPCM" : NULL; 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) { void DivPlatformQSound::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity()); memset(sampleMem,0,getSampleMemCapacity());
memset(sampleLoaded,0,256*sizeof(bool)); memset(sampleLoaded,0,256*sizeof(bool));

View file

@ -58,6 +58,8 @@ class DivPlatformQSound: public DivDispatch {
unsigned int offPCM[256]; unsigned int offPCM[256];
unsigned int offBS[256]; unsigned int offBS[256];
DivMemoryComposition memCompo;
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);
@ -89,6 +91,7 @@ class DivPlatformQSound: public DivDispatch {
size_t getSampleMemCapacity(int index = 0); size_t getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0); size_t getSampleMemUsage(int index = 0);
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID); void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();

View file

@ -415,6 +415,11 @@ bool DivPlatformRF5C68::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformRF5C68::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformRF5C68::renderSamples(int sysID) { void DivPlatformRF5C68::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity()); memset(sampleMem,0,getSampleMemCapacity());
memset(sampleOffRFC,0,256*sizeof(unsigned int)); memset(sampleOffRFC,0,256*sizeof(unsigned int));

View file

@ -50,6 +50,7 @@ class DivPlatformRF5C68: public DivDispatch {
unsigned char* sampleMem; unsigned char* sampleMem;
size_t sampleMemLen; size_t sampleMemLen;
rf5c68_device rf5c68; rf5c68_device rf5c68;
DivMemoryComposition memCompo;
unsigned char regPool[144]; unsigned char regPool[144];
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);
@ -80,6 +81,7 @@ class DivPlatformRF5C68: public DivDispatch {
size_t getSampleMemCapacity(int index = 0); size_t getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0); size_t getSampleMemUsage(int index = 0);
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID); void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();

View file

@ -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) { void DivPlatformSegaPCM::renderSamples(int sysID) {
size_t memPos=0; size_t memPos=0;

View file

@ -80,6 +80,8 @@ class DivPlatformSegaPCM: public DivDispatch {
unsigned int sampleOffSegaPCM[256]; unsigned int sampleOffSegaPCM[256];
unsigned char sampleEndSegaPCM[256]; unsigned char sampleEndSegaPCM[256];
bool sampleLoaded[256]; bool sampleLoaded[256];
DivMemoryComposition memCompo;
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);
@ -110,6 +112,7 @@ class DivPlatformSegaPCM: public DivDispatch {
size_t getSampleMemCapacity(int index=0); size_t getSampleMemCapacity(int index=0);
size_t getSampleMemUsage(int index=0); size_t getSampleMemUsage(int index=0);
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();
~DivPlatformSegaPCM(); ~DivPlatformSegaPCM();

View file

@ -657,6 +657,11 @@ bool DivPlatformSoundUnit::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformSoundUnit::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformSoundUnit::renderSamples(int sysID) { void DivPlatformSoundUnit::renderSamples(int sysID) {
memset(sampleMem,0,sampleMemSize?65536:8192); memset(sampleMem,0,sampleMemSize?65536:8192);
memset(sampleOffSU,0,256*sizeof(unsigned int)); memset(sampleOffSU,0,256*sizeof(unsigned int));

View file

@ -99,6 +99,7 @@ class DivPlatformSoundUnit: public DivDispatch {
unsigned char* sampleMem; unsigned char* sampleMem;
size_t sampleMemLen; size_t sampleMemLen;
unsigned char regPool[128]; unsigned char regPool[128];
DivMemoryComposition memCompo;
double NOTE_SU(int ch, int note); double NOTE_SU(int ch, int note);
void writeControl(int ch); void writeControl(int ch);
void writeControlUpper(int ch); void writeControlUpper(int ch);
@ -129,6 +130,7 @@ class DivPlatformSoundUnit: public DivDispatch {
size_t getSampleMemCapacity(int index); size_t getSampleMemCapacity(int index);
size_t getSampleMemUsage(int index); size_t getSampleMemUsage(int index);
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID); void renderSamples(int chipID);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
void quit(); void quit();

View file

@ -995,6 +995,11 @@ bool DivPlatformX1_010::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformX1_010::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformX1_010::renderSamples(int sysID) { void DivPlatformX1_010::renderSamples(int sysID) {
memset(sampleMem,0,16777216); memset(sampleMem,0,16777216);
memset(sampleOffX1,0,256*sizeof(unsigned int)); memset(sampleOffX1,0,256*sizeof(unsigned int));

View file

@ -119,6 +119,8 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf {
unsigned int sampleOffX1[256]; unsigned int sampleOffX1[256];
bool sampleLoaded[256]; bool sampleLoaded[256];
DivMemoryComposition memCompo;
unsigned char regPool[0x2000]; unsigned char regPool[0x2000];
double NoteX1_010(int ch, int note); double NoteX1_010(int ch, int note);
void updateWave(int ch); 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 getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0); size_t getSampleMemUsage(int index = 0);
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID); void renderSamples(int chipID);
const char** getRegisterSheet(); const char** getRegisterSheet();
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);

View file

@ -1605,6 +1605,11 @@ bool DivPlatformYM2608::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformYM2608::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformYM2608::renderSamples(int sysID) { void DivPlatformYM2608::renderSamples(int sysID) {
memset(adpcmBMem,0,getSampleMemCapacity(0)); memset(adpcmBMem,0,getSampleMemCapacity(0));
memset(sampleOffB,0,256*sizeof(unsigned int)); memset(sampleOffB,0,256*sizeof(unsigned int));

View file

@ -64,6 +64,8 @@ class DivPlatformYM2608: public DivPlatformOPN {
bool extMode, noExtMacros; bool extMode, noExtMacros;
unsigned char prescale, nukedMult; unsigned char prescale, nukedMult;
DivMemoryComposition memCompo;
double NOTE_OPNB(int ch, int note); double NOTE_OPNB(int ch, int note);
double NOTE_ADPCMB(int note); double NOTE_ADPCMB(int note);
@ -100,6 +102,7 @@ class DivPlatformYM2608: public DivPlatformOPN {
size_t getSampleMemCapacity(int index); size_t getSampleMemCapacity(int index);
size_t getSampleMemUsage(int index); size_t getSampleMemUsage(int index);
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID); void renderSamples(int chipID);
void setFlags(const DivConfig& flags); void setFlags(const DivConfig& flags);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);

View file

@ -73,6 +73,9 @@ class DivPlatformYM2610Base: public DivPlatformOPN {
unsigned char writeADPCMAOff, writeADPCMAOn; unsigned char writeADPCMAOff, writeADPCMAOn;
int globalADPCMAVolume; int globalADPCMAVolume;
DivMemoryComposition memCompoA;
DivMemoryComposition memCompoB;
double NOTE_OPNB(int ch, int note) { double NOTE_OPNB(int ch, int note) {
if (ch>=adpcmBChanOffs) { // ADPCM if (ch>=adpcmBChanOffs) { // ADPCM
return NOTE_ADPCMB(note); return NOTE_ADPCMB(note);
@ -144,6 +147,12 @@ class DivPlatformYM2610Base: public DivPlatformOPN {
if (sample<0 || sample>255) return false; if (sample<0 || sample>255) return false;
return sampleLoaded[index][sample]; 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) { void renderSamples(int sysID) {
memset(adpcmAMem,0,getSampleMemCapacity(0)); memset(adpcmAMem,0,getSampleMemCapacity(0));

View file

@ -442,6 +442,11 @@ bool DivPlatformYMZ280B::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample]; return sampleLoaded[sample];
} }
const DivMemoryComposition* DivPlatformYMZ280B::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformYMZ280B::renderSamples(int sysID) { void DivPlatformYMZ280B::renderSamples(int sysID) {
memset(sampleMem,0,getSampleMemCapacity()); memset(sampleMem,0,getSampleMemCapacity());
memset(sampleOff,0,256*sizeof(unsigned int)); memset(sampleOff,0,256*sizeof(unsigned int));

View file

@ -50,6 +50,7 @@ class DivPlatformYMZ280B: public DivDispatch {
unsigned char* sampleMem; unsigned char* sampleMem;
size_t sampleMemLen; size_t sampleMemLen;
ymz280b_device ymz280b; ymz280b_device ymz280b;
DivMemoryComposition memCompo;
unsigned char regPool[256]; unsigned char regPool[256];
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);
@ -80,6 +81,7 @@ class DivPlatformYMZ280B: public DivDispatch {
size_t getSampleMemCapacity(int index = 0); size_t getSampleMemCapacity(int index = 0);
size_t getSampleMemUsage(int index = 0); size_t getSampleMemUsage(int index = 0);
bool isSampleLoaded(int index, int sample); bool isSampleLoaded(int index, int sample);
const DivMemoryComposition* getMemCompo(int index);
void renderSamples(int chipID); void renderSamples(int chipID);
void setFlags(const DivConfig& flags); void setFlags(const DivConfig& flags);
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);

View file

@ -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_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_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_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_BANK0,"",ImVec4(1.0f,0.1f,0.1f,1.0f)),
D(GUI_COLOR_MEMORY_BANK1,"",ImVec4(1.0f,1.0f,1.0f,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,1.0f,1.0f)), D(GUI_COLOR_MEMORY_BANK2,"",ImVec4(1.0f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_MEMORY_BANK3,"",ImVec4(1.0f,1.0f,1.0f,1.0f)), D(GUI_COLOR_MEMORY_BANK3,"",ImVec4(0.1f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_MEMORY_BANK4,"",ImVec4(1.0f,1.0f,1.0f,1.0f)), D(GUI_COLOR_MEMORY_BANK4,"",ImVec4(0.1f,1.0f,1.0f,1.0f)),
D(GUI_COLOR_MEMORY_BANK5,"",ImVec4(1.0f,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(1.0f,1.0f,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,1.0f,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_ERROR,"",ImVec4(1.0f,0.2f,0.2f,1.0f)),
D(GUI_COLOR_LOGLEVEL_WARNING,"",ImVec4(1.0f,1.0f,0.2f,1.0f)), D(GUI_COLOR_LOGLEVEL_WARNING,"",ImVec4(1.0f,1.0f,0.2f,1.0f)),

View file

@ -84,9 +84,20 @@ void FurnaceGUI::drawMemory() {
const DivMemoryEntry& entry=mc->entries[curHover]; const DivMemoryEntry& entry=mc->entries[curHover];
if (ImGui::BeginTooltip()) { if (ImGui::BeginTooltip()) {
switch (entry.type) { 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); DivSample* sample=e->getSample(entry.asset);
ImGui::Text("%d: %s",curHover,sample->name.c_str()); 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("%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"); ImGui::Text("click to open sample editor");
break; break;

View file

@ -3666,6 +3666,29 @@ void FurnaceGUI::drawSettings() {
ImGui::TreePop(); 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")) { if (ImGui::TreeNode("Log Viewer")) {
UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_ERROR,"Log level: Error"); UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_ERROR,"Log level: Error");
UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_WARNING,"Log level: Warning"); UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_WARNING,"Log level: Warning");