all repos — mgba @ 0425fa805c464ed8bae501039738ab051b0d0b39

mGBA Game Boy Advance Emulator

Core: Add keysRead callback
Vicki Pfau vi@endrift.com
Fri, 08 Mar 2019 09:55:51 -0800
commit

0425fa805c464ed8bae501039738ab051b0d0b39

parent

4aff3016384eb379c580d1276b616d1d2ec60a7b

4 files changed, 20 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -26,6 +26,7 @@ - Qt: Add missing HEVC NVENC option (fixes mgba.io/i/1323)

- LR35902: Support PC-relative opcode decoding - Qt: Improve camera initialization - Qt: Support switching webcams + - Core: Add keysRead callback 0.7.1: (2019-02-24) Bugfixes:
M include/mgba/core/interface.hinclude/mgba/core/interface.h

@@ -86,6 +86,7 @@ void (*videoFrameStarted)(void* context);

void (*videoFrameEnded)(void* context); void (*coreCrashed)(void* context); void (*sleep)(void* context); + void (*keysRead)(void* context); }; DECLARE_VECTOR(mCoreCallbacksList, struct mCoreCallbacks);
M src/gb/io.csrc/gb/io.c

@@ -576,6 +576,15 @@

uint8_t GBIORead(struct GB* gb, unsigned address) { switch (address) { case REG_JOYP: + { + size_t c; + for (c = 0; c < mCoreCallbacksListSize(&gb->coreCallbacks); ++c) { + struct mCoreCallbacks* callbacks = mCoreCallbacksListGetPointer(&gb->coreCallbacks, c); + if (callbacks->keysRead) { + callbacks->keysRead(callbacks->context); + } + } + } return _readKeysFiltered(gb); case REG_IE: return gb->memory.ie;
M src/gba/io.csrc/gba/io.c

@@ -725,6 +725,15 @@ GBATimerUpdateRegister(gba, 3, 4);

break; case REG_KEYINPUT: + { + size_t c; + for (c = 0; c < mCoreCallbacksListSize(&gba->coreCallbacks); ++c) { + struct mCoreCallbacks* callbacks = mCoreCallbacksListGetPointer(&gba->coreCallbacks, c); + if (callbacks->keysRead) { + callbacks->keysRead(callbacks->context); + } + } + } if (gba->rr && gba->rr->isPlaying(gba->rr)) { return 0x3FF ^ gba->rr->queryInput(gba->rr); } else {