all repos — mgba @ 629196e7a10942046455347c7469d6d42ea82dc9

mGBA Game Boy Advance Emulator

SDL: Load SDLK and SDLB input maps
Jeffrey Pfau jeffrey@endrift.com
Mon, 03 Nov 2014 23:28:33 -0800
commit

629196e7a10942046455347c7469d6d42ea82dc9

parent

3e75a8e3fe937f6d003c80f2d495f3c09a7cd9cb

3 files changed, 10 insertions(+), 0 deletions(-)

jump to
M src/platform/sdl/gl-main.csrc/platform/sdl/gl-main.c

@@ -119,6 +119,7 @@ GBASDLInitAudio(&renderer.audio);

renderer.events.bindings = &context.inputMap; GBASDLInitEvents(&renderer.events); + GBASDLEventsLoadConfig(&renderer.events, &config); GBAThreadStart(&context);
M src/platform/sdl/sdl-events.csrc/platform/sdl/sdl-events.c

@@ -45,7 +45,13 @@ GBAInputBindKey(context->bindings, SDL_BINDING_BUTTON, 4, GBA_KEY_UP);

GBAInputBindKey(context->bindings, SDL_BINDING_BUTTON, 6, GBA_KEY_DOWN); GBAInputBindKey(context->bindings, SDL_BINDING_BUTTON, 7, GBA_KEY_LEFT); GBAInputBindKey(context->bindings, SDL_BINDING_BUTTON, 5, GBA_KEY_RIGHT); + return true; +} + +void GBASDLEventsLoadConfig(struct GBASDLEvents* context, const struct Configuration* config) { + GBAInputMapLoad(context->bindings, SDL_BINDING_KEY, config); + GBAInputMapLoad(context->bindings, SDL_BINDING_BUTTON, config); } void GBASDLDeinitEvents(struct GBASDLEvents* context) {
M src/platform/sdl/sdl-events.hsrc/platform/sdl/sdl-events.h

@@ -11,6 +11,7 @@ #define SDL_BINDING_KEY 0x53444C4B

#define SDL_BINDING_BUTTON 0x53444C42 struct GBAVideoSoftwareRenderer; +struct Configuration; struct GBASDLEvents { struct GBAInputMap* bindings;

@@ -24,6 +25,8 @@ };

bool GBASDLInitEvents(struct GBASDLEvents*); void GBASDLDeinitEvents(struct GBASDLEvents*); + +void GBASDLEventsLoadConfig(struct GBASDLEvents*, const struct Configuration*); void GBASDLHandleEvent(struct GBAThread* context, struct GBASDLEvents* sdlContext, const union SDL_Event* event);