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 abf0848421
commit 36e62c085d
2 changed files with 4 additions and 1 deletions

View File

@ -7,6 +7,7 @@ Features:
Emulation fixes:
- GB Audio: Fix channels 1/2 staying muted if restarted after long silence
- GB Serialize: Add missing Pocket Cam state to savestates
- GB SIO: Disabling SIO should cancel pending transfers (fixes mgba.io/i/2537)
- GB Video: Implement DMG-style sprite ordering
- GBA BIOS: Fix clobbering registers with word-sized CpuSet
- GBA Video: Disable BG target 1 blending when OBJ blending (fixes mgba.io/i/2722)

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);