GBA SIO: Fix SI value for unattached MULTI mode

This commit is contained in:
Vicki Pfau 2021-06-15 20:44:24 -07:00
parent f6d5f51d23
commit aa3f4c0e6e
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,7 @@
0.9.3: (Future)
Emulation fixes:
- GBA SIO: Fix SI value for unattached MULTI mode
0.9.2: (2021-07-10)
Emulation fixes:
- GB Video: Clear VRAM on reset (fixes mgba.io/i/2152)

View File

@ -180,10 +180,14 @@ static uint16_t GBASIOLockstepNodeMultiWriteRegister(struct GBASIODriver* driver
mLOG(GBA_SIO, DEBUG, "Lockstep %i: SIOCNT <- %04X", node->id, value);
enum mLockstepPhase transferActive;
int attached;
ATOMIC_LOAD(transferActive, node->p->d.transferActive);
ATOMIC_LOAD(attached, node->p->d.attached);
driver->p->siocnt = GBASIOMultiplayerSetSlave(driver->p->siocnt, node->id || attached < 2);
if (value & 0x0080 && transferActive == TRANSFER_IDLE) {
if (!node->id && GBASIOMultiplayerIsReady(node->d.p->siocnt)) {
if (!node->id && attached > 1 && GBASIOMultiplayerIsReady(node->d.p->siocnt)) {
mLOG(GBA_SIO, DEBUG, "Lockstep %i: Transfer initiated", node->id);
ATOMIC_STORE(node->p->d.transferActive, TRANSFER_STARTING);
ATOMIC_STORE(node->p->d.transferCycles, GBASIOCyclesPerTransfer[GBASIOMultiplayerGetBaud(node->d.p->siocnt)][node->p->d.attached - 1]);