all repos — mgba @ 089e692bd1f18ef4ea687606903c8bcf9098b4be

mGBA Game Boy Advance Emulator

GBA: Allow blocking of opposing directional input
Jeffrey Pfau jeffrey@endrift.com
Tue, 29 Dec 2015 22:59:36 -0500
commit

089e692bd1f18ef4ea687606903c8bcf9098b4be

parent

18e1bf742fa06c0ad76a2ef83f44132049cdd74f

3 files changed, 13 insertions(+), 0 deletions(-)

jump to
M src/gba/gba.csrc/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.hsrc/gba/gba.h

@@ -128,6 +128,7 @@ bool taintedRegisters[16];

bool realisticTiming; bool hardCrash; + bool allowOpposingDirections; }; struct GBACartridge {
M src/gba/io.csrc/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); }