mirror of https://github.com/mgba-emu/mgba.git
GBA: Allow blocking of opposing directional input
This commit is contained in:
parent
18e1bf742f
commit
089e692bd1
|
@ -101,6 +101,7 @@ static void GBAInit(struct ARMCore* cpu, struct ARMComponent* component) {
|
|||
|
||||
gba->realisticTiming = true;
|
||||
gba->hardCrash = true;
|
||||
gba->allowOpposingDirections = true;
|
||||
|
||||
gba->performingDMA = false;
|
||||
|
||||
|
|
|
@ -128,6 +128,7 @@ struct GBA {
|
|||
|
||||
bool realisticTiming;
|
||||
bool hardCrash;
|
||||
bool allowOpposingDirections;
|
||||
};
|
||||
|
||||
struct GBACartridge {
|
||||
|
|
11
src/gba/io.c
11
src/gba/io.c
|
@ -674,6 +674,17 @@ uint16_t GBAIORead(struct GBA* gba, uint32_t address) {
|
|||
} 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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue