all repos — mgba @ 426993bbbb57cbcd06afd3c0ae5dc03254dff2a8

mGBA Game Boy Advance Emulator

GB I/O: Fix inverted button filter
Vicki Pfau vi@endrift.com
Sat, 29 Sep 2018 23:14:43 -0700
commit

426993bbbb57cbcd06afd3c0ae5dc03254dff2a8

parent

2865c9ab2bf454041660d04508d82b1db436c26b

1 files changed, 4 insertions(+), 5 deletions(-)

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

@@ -563,12 +563,11 @@ uint8_t keys = _readKeys(gb);

if (!gb->allowOpposingDirections && (keys & 0x30) == 0x20) { unsigned rl = keys & 0x03; unsigned ud = keys & 0x0C; - keys &= 0xF0; - if (rl != 0x03) { - keys |= rl; + if (!rl) { + keys |= 0x03; } - if (ud != 0x0C) { - keys |= ud; + if (!ud) { + keys |= 0x0C; } } return keys;