From 773151638842e8a91cf0f4b2661322719fc3abb9 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 24 Apr 2018 21:31:53 -0700 Subject: [PATCH] GB I/O: SGB multiplayer cleanup (fixes #1067) --- src/gb/io.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gb/io.c b/src/gb/io.c index d66df3030..62f8e5b32 100644 --- a/src/gb/io.c +++ b/src/gb/io.c @@ -113,10 +113,6 @@ static void _writeSGBBits(struct GB* gb, int bits) { return; } gb->currentSgbBits = bits; - if (gb->sgbBit == 128 && bits == 2) { - GBVideoWriteSGBPacket(&gb->video, gb->sgbPacket); - ++gb->sgbBit; - } if (gb->sgbBit > 128) { switch (bits) { case 1: @@ -126,13 +122,17 @@ static void _writeSGBBits(struct GB* gb, int bits) { gb->sgbBit |= 4; break; case 3: - if (gb->sgbBit == 135 && bits == 3 && !(gb->video.sgbCommandHeader & 7)) { + if (gb->sgbBit == 135) { gb->sgbBit &= ~6; gb->sgbCurrentController = (gb->sgbCurrentController + 1) & gb->sgbControllers; } break; } } + if (gb->sgbBit == 128 && bits == 2) { + GBVideoWriteSGBPacket(&gb->video, gb->sgbPacket); + ++gb->sgbBit; + } if (gb->sgbBit >= 128) { return; } @@ -524,7 +524,7 @@ static uint8_t _readKeys(struct GB* gb) { } switch (gb->memory.io[REG_JOYP] & 0x30) { case 0x30: - keys = 0xF - gb->sgbCurrentController; + keys = gb->sgbCurrentController; break; case 0x20: keys >>= 4;