From: kub Date: Fri, 12 Jul 2024 20:57:25 +0000 (+0200) Subject: platform miyoo, switch menu key to RESET X-Git-Tag: v2.00~5 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c12b126f06818948dd89e7fd8524158582773e2a;p=picodrive.git platform miyoo, switch menu key to RESET --- diff --git a/platform/common/inputmap_kbd.c b/platform/common/inputmap_kbd.c index c41abbb3..8fbb29f8 100644 --- a/platform/common/inputmap_kbd.c +++ b/platform/common/inputmap_kbd.c @@ -7,7 +7,7 @@ #include "../common/input_pico.h" #include "../common/plat_sdl.h" -const struct in_default_bind in_sdl_defbinds[] = { +const struct in_default_bind _in_sdl_defbinds[] = { { SDLK_UP, IN_BINDTYPE_PLAYER12, GBTN_UP }, { SDLK_DOWN, IN_BINDTYPE_PLAYER12, GBTN_DOWN }, { SDLK_LEFT, IN_BINDTYPE_PLAYER12, GBTN_LEFT }, @@ -35,6 +35,7 @@ const struct in_default_bind in_sdl_defbinds[] = { { SDLK_BACKSPACE, IN_BINDTYPE_EMU, PEVB_FF }, { 0, 0, 0 } }; +const struct in_default_bind *in_sdl_defbinds = _in_sdl_defbinds; const struct menu_keymap _in_sdl_key_map[] = { { SDLK_UP, PBTN_UP }, diff --git a/platform/common/plat_sdl.c b/platform/common/plat_sdl.c index 140480e8..d1e833f3 100644 --- a/platform/common/plat_sdl.c +++ b/platform/common/plat_sdl.c @@ -26,9 +26,7 @@ static void *shadow_fb; static int shadow_size; static struct area { int w, h; } area; -static struct in_pdata in_sdl_platform_data = { - .defbinds = in_sdl_defbinds, -}; +static struct in_pdata in_sdl_platform_data; static int sound_rates[] = { 8000, 11025, 16000, 22050, 32000, 44100, 53000, -1 }; struct plat_target plat_target = { .sound_rates = sound_rates }; @@ -438,6 +436,7 @@ void plat_init(void) g_screen_ptr = shadow_fb; plat_target_setup_input(); + in_sdl_platform_data.defbinds = in_sdl_defbinds, in_sdl_platform_data.kmap_size = in_sdl_key_map_sz, in_sdl_platform_data.key_map = in_sdl_key_map, in_sdl_platform_data.jmap_size = in_sdl_joy_map_sz, diff --git a/platform/common/plat_sdl.h b/platform/common/plat_sdl.h index aefa8076..cecdb2b3 100644 --- a/platform/common/plat_sdl.h +++ b/platform/common/plat_sdl.h @@ -1,5 +1,5 @@ -extern const struct in_default_bind in_sdl_defbinds[]; +extern const struct in_default_bind *in_sdl_defbinds; extern const struct menu_keymap *in_sdl_key_map; extern const int in_sdl_key_map_sz; extern const struct menu_keymap *in_sdl_joy_map; diff --git a/platform/opendingux/inputmap.c b/platform/opendingux/inputmap.c index e8eace45..30c4639a 100644 --- a/platform/opendingux/inputmap.c +++ b/platform/opendingux/inputmap.c @@ -10,7 +10,7 @@ #include "../common/plat_sdl.h" #include "../common/emu.h" -const struct in_default_bind in_sdl_defbinds[] = { +struct in_default_bind _in_sdl_defbinds[] = { { SDLK_UP, IN_BINDTYPE_PLAYER12, GBTN_UP }, { SDLK_DOWN, IN_BINDTYPE_PLAYER12, GBTN_DOWN }, { SDLK_LEFT, IN_BINDTYPE_PLAYER12, GBTN_LEFT }, @@ -27,6 +27,7 @@ const struct in_default_bind in_sdl_defbinds[] = { { SDLK_SPACE, IN_BINDTYPE_EMU, PEVB_FF }, { 0, 0, 0 } }; +const struct in_default_bind *in_sdl_defbinds = _in_sdl_defbinds; struct menu_keymap _in_sdl_key_map[] = { { SDLK_UP, PBTN_UP }, @@ -122,6 +123,15 @@ static void keyswap(int k1, int k2) } } +static void bindswap(int k1, int k2) +{ + int i; + + for (i = 0; _in_sdl_defbinds[i].code; i++) + if (_in_sdl_defbinds[i].code == k1) + _in_sdl_defbinds[i].code = k2; +} + void plat_target_setup_input(void) { if (strcmp(plat_device, "miyoo") == 0) { @@ -129,6 +139,7 @@ void plat_target_setup_input(void) keyswap(SDLK_LALT, SDLK_LCTRL); nameswap(SDLK_LALT, SDLK_LCTRL); nameswap(SDLK_SPACE, SDLK_LSHIFT); + bindswap(SDLK_ESCAPE, SDLK_RCTRL); } else if (strcmp(plat_device, "gcw0") == 0) { /* swapped X/Y keys, single L/R keys */ nameswap(SDLK_SPACE, SDLK_LSHIFT);