mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-25 14:05:12 +00:00
Sync with master, Fix crash
This commit is contained in:
parent
0cd7ed84f9
commit
f46cd60f08
2 changed files with 15 additions and 1 deletions
|
@ -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) {
|
||||
|
|
|
@ -55,6 +55,7 @@ class DivPlatformNDS: public DivDispatch, public nds_sound_intf {
|
|||
unsigned char* sampleMem;
|
||||
size_t sampleMemLen;
|
||||
nds_sound_t nds;
|
||||
DivMemoryComposition memCompo;
|
||||
unsigned char regPool[288];
|
||||
friend void putDispatchChip(void*,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 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 void setFlags(const DivConfig& flags) override;
|
||||
virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override;
|
||||
|
|
Loading…
Reference in a new issue