GB I/O: Fix incrementing SGB controller when P14 is low (fixes #2202)

This commit is contained in:
Vicki Pfau 2021-09-05 12:20:46 -07:00
parent 59939d3241
commit c5c6948653
2 changed files with 6 additions and 9 deletions

View File

@ -1,5 +1,6 @@
0.9.3: (Future)
Emulation fixes:
- GB I/O: Fix incrementing SGB controller when P14 is low (fixes mgba.io/i/2202)
- GB Video: Render SGB border when unmasking with ATTR/PAL_SET (fixes mgba.io/i/2261)
- GBA SIO: Fix SI value for unattached MULTI mode
- GBA Video: Fix backdrop color if DISPCNT is first set to 0 (fixes mgba.io/i/2260)

View File

@ -119,19 +119,15 @@ static void _writeSGBBits(struct GB* gb, int bits) {
if (bits == gb->currentSgbBits) {
return;
}
switch (bits) {
case 0:
case 1:
if (gb->currentSgbBits & 2) {
gb->sgbIncrement = !gb->sgbIncrement;
}
break;
case 3:
if (bits & 2) {
if (gb->sgbIncrement) {
gb->sgbIncrement = false;
gb->sgbCurrentController = (gb->sgbCurrentController + 1) & gb->sgbControllers;
}
break;
} else {
if (gb->currentSgbBits & 2) {
gb->sgbIncrement = !gb->sgbIncrement;
}
}
gb->currentSgbBits = bits;
if (gb->sgbBit == 128 && bits == 2) {