all repos — mgba @ 401bc9e9d632869c25072694b3c491f86e93ba8c

mGBA Game Boy Advance Emulator

GBA SIO: Fix reseting when there are SIO devices attached
Jeffrey Pfau jeffrey@endrift.com
Sun, 16 Aug 2015 17:19:05 -0700
commit

401bc9e9d632869c25072694b3c491f86e93ba8c

parent

615ab298d196efb5e9311101fd8687bbce2727c5

4 files changed, 13 insertions(+), 7 deletions(-)

jump to
M CHANGESCHANGES

@@ -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.csrc/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.csrc/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.hsrc/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);