From 67072e649ca12ccf8e60e0b76d9c7f21a657a644 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Mon, 8 Jun 2015 22:49:15 -0700 Subject: [PATCH] GBA SIO: Some lockstep fixes --- src/gba/sio/lockstep.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gba/sio/lockstep.c b/src/gba/sio/lockstep.c index d8efe3390..319be8c94 100644 --- a/src/gba/sio/lockstep.c +++ b/src/gba/sio/lockstep.c @@ -118,17 +118,19 @@ static uint16_t GBASIOLockstepNodeWriteRegister(struct GBASIODriver* driver, uin if (address == REG_SIOCNT) { GBALog(node->d.p->p, GBA_LOG_SIO, "Lockstep %i: SIOCNT <- %04x", node->id, value); if (value & 0x0080) { - value &= ~0x0080; if (!node->id) { GBALog(node->d.p->p, GBA_LOG_SIO, "Lockstep %i: Transfer initiated", node->id); MutexLock(&node->p->mutex); node->p->transferActive = true; node->p->transferCycles = GBASIOCyclesPerTransfer[node->d.p->multiplayerControl.baud][node->p->attached - 1]; + node->multiSend = node->d.p->p->memory.io[REG_SIOMLT_SEND >> 1]; MutexUnlock(&node->p->mutex); + } else { + value &= ~0x0080; } } - value &= 0xFF03; - value |= driver->p->siocnt & 0x007C; + value &= 0xFF83; + value |= driver->p->siocnt & 0x00FC; } else if (address == REG_SIOMLT_SEND) { GBALog(node->d.p->p, GBA_LOG_SIO, "Lockstep %i: SIOMLT_SEND <- %04x", node->id, value); } @@ -186,8 +188,8 @@ static int32_t GBASIOLockstepNodeProcessEvents(struct GBASIODriver* driver, int3 node->d.p->p->memory.io[REG_SIOMULTI2 >> 1] = 0xFFFF; node->d.p->p->memory.io[REG_SIOMULTI3 >> 1] = 0xFFFF; node->d.p->rcnt &= ~1; - node->multiSend = node->d.p->p->memory.io[REG_SIOMLT_SEND >> 1]; if (node->id) { + node->multiSend = node->d.p->p->memory.io[REG_SIOMLT_SEND >> 1]; node->d.p->multiplayerControl.busy = 1; } }