GB: Fix SGB controller incrementing

This commit is contained in:
Vicki Pfau 2019-09-02 21:36:40 -07:00
parent 74e09675ce
commit 22c55f21dc
3 changed files with 5 additions and 8 deletions

View File

@ -55,7 +55,7 @@ Other fixes:
- GBA Cheats: Fix value incrementing in CB slide codes (fixes mgba.io/i/1501)
- Qt: Only show emulator restart warning once per settings saving
- Qt: Improve cheat view UX
- GB: Fix SGB controller selection initialization (fixes mgba.io/i/1104)
- GB: Fix SGB controller incrementing (fixes mgba.io/i/1104)
Misc:
- GBA Savedata: EEPROM performance fixes
- GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash

View File

@ -435,7 +435,7 @@ void GBReset(struct LR35902Core* cpu) {
gb->sgbBit = -1;
gb->sgbControllers = 0;
gb->sgbCurrentController = 3;
gb->sgbCurrentController = 0;
gb->currentSgbBits = 0;
memset(gb->sgbPacket, 0, sizeof(gb->sgbPacket));

View File

@ -119,14 +119,11 @@ static void _writeSGBBits(struct GB* gb, int bits) {
if (gb->sgbBit > 128) {
switch (bits) {
case 1:
gb->sgbBit |= 2;
break;
case 2:
gb->sgbBit |= 4;
gb->sgbBit ^= 2;
break;
case 3:
if (gb->sgbBit == 135) {
gb->sgbBit &= ~6;
if (gb->sgbBit == 131) {
gb->sgbBit &= ~2;
gb->sgbCurrentController = (gb->sgbCurrentController + 1) & gb->sgbControllers;
}
break;