GBA: Allow blocking of opposing directional input
Jeffrey Pfau jeffrey@endrift.com
Tue, 29 Dec 2015 22:59:36 -0500
3 files changed,
13 insertions(+),
0 deletions(-)
M
src/gba/gba.c
→
src/gba/gba.c
@@ -101,6 +101,7 @@ gba->idleLoop = IDLE_LOOP_NONE;
gba->realisticTiming = true; gba->hardCrash = true; + gba->allowOpposingDirections = true; gba->performingDMA = false;
M
src/gba/gba.h
→
src/gba/gba.h
@@ -128,6 +128,7 @@ bool taintedRegisters[16];
bool realisticTiming; bool hardCrash; + bool allowOpposingDirections; }; struct GBACartridge {
M
src/gba/io.c
→
src/gba/io.c
@@ -674,6 +674,17 @@ input = gba->keyCallback->readKeys(gba->keyCallback);
} else if (gba->keySource) { input = *gba->keySource; } + if (!gba->allowOpposingDirections) { + unsigned rl = input & 0x030; + unsigned ud = input & 0x0C0; + input &= 0x30F; + if (rl != 0x030) { + input |= rl; + } + if (ud != 0x0C0) { + input |= ud; + } + } if (gba->rr && gba->rr->isRecording(gba->rr)) { gba->rr->logInput(gba->rr, input); }