bring crash fix from 0.5.8

This commit is contained in:
tildearrow 2022-02-24 22:52:20 -05:00
parent dee74e7b14
commit 19c4f5559a
11 changed files with 33 additions and 25 deletions

View file

@ -89,7 +89,7 @@ void DivPlatformGenesis::acquire_nuked(short* bufL, short* bufR, size_t start, s
if (dacMode && dacSample!=-1) {
dacPeriod-=6;
if (dacPeriod<1) {
DivSample* s=parent->song.sample[dacSample];
DivSample* s=parent->getSample(dacSample);
if (s->samples>0) {
if (!isMuted[5]) {
immWrite(0x2a,(unsigned char)s->data8[dacPos]+0x80);
@ -159,7 +159,7 @@ void DivPlatformGenesis::acquire_ymfm(short* bufL, short* bufR, size_t start, si
if (dacMode && dacSample!=-1) {
dacPeriod-=24;
if (dacPeriod<1) {
DivSample* s=parent->song.sample[dacSample];
DivSample* s=parent->getSample(dacSample);
if (s->samples>0) {
if (!isMuted[5]) {
immWrite(0x2a,(unsigned char)s->data8[dacPos]+0x80);
@ -373,7 +373,7 @@ void DivPlatformGenesis::tick() {
if (chan[i].furnaceDac && dacMode) {
double off=1.0;
if (dacSample>=0 && dacSample<parent->song.sampleLen) {
DivSample* s=parent->song.sample[dacSample];
DivSample* s=parent->getSample(dacSample);
if (s->centerRate<1) {
off=1.0;
} else {
@ -510,8 +510,8 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
}
dacPos=0;
dacPeriod=0;
dacRate=1280000/MAX(1,parent->song.sample[dacSample]->rate);
if (dumpWrites) addWrite(0xffff0001,parent->song.sample[dacSample]->rate);
dacRate=1280000/MAX(1,parent->getSample(dacSample)->rate);
if (dumpWrites) addWrite(0xffff0001,parent->getSample(dacSample)->rate);
chan[c.chan].furnaceDac=false;
}
break;