fix popping ADPCM samples in Neo Geo

finally!
This commit is contained in:
tildearrow 2021-12-22 12:00:40 -05:00
parent 00b42767de
commit d92e91c5d8

View file

@ -1305,7 +1305,7 @@ void DivEngine::renderSamples() {
int index=0; int index=0;
int prevsample=0; int prevsample=0;
int previndex=0; int previndex=0;
for (unsigned int j=0; j<s->rendLength; j++) { for (unsigned int j=0; j<s->adpcmRendLength*2; j++) {
unsigned char encoded=0; unsigned char encoded=0;
int tempstep=0; int tempstep=0;
@ -1313,7 +1313,7 @@ void DivEngine::renderSamples() {
index=previndex; index=previndex;
step=adSteps[index]; step=adSteps[index];
short sample=(s->depth==16)?(s->rendData[j]>>4):(s->rendData[j]<<4); short sample=(j<s->rendLength)?((s->depth==16)?(s->rendData[j]>>4):(s->rendData[j]<<4)):0;
diff=sample-predsample; diff=sample-predsample;
if (diff>=0) { if (diff>=0) {
encoded=0; encoded=0;
@ -1350,6 +1350,8 @@ void DivEngine::renderSamples() {
prevsample=predsample; prevsample=predsample;
previndex=index; previndex=index;
printf("%d: O %d E %d\n",j,sample,predsample);
if (j&1) { if (j&1) {
s->adpcmRendData[j>>1]|=encoded; s->adpcmRendData[j>>1]|=encoded;
} else { } else {