PLENTY OF TODO WHEN I COME BACK

CRASHES EVERYWHERE
This commit is contained in:
tildearrow 2022-09-25 20:07:21 -05:00
parent 148d537a18
commit a6e4345863
28 changed files with 141 additions and 127 deletions

View file

@ -145,8 +145,9 @@ void DivPlatformYMZ280B::tick(bool sysTick) {
// ADPCM has half the range
if (s->depth==DIV_SAMPLE_DEPTH_YMZ_ADPCM && chan[i].freq>255) chan[i].freq=255;
ctrl|=(chan[i].active?0x80:0)|((s->isLoopable())?0x10:0)|(chan[i].freq>>8);
// TODO: AGAIN THIS WILL CRASH IF THE SAMPLE IS INVALID!!!
if (chan[i].keyOn) {
unsigned int start=s->offYMZ280B;
unsigned int start=sampleOff[chan[i].sample];
unsigned int loopStart=0;
unsigned int loopEnd=0;
unsigned int end=MIN(start+s->getCurBufLen(),getSampleMemCapacity()-1);
@ -418,6 +419,7 @@ size_t DivPlatformYMZ280B::getSampleMemUsage(int index) {
void DivPlatformYMZ280B::renderSamples() {
memset(sampleMem,0,getSampleMemCapacity());
memset(sampleOff,0,256*sizeof(unsigned int));
size_t memPos=0;
for (int i=0; i<parent->song.sampleLen; i++) {
@ -427,7 +429,7 @@ void DivPlatformYMZ280B::renderSamples() {
int actualLength=MIN((int)(getSampleMemCapacity()-memPos),length);
if (actualLength>0) {
memcpy(&sampleMem[memPos],src,actualLength);
s->offYMZ280B=memPos;
sampleOff[i]=memPos;
memPos+=length;
}
if (actualLength<length) {