GB SIO: Disabling SIO should cancel pending transfers (fixes #2537)

This commit is contained in:
Vicki Pfau 2023-05-08 04:42:08 -07:00
parent 21cfb15f99
commit 84d600cba6
2 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
0.10.3: (Future)
Emulation fixes:
- GB Audio: Fix channels 1/2 staying muted if restarted after long silence
- GB SIO: Disabling SIO should cancel pending transfers (fixes mgba.io/i/2537)
- GBA BIOS: Fix clobbering registers with word-sized CpuSet
0.10.2: (2023-04-23)

View File

@ -91,11 +91,13 @@ void GBSIOWriteSB(struct GBSIO* sio, uint8_t sb) {
void GBSIOWriteSC(struct GBSIO* sio, uint8_t sc) {
sio->period = GBSIOCyclesPerTransfer[GBRegisterSCGetClockSpeed(sc)]; // TODO Shift Clock
if (GBRegisterSCIsEnable(sc)) {
mTimingDeschedule(&sio->p->timing, &sio->event);
if (GBRegisterSCIsShiftClock(sc)) {
mTimingDeschedule(&sio->p->timing, &sio->event);
mTimingSchedule(&sio->p->timing, &sio->event, sio->period * (2 - sio->p->doubleSpeed));
sio->remainingBits = 8;
}
} else {
mTimingDeschedule(&sio->p->timing, &sio->event);
}
if (sio->driver) {
sio->driver->writeSC(sio->driver, sc);