GB: SGB controller cleanup

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

View File

@ -532,13 +532,13 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
static uint8_t _readKeys(struct GB* gb) {
uint8_t keys = *gb->keySource;
if (gb->sgbCurrentController & gb->sgbControllers) {
if (gb->sgbCurrentController != 0) {
keys = 0;
}
uint8_t joyp = gb->memory.io[REG_JOYP];
switch (joyp & 0x30) {
case 0x30:
keys = gb->sgbCurrentController & gb->sgbControllers;
keys = gb->sgbCurrentController;
break;
case 0x20:
keys >>= 4;

View File

@ -702,7 +702,7 @@ void GBVideoWriteSGBPacket(struct GBVideo* video, uint8_t* data) {
break;
case SGB_MLT_REQ:
video->p->sgbControllers = video->sgbPacketBuffer[1] & 0x3;
video->p->sgbCurrentController &= video->p->sgbControllers;
video->p->sgbCurrentController = 0;
return;
case SGB_MASK_EN:
video->renderer->sgbRenderMode = video->sgbPacketBuffer[1] & 0x3;