From c75224ce8cb68de4f10b8695eaa7372fb10a5f26 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 17 Mar 2015 22:30:58 -0700 Subject: [PATCH] SDL: Add Pandora bindings --- CMakeLists.txt | 6 +++++- src/platform/sdl/sdl-events.c | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a286b79e..02c930abc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,12 +136,16 @@ if(APPLE OR CMAKE_C_COMPILER_ID STREQUAL "GNU" AND BUILD_LTO) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto") endif() -if(BUILD_BBB OR BUILD_RASPI) +if(BUILD_BBB OR BUILD_RASPI OR BUILD_PANDORA) if(NOT BUILD_EGL) add_definitions(-DCOLOR_16_BIT -DCOLOR_5_6_5) endif() endif() +if(BUILD_PANDORA) + add_definitions(-DBUILD_PANDORA) +endif() + if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm.*") enable_language(ASM) endif() diff --git a/src/platform/sdl/sdl-events.c b/src/platform/sdl/sdl-events.c index 49903f09c..030988d74 100644 --- a/src/platform/sdl/sdl-events.c +++ b/src/platform/sdl/sdl-events.c @@ -35,7 +35,18 @@ bool GBASDLInitEvents(struct GBASDLEvents* context) { } void GBASDLInitBindings(struct GBAInputMap* inputMap) { -#if SDL_VERSION_ATLEAST(2, 0, 0) +#ifdef BUILD_PANDORA + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_PAGEDOWN, GBA_KEY_A); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_END, GBA_KEY_B); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_RSHIFT, GBA_KEY_L); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_RCTRL, GBA_KEY_R); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_LALT, GBA_KEY_START); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_LCTRL, GBA_KEY_SELECT); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_UP, GBA_KEY_UP); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_DOWN, GBA_KEY_DOWN); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_LEFT, GBA_KEY_LEFT); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_RIGHT, GBA_KEY_RIGHT); +#elif SDL_VERSION_ATLEAST(2, 0, 0) GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDL_SCANCODE_X, GBA_KEY_A); GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDL_SCANCODE_Z, GBA_KEY_B); GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDL_SCANCODE_A, GBA_KEY_L); @@ -105,7 +116,7 @@ static void _pauseAfterFrame(struct GBAThread* context) { static void _GBASDLHandleKeypress(struct GBAThread* context, struct GBASDLEvents* sdlContext, const struct SDL_KeyboardEvent* event) { enum GBAKey key = GBA_KEY_NONE; if (!event->keysym.mod) { -#if SDL_VERSION_ATLEAST(2, 0, 0) +#if !defined(BUILD_PANORA) && SDL_VERSION_ATLEAST(2, 0, 0) key = GBAInputMapKey(sdlContext->bindings, SDL_BINDING_KEY, event->keysym.scancode); #else key = GBAInputMapKey(sdlContext->bindings, SDL_BINDING_KEY, event->keysym.sym);