platform miyoo, switch menu key to RESET

This commit is contained in:
kub 2024-07-12 22:57:25 +02:00
parent a9d1e99533
commit c12b126f06
4 changed files with 17 additions and 6 deletions

View file

@ -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 },

View file

@ -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,

View file

@ -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;

View file

@ -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);