GBA SIO: Fix reseting when there are SIO devices attached

This commit is contained in:
Jeffrey Pfau 2015-08-16 17:19:05 -07:00
parent 615ab298d1
commit 401bc9e9d6
4 changed files with 13 additions and 7 deletions

View File

@ -74,6 +74,7 @@ Bugfixes:
- 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

View File

@ -163,8 +163,7 @@ void GBAReset(struct ARMCore* cpu) {
GBAAudioReset(&gba->audio);
GBAIOInit(gba);
GBASIODeinit(&gba->sio);
GBASIOInit(&gba->sio);
GBASIOReset(&gba->sio);
gba->timersEnabled = 0;
memset(gba->timers, 0, sizeof(gba->timers));

View File

@ -48,14 +48,10 @@ static void _switchMode(struct GBASIO* sio) {
}
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) {
@ -70,6 +66,15 @@ void GBASIODeinit(struct GBASIO* sio) {
}
}
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) {
GBASIOSetDriver(sio, drivers->normal, SIO_NORMAL_8);
GBASIOSetDriver(sio, drivers->multiplayer, SIO_MULTI);

View File

@ -65,6 +65,7 @@ struct GBASIO {
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);