GBA SIO: Fix reseting when there are SIO devices attached
Jeffrey Pfau jeffrey@endrift.com
Sun, 16 Aug 2015 17:19:05 -0700
4 files changed,
13 insertions(+),
7 deletions(-)
M
CHANGES
→
CHANGES
@@ -74,6 +74,7 @@ - GBA Video: Fix timing on first scanline
- GBA: Ensure cycles never go negative - Util: Fix formatting of floats - Debugger: Fix use-after-free in breakpoint clearing code + - GBA SIO: Fix reseting when there are SIO devices attached Misc: - Qt: Handle saving input settings better - Debugger: Free watchpoints in addition to breakpoints
M
src/gba/gba.c
→
src/gba/gba.c
@@ -163,8 +163,7 @@ GBAVideoReset(&gba->video);
GBAAudioReset(&gba->audio); GBAIOInit(gba); - GBASIODeinit(&gba->sio); - GBASIOInit(&gba->sio); + GBASIOReset(&gba->sio); gba->timersEnabled = 0; memset(gba->timers, 0, sizeof(gba->timers));
M
src/gba/sio.c
→
src/gba/sio.c
@@ -48,14 +48,10 @@ }
} void GBASIOInit(struct GBASIO* sio) { - sio->rcnt = RCNT_INITIAL; - sio->siocnt = 0; - sio->mode = -1; - sio->activeDriver = 0; sio->drivers.normal = 0; sio->drivers.multiplayer = 0; sio->drivers.joybus = 0; - _switchMode(sio); + GBASIOReset(sio); } void GBASIODeinit(struct GBASIO* sio) {@@ -68,6 +64,15 @@ }
if (sio->drivers.joybus && sio->drivers.joybus->deinit) { sio->drivers.joybus->deinit(sio->drivers.joybus); } +} + +void GBASIOReset(struct GBASIO* sio) { + GBASIODeinit(sio); + sio->rcnt = RCNT_INITIAL; + sio->siocnt = 0; + sio->mode = -1; + sio->activeDriver = 0; + _switchMode(sio); } void GBASIOSetDriverSet(struct GBASIO* sio, struct GBASIODriverSet* drivers) {
M
src/gba/sio.h
→
src/gba/sio.h
@@ -65,6 +65,7 @@ };
void GBASIOInit(struct GBASIO* sio); void GBASIODeinit(struct GBASIO* sio); +void GBASIOReset(struct GBASIO* sio); void GBASIOSetDriverSet(struct GBASIO* sio, struct GBASIODriverSet* drivers); void GBASIOSetDriver(struct GBASIO* sio, struct GBASIODriver* driver, enum GBASIOMode mode);