X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fcommon%2Fplat_sdl.c;h=63039d4423e1fe781e1703e186a835ab732e42a9;hb=4e3551a5f617a424143aca227a2ce89cfb7d8640;hp=fc7b200e058836c481501329f9b22c8f517a11e9;hpb=eb7ce29e8dcfe0835a0b0193e99ca76f4ed6dcd1;p=picodrive.git diff --git a/platform/common/plat_sdl.c b/platform/common/plat_sdl.c index fc7b200..63039d4 100644 --- a/platform/common/plat_sdl.c +++ b/platform/common/plat_sdl.c @@ -19,7 +19,7 @@ static void *shadow_fb; -static const struct in_default_bind in_sdl_defbinds[] = { +const struct in_default_bind in_sdl_defbinds[] __attribute__((weak)) = { { SDLK_UP, IN_BINDTYPE_PLAYER12, GBTN_UP }, { SDLK_DOWN, IN_BINDTYPE_PLAYER12, GBTN_DOWN }, { SDLK_LEFT, IN_BINDTYPE_PLAYER12, GBTN_LEFT }, @@ -45,6 +45,41 @@ static const struct in_default_bind in_sdl_defbinds[] = { { 0, 0, 0 } }; +const struct menu_keymap in_sdl_key_map[] __attribute__((weak)) = +{ + { SDLK_UP, PBTN_UP }, + { SDLK_DOWN, PBTN_DOWN }, + { SDLK_LEFT, PBTN_LEFT }, + { SDLK_RIGHT, PBTN_RIGHT }, + { SDLK_RETURN, PBTN_MOK }, + { SDLK_ESCAPE, PBTN_MBACK }, + { SDLK_SEMICOLON, PBTN_MA2 }, + { SDLK_QUOTE, PBTN_MA3 }, + { SDLK_LEFTBRACKET, PBTN_L }, + { SDLK_RIGHTBRACKET, PBTN_R }, +}; + +const struct menu_keymap in_sdl_joy_map[] __attribute__((weak)) = +{ + { SDLK_UP, PBTN_UP }, + { SDLK_DOWN, PBTN_DOWN }, + { SDLK_LEFT, PBTN_LEFT }, + { SDLK_RIGHT, PBTN_RIGHT }, + /* joystick */ + { SDLK_WORLD_0, PBTN_MOK }, + { SDLK_WORLD_1, PBTN_MBACK }, + { SDLK_WORLD_2, PBTN_MA2 }, + { SDLK_WORLD_3, PBTN_MA3 }, +}; + +static const struct in_pdata in_sdl_platform_data = { + .defbinds = in_sdl_defbinds, + .key_map = in_sdl_key_map, + .kmap_size = sizeof(in_sdl_key_map) / sizeof(in_sdl_key_map[0]), + .joy_map = in_sdl_joy_map, + .jmap_size = sizeof(in_sdl_joy_map) / sizeof(in_sdl_joy_map[0]), +}; + /* YUV stuff */ static int yuv_ry[32], yuv_gy[32], yuv_by[32]; static unsigned char yuv_u[32 * 2], yuv_v[32 * 2]; @@ -241,7 +276,7 @@ void plat_init(void) g_screen_height = 240; g_screen_ptr = shadow_fb; - in_sdl_init(in_sdl_defbinds, plat_sdl_event_handler); + in_sdl_init(&in_sdl_platform_data, plat_sdl_event_handler); in_probe(); bgr_to_uyvy_init();