From f0ec4ea7de2c81fb5f19a2ba4e545d27587aab18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sat, 18 Jun 2016 11:11:55 +0200 Subject: [PATCH] (Menu) arcade like joypad typing --- menu/menu_input.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/menu/menu_input.c b/menu/menu_input.c index 2e9d66f18e..9c396983f0 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -1239,6 +1239,8 @@ static unsigned menu_input_frame_build(retro_input_t trigger_input) return menu_input_frame_pointer(&ret); } +unsigned ti_char = 64; +bool ti_next = false; unsigned menu_input_frame_retropad(retro_input_t input, retro_input_t trigger_input) { @@ -1313,6 +1315,32 @@ unsigned menu_input_frame_retropad(retro_input_t input, { settings_t *settings = config_get_ptr(); + if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN)) + { + if (ti_char > 32) + ti_char--; + if (! ti_next) + input_keyboard_event(true, '\x7f', '\x7f', 0, RETRO_DEVICE_KEYBOARD); + input_keyboard_event(true, ti_char, ti_char, 0, RETRO_DEVICE_KEYBOARD); + ti_next = false; + } + + if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_UP)) + { + if (ti_char < 125) + ti_char++; + if (! ti_next) + input_keyboard_event(true, '\x7f', '\x7f', 0, RETRO_DEVICE_KEYBOARD); + input_keyboard_event(true, ti_char, ti_char, 0, RETRO_DEVICE_KEYBOARD); + ti_next = false; + } + + if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_A)) + { + ti_char = 64; + ti_next = true; + } + /* send return key to close keyboard input window */ if (trigger_input & (UINT64_C(1) << settings->menu_cancel_btn)) input_keyboard_event(true, '\n', '\n', 0, RETRO_DEVICE_KEYBOARD);