all repos — mgba @ 67072e649ca12ccf8e60e0b76d9c7f21a657a644

mGBA Game Boy Advance Emulator

GBA SIO: Some lockstep fixes
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Jun 2015 22:49:15 -0700
commit

67072e649ca12ccf8e60e0b76d9c7f21a657a644

parent

a816bd960b4cb4fcdf0a8811bccd036ae59a6b88

1 files changed, 6 insertions(+), 4 deletions(-)

jump to
M src/gba/sio/lockstep.csrc/gba/sio/lockstep.c

@@ -118,17 +118,19 @@ struct GBASIOLockstepNode* node = (struct GBASIOLockstepNode*) driver;

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 @@ node->d.p->p->memory.io[REG_SIOMULTI1 >> 1] = 0xFFFF;

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