Sync with master, Fix crash

This commit is contained in:
cam900 2024-03-06 11:39:53 +09:00 committed by tildearrow
parent 0cd7ed84f9
commit f46cd60f08
2 changed files with 15 additions and 1 deletions

View file

@ -517,11 +517,19 @@ bool DivPlatformNDS::isSampleLoaded(int index, int sample) {
return sampleLoaded[sample];
}
const DivMemoryComposition* DivPlatformNDS::getMemCompo(int index) {
if (index!=0) return NULL;
return &memCompo;
}
void DivPlatformNDS::renderSamples(int sysID) {
memset(sampleMem,0,16777216);
memset(sampleOff,0,256*sizeof(unsigned int));
memset(sampleLoaded,0,256*sizeof(bool));
memCompo=DivMemoryComposition();
memCompo.name="Main Memory";
size_t memPos=0;
for (int i=0; i<parent->song.sampleLen; i++) {
DivSample* s=parent->song.sample[i];
@ -536,7 +544,8 @@ void DivPlatformNDS::renderSamples(int sysID) {
if (actualLength>0) {
memcpy(&sampleMem[memPos],src,actualLength);
sampleOff[i]=memPos;
memPos+=length;
memCompo.entries.push_back(DivMemoryEntry(DIV_MEMORY_SAMPLE,"Sample",i,memPos,memPos+actualLength));
memPos+=actualLength;
}
if (actualLength<length) {
logW("out of NDS PCM memory for sample %d!",i);
@ -547,6 +556,9 @@ void DivPlatformNDS::renderSamples(int sysID) {
sampleLoaded[i]=true;
}
sampleMemLen=memPos;
memCompo.capacity=(isDSi?16777216:4194304);
memCompo.used=sampleMemLen;
}
void DivPlatformNDS::setFlags(const DivConfig& flags) {