mirror of https://github.com/mgba-emu/mgba.git
GBA SIO: Fix unconnected normal mode SIOCNT SI bit (fixes #2810)
This commit is contained in:
parent
4e85de3a42
commit
f046596ca7
1
CHANGES
1
CHANGES
|
@ -7,6 +7,7 @@ Emulation fixes:
|
||||||
- GBA Audio: Fix improperly deserializing GB audio registers (fixes mgba.io/i/2793)
|
- GBA Audio: Fix improperly deserializing GB audio registers (fixes mgba.io/i/2793)
|
||||||
- GBA Memory: Make VRAM access stalls only apply to BG RAM
|
- GBA Memory: Make VRAM access stalls only apply to BG RAM
|
||||||
- GBA SIO: Fix SIOCNT SI pin value after attaching player 2 (fixes mgba.io/i/2805)
|
- GBA SIO: Fix SIOCNT SI pin value after attaching player 2 (fixes mgba.io/i/2805)
|
||||||
|
- GBA SIO: Fix unconnected normal mode SIOCNT SI bit (fixes mgba.io/i/2810)
|
||||||
- GBA Timers: Cascading timers don't tick when disabled (fixes mgba.io/i/2812)
|
- GBA Timers: Cascading timers don't tick when disabled (fixes mgba.io/i/2812)
|
||||||
- GBA Video: Disable BG target 1 blending when OBJ blending (fixes mgba.io/i/2722)
|
- GBA Video: Disable BG target 1 blending when OBJ blending (fixes mgba.io/i/2722)
|
||||||
Other fixes:
|
Other fixes:
|
||||||
|
|
|
@ -127,7 +127,11 @@ bool GBASIOLockstepNodeLoad(struct GBASIODriver* driver) {
|
||||||
break;
|
break;
|
||||||
case SIO_NORMAL_8:
|
case SIO_NORMAL_8:
|
||||||
case SIO_NORMAL_32:
|
case SIO_NORMAL_32:
|
||||||
ATOMIC_ADD(node->p->attachedNormal, 1);
|
if (ATOMIC_ADD(node->p->attachedNormal, 1) > node->id + 1 && node->id < 3) {
|
||||||
|
node->d.p->siocnt = GBASIONormalSetSi(node->d.p->siocnt, GBASIONormalGetIdleSo(node->p->players[node->id + 1]->d.p->siocnt));
|
||||||
|
} else {
|
||||||
|
node->d.p->siocnt = GBASIONormalFillSi(node->d.p->siocnt);
|
||||||
|
}
|
||||||
node->d.writeRegister = GBASIOLockstepNodeNormalWriteRegister;
|
node->d.writeRegister = GBASIOLockstepNodeNormalWriteRegister;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -507,9 +511,26 @@ static uint16_t GBASIOLockstepNodeNormalWriteRegister(struct GBASIODriver* drive
|
||||||
|
|
||||||
if (address == REG_SIOCNT) {
|
if (address == REG_SIOCNT) {
|
||||||
mLOG(GBA_SIO, DEBUG, "Lockstep %i: SIOCNT <- %04X", node->id, value);
|
mLOG(GBA_SIO, DEBUG, "Lockstep %i: SIOCNT <- %04X", node->id, value);
|
||||||
|
int attached;
|
||||||
|
ATOMIC_LOAD(attached, node->p->attachedNormal);
|
||||||
value &= 0xFF8B;
|
value &= 0xFF8B;
|
||||||
if (!node->id) {
|
if (node->id < 3 && attached > node->id + 1) {
|
||||||
value = GBASIONormalClearSi(value);
|
value = GBASIONormalSetSi(value, GBASIONormalGetIdleSo(node->p->players[node->id + 1]->d.p->siocnt));
|
||||||
|
} else {
|
||||||
|
value = GBASIONormalFillSi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum mLockstepPhase transferActive;
|
||||||
|
ATOMIC_LOAD(transferActive, node->p->d.transferActive);
|
||||||
|
if (node->id > 0 && transferActive == TRANSFER_IDLE) {
|
||||||
|
int try;
|
||||||
|
for (try = 0; try < 3; ++try) {
|
||||||
|
GBASIONormal parentSiocnt;
|
||||||
|
ATOMIC_LOAD(parentSiocnt, node->p->players[node->id - 1]->d.p->siocnt);
|
||||||
|
if (ATOMIC_CMPXCHG(node->p->players[node->id - 1]->d.p->siocnt, parentSiocnt, GBASIONormalSetSi(parentSiocnt, GBASIONormalGetIdleSo(value)))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (value & 0x0080) {
|
if (value & 0x0080) {
|
||||||
if (!node->id) {
|
if (!node->id) {
|
||||||
|
@ -524,9 +545,6 @@ static uint16_t GBASIOLockstepNodeNormalWriteRegister(struct GBASIODriver* drive
|
||||||
cycles *= 4;
|
cycles *= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum mLockstepPhase transferActive;
|
|
||||||
ATOMIC_LOAD(transferActive, node->p->d.transferActive);
|
|
||||||
|
|
||||||
if (transferActive == TRANSFER_IDLE) {
|
if (transferActive == TRANSFER_IDLE) {
|
||||||
mLOG(GBA_SIO, DEBUG, "Lockstep %i: Transfer initiated", node->id);
|
mLOG(GBA_SIO, DEBUG, "Lockstep %i: Transfer initiated", node->id);
|
||||||
ATOMIC_STORE(node->p->d.transferActive, TRANSFER_STARTING);
|
ATOMIC_STORE(node->p->d.transferActive, TRANSFER_STARTING);
|
||||||
|
|
Loading…
Reference in New Issue