Sync with master, Fix crash
This commit is contained in:
parent
0cd7ed84f9
commit
f46cd60f08
|
|
@ -517,11 +517,19 @@ bool DivPlatformNDS::isSampleLoaded(int index, int sample) {
|
||||||
return sampleLoaded[sample];
|
return sampleLoaded[sample];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DivMemoryComposition* DivPlatformNDS::getMemCompo(int index) {
|
||||||
|
if (index!=0) return NULL;
|
||||||
|
return &memCompo;
|
||||||
|
}
|
||||||
|
|
||||||
void DivPlatformNDS::renderSamples(int sysID) {
|
void DivPlatformNDS::renderSamples(int sysID) {
|
||||||
memset(sampleMem,0,16777216);
|
memset(sampleMem,0,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="Main Memory";
|
||||||
|
|
||||||
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];
|
||||||
|
|
@ -536,7 +544,8 @@ void DivPlatformNDS::renderSamples(int sysID) {
|
||||||
if (actualLength>0) {
|
if (actualLength>0) {
|
||||||
memcpy(&sampleMem[memPos],src,actualLength);
|
memcpy(&sampleMem[memPos],src,actualLength);
|
||||||
sampleOff[i]=memPos;
|
sampleOff[i]=memPos;
|
||||||
memPos+=length;
|
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength));
|
||||||
|
memPos+=actualLength;
|
||||||
}
|
}
|
||||||
if (actualLength<length) {
|
if (actualLength<length) {
|
||||||
logW("out of NDS PCM memory for sample %d!",i);
|
logW("out of NDS PCM memory for sample %d!",i);
|
||||||
|
|
@ -547,6 +556,9 @@ void DivPlatformNDS::renderSamples(int sysID) {
|
||||||
sampleLoaded[i]=true;
|
sampleLoaded[i]=true;
|
||||||
}
|
}
|
||||||
sampleMemLen=memPos;
|
sampleMemLen=memPos;
|
||||||
|
|
||||||
|
memCompo.capacity=(isDSi?16777216:4194304);
|
||||||
|
memCompo.used=sampleMemLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformNDS::setFlags(const DivConfig& flags) {
|
void DivPlatformNDS::setFlags(const DivConfig& flags) {
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ class DivPlatformNDS: public DivDispatch, public nds_sound_intf {
|
||||||
unsigned char* sampleMem;
|
unsigned char* sampleMem;
|
||||||
size_t sampleMemLen;
|
size_t sampleMemLen;
|
||||||
nds_sound_t nds;
|
nds_sound_t nds;
|
||||||
|
DivMemoryComposition memCompo;
|
||||||
unsigned char regPool[288];
|
unsigned char regPool[288];
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
@ -87,6 +88,7 @@ class DivPlatformNDS: public DivDispatch, public nds_sound_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 void setFlags(const DivConfig& flags) override;
|
virtual void setFlags(const DivConfig& flags) 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;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue