all repos — mgba @ e9251485738cb488f384ed491f94249d22038065

mGBA Game Boy Advance Emulator

GB: Yet more SGB cleanup
Vicki Pfau vi@endrift.com
Fri, 06 Sep 2019 19:22:18 -0700
commit

e9251485738cb488f384ed491f94249d22038065

parent

34529398bb1da3cc1e0277d05d9e4902bdb39249

2 files changed, 6 insertions(+), 3 deletions(-)

jump to
M src/gb/io.csrc/gb/io.c

@@ -115,10 +115,12 @@ }

if (bits == gb->currentSgbBits) { return; } - gb->currentSgbBits = bits; switch (bits) { + case 0: case 1: - gb->sgbIncrement = !gb->sgbIncrement; + if (gb->currentSgbBits & 2) { + gb->sgbIncrement = !gb->sgbIncrement; + } break; case 3: if (gb->sgbIncrement) {

@@ -127,6 +129,7 @@ gb->sgbCurrentController = (gb->sgbCurrentController + 1) & gb->sgbControllers;

} break; } + gb->currentSgbBits = bits; if (gb->sgbBit == 128 && bits == 2) { GBVideoWriteSGBPacket(&gb->video, gb->sgbPacket); ++gb->sgbBit;
M src/gb/video.csrc/gb/video.c

@@ -702,7 +702,7 @@ case SGB_ATTR_SET:

break; case SGB_MLT_REQ: video->p->sgbControllers = video->sgbPacketBuffer[1] & 0x3; - video->p->sgbCurrentController = 0; + video->p->sgbCurrentController &= video->p->sgbControllers; return; case SGB_MASK_EN: video->renderer->sgbRenderMode = video->sgbPacketBuffer[1] & 0x3;