GBA: Allow blocking of opposing directional input

This commit is contained in:
Jeffrey Pfau 2015-12-29 22:59:36 -05:00
parent 18e1bf742f
commit 089e692bd1
3 changed files with 13 additions and 0 deletions

View File

@ -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;

View File

@ -128,6 +128,7 @@ struct GBA {
bool realisticTiming;
bool hardCrash;
bool allowOpposingDirections;
};
struct GBACartridge {

View File

@ -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);
}