all repos — mgba @ 126afa12d9ac4bbbc1d2db423aafb6ccf6dcf5a1

mGBA Game Boy Advance Emulator

GB: Implement keypad IRQs
Vicki Pfau vi@endrift.com
Sun, 11 Jun 2017 14:51:48 -0700
commit

126afa12d9ac4bbbc1d2db423aafb6ccf6dcf5a1

parent

1dcf70d6d3eb2d08651c73c55613f5524158f395

5 files changed, 14 insertions(+), 1 deletions(-)

jump to
M CHANGESCHANGES

@@ -21,7 +21,7 @@ - Library view

- Debugger: Segment/bank support - GB: Symbol table support - GB MBC: Add MBC1 multicart support - - GBA: Implement keypad interrupts + - Implement keypad interrupts - LR35902: Watchpoints - Memory search - Debugger: Execution tracing
M include/mgba/internal/gb/gb.hinclude/mgba/internal/gb/gb.h

@@ -139,6 +139,8 @@ bool GBIsROM(struct VFile* vf);

void GBGetGameTitle(const struct GB* gba, char* out); void GBGetGameCode(const struct GB* gba, char* out); +void GBTestKeypadIRQ(struct GB* gb); + void GBFrameEnded(struct GB* gb); CXX_GUARD_END
M src/gb/core.csrc/gb/core.c

@@ -432,11 +432,13 @@

static void _GBCoreSetKeys(struct mCore* core, uint32_t keys) { struct GBCore* gbcore = (struct GBCore*) core; gbcore->keys = keys; + GBTestKeypadIRQ(core->board); } static void _GBCoreAddKeys(struct mCore* core, uint32_t keys) { struct GBCore* gbcore = (struct GBCore*) core; gbcore->keys |= keys; + GBTestKeypadIRQ(core->board); } static void _GBCoreClearKeys(struct mCore* core, uint32_t keys) {
M src/gb/gb.csrc/gb/gb.c

@@ -710,4 +710,6 @@ struct mCheatSet* cheats = *mCheatSetsGetPointer(&device->cheats, i);

mCheatRefresh(device, cheats); } } + + GBTestKeypadIRQ(gb); }
M src/gb/io.csrc/gb/io.c

@@ -564,6 +564,13 @@ success:

return gb->memory.io[address] | _registerMask[address]; } +void GBTestKeypadIRQ(struct GB* gb) { + if (_readKeys(gb)) { + gb->memory.io[REG_IF] |= (1 << GB_IRQ_KEYPAD); + GBUpdateIRQs(gb); + } +} + struct GBSerializedState; void GBIOSerialize(const struct GB* gb, struct GBSerializedState* state) { memcpy(state->io, gb->memory.io, GB_SIZE_IO);