OPLL: fix possible overflow
This commit is contained in:
parent
1ac19ed61f
commit
89e057a2ba
|
|
@ -248,6 +248,7 @@ void DivPlatformOPLL::tick(bool sysTick) {
|
||||||
if (chan[i].freq<0) chan[i].freq=0;
|
if (chan[i].freq<0) chan[i].freq=0;
|
||||||
if (chan[i].freq>65535) chan[i].freq=65535;
|
if (chan[i].freq>65535) chan[i].freq=65535;
|
||||||
int freqt=toFreq(chan[i].freq);
|
int freqt=toFreq(chan[i].freq);
|
||||||
|
if (freqt>2047) freqt=2047;
|
||||||
chan[i].freqL=freqt&0xff;
|
chan[i].freqL=freqt&0xff;
|
||||||
if (i>=6 && properDrums && (i<9 || !noTopHatFreq)) {
|
if (i>=6 && properDrums && (i<9 || !noTopHatFreq)) {
|
||||||
immWrite(0x10+drumSlot[i],freqt&0xff);
|
immWrite(0x10+drumSlot[i],freqt&0xff);
|
||||||
|
|
@ -257,7 +258,7 @@ void DivPlatformOPLL::tick(bool sysTick) {
|
||||||
immWrite(0x10+i,freqt&0xff);
|
immWrite(0x10+i,freqt&0xff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[i].freqH=freqt>>8;
|
chan[i].freqH=(freqt>>8)&15;
|
||||||
}
|
}
|
||||||
if (chan[i].keyOn && i>=6 && properDrums) {
|
if (chan[i].keyOn && i>=6 && properDrums) {
|
||||||
if (!isMuted[i]) {
|
if (!isMuted[i]) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue