GBA: Fix keypad IRQs not firing when extra buttons are pressed

This commit is contained in:
Vicki Pfau 2017-09-17 16:46:10 -07:00
parent 8d1b41f695
commit 1bc6c13e6b
3 changed files with 3 additions and 5 deletions

View File

@ -39,6 +39,7 @@ Bugfixes:
- GBA BIOS: Use core's VRAM variable instead of renderer's
- GBA Savedata: Fix 512 byte EEPROM saving as 8kB (fixes mgba.io/i/877)
- SDL: Fix potential race condition when pressing keys (fixes mgba.io/i/872)
- GBA: Fix keypad IRQs not firing when extra buttons are pressed
Misc:
- GBA Timer: Use global cycles for timers
- GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)

View File

@ -491,7 +491,6 @@ static void _GBACoreAddKeys(struct mCore* core, uint32_t keys) {
static void _GBACoreClearKeys(struct mCore* core, uint32_t keys) {
struct GBACore* gbacore = (struct GBACore*) core;
gbacore->keys &= ~keys;
GBATestKeypadIRQ(core->board);
}
static int32_t _GBACoreFrameCounter(const struct mCore* core) {

View File

@ -755,19 +755,17 @@ void GBATestKeypadIRQ(struct GBA* gba) {
return;
}
int isAnd = keycnt & 0x8000;
uint16_t keyInput;
if (!gba->keySource) {
// TODO?
return;
}
keycnt &= 0x3FF;
keyInput = *gba->keySource;
uint16_t keyInput = *gba->keySource & keycnt;
if (isAnd && keycnt == keyInput) {
GBARaiseIRQ(gba, IRQ_KEYPAD);
} else if (!isAnd && keycnt & keyInput) {
} else if (!isAnd && keyInput) {
GBARaiseIRQ(gba, IRQ_KEYPAD);
}
}