mirror of https://github.com/mgba-emu/mgba.git
GBA SIO: Fix normal mode SI/SO semantics (fixes #2925)
This commit is contained in:
parent
747158d5a6
commit
fd84ceddda
1
CHANGES
1
CHANGES
|
@ -16,6 +16,7 @@ Emulation fixes:
|
|||
- GBA Audio: Fix sample timing drifting when changing sample interval
|
||||
- GBA Audio: Fix initial channel 3 wave RAM (fixes mgba.io/i/2947)
|
||||
- GBA BIOS: Fix clobbering registers with word-sized CpuSet
|
||||
- GBA SIO: Fix normal mode SI/SO semantics (fixes mgba.io/i/2925)
|
||||
- GBA Video: Disable BG target 1 blending when OBJ blending (fixes mgba.io/i/2722)
|
||||
Other fixes:
|
||||
- Core: Fix inconsistencies with setting game-specific overrides (fixes mgba.io/i/2963)
|
||||
|
|
|
@ -127,10 +127,10 @@ bool GBASIOLockstepNodeLoad(struct GBASIODriver* driver) {
|
|||
break;
|
||||
case SIO_NORMAL_8:
|
||||
case SIO_NORMAL_32:
|
||||
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));
|
||||
if (ATOMIC_ADD(node->p->attachedNormal, 1) > node->id + 1 && node->id > 0) {
|
||||
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.p->siocnt = GBASIONormalClearSi(node->d.p->siocnt);
|
||||
}
|
||||
node->d.writeRegister = GBASIOLockstepNodeNormalWriteRegister;
|
||||
break;
|
||||
|
@ -514,20 +514,20 @@ static uint16_t GBASIOLockstepNodeNormalWriteRegister(struct GBASIODriver* drive
|
|||
int attached;
|
||||
ATOMIC_LOAD(attached, node->p->attachedNormal);
|
||||
value &= 0xFF8B;
|
||||
if (node->id < 3 && attached > node->id + 1) {
|
||||
value = GBASIONormalSetSi(value, GBASIONormalGetIdleSo(node->p->players[node->id + 1]->d.p->siocnt));
|
||||
if (node->id > 0) {
|
||||
value = GBASIONormalSetSi(value, GBASIONormalGetIdleSo(node->p->players[node->id - 1]->d.p->siocnt));
|
||||
} else {
|
||||
value = GBASIONormalFillSi(value);
|
||||
value = GBASIONormalClearSi(value);
|
||||
}
|
||||
|
||||
enum mLockstepPhase transferActive;
|
||||
ATOMIC_LOAD(transferActive, node->p->d.transferActive);
|
||||
if (node->id > 0 && transferActive == TRANSFER_IDLE) {
|
||||
if (node->id < 3 && attached > node->id + 1 && 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)))) {
|
||||
GBASIONormal nextSiocnct;
|
||||
ATOMIC_LOAD(nextSiocnct, node->p->players[node->id + 1]->d.p->siocnt);
|
||||
if (ATOMIC_CMPXCHG(node->p->players[node->id + 1]->d.p->siocnt, nextSiocnct, GBASIONormalSetSi(nextSiocnct, GBASIONormalGetIdleSo(value)))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue