GBA SIO: Some lockstep fixes

This commit is contained in:
Jeffrey Pfau 2015-06-08 22:49:15 -07:00
parent a816bd960b
commit 67072e649c
1 changed files with 6 additions and 4 deletions

View File

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