Fixes remaining input issues courtesy of bparker

This commit is contained in:
twinaphex 2016-10-29 04:00:36 +02:00
parent 8242181657
commit 5d90b774da
3 changed files with 71 additions and 75 deletions

View File

@ -37,6 +37,8 @@
#include "../verbosity.h"
#include "../command.h"
#include "../menu/widgets/menu_input_dialog.h"
static const input_driver_t *input_drivers[] = {
#ifdef __CELLOS_LV2__
&input_ps3,
@ -748,6 +750,55 @@ uint64_t input_menu_keys_pressed(void)
ret |= (UINT64_C(1) << i);
}
const struct retro_keybind *binds[MAX_USERS] = {NULL};
if (menu_input_dialog_get_display_kb())
return ret;
if (current_input->input_state(current_input_data, binds, 0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN))
BIT32_SET(ret, settings->menu_ok_btn);
if (current_input->input_state(current_input_data, binds, 0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_BACKSPACE))
BIT32_SET(ret, settings->menu_cancel_btn);
if (current_input->input_state(current_input_data, binds, 0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_SPACE))
BIT32_SET(ret, settings->menu_default_btn);
if (current_input->input_state(current_input_data, binds, 0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_SLASH))
BIT32_SET(ret, settings->menu_search_btn);
if (current_input->input_state(current_input_data, binds, 0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_RSHIFT))
BIT32_SET(ret, settings->menu_info_btn);
if (current_input->input_state(current_input_data, binds, 0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_RIGHT))
BIT32_SET(ret, RETRO_DEVICE_ID_JOYPAD_RIGHT);
if (current_input->input_state(current_input_data, binds, 0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_LEFT))
BIT32_SET(ret, RETRO_DEVICE_ID_JOYPAD_LEFT);
if (current_input->input_state(current_input_data, binds, 0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_DOWN))
BIT32_SET(ret, RETRO_DEVICE_ID_JOYPAD_DOWN);
if (current_input->input_state(current_input_data, binds, 0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_UP))
BIT32_SET(ret, RETRO_DEVICE_ID_JOYPAD_UP);
if (current_input->input_state(current_input_data, binds, 0,
RETRO_DEVICE_KEYBOARD, 0, settings->input.binds[0][RARCH_QUIT_KEY].key ))
BIT32_SET(ret, RARCH_QUIT_KEY);
if (current_input->input_state(current_input_data, binds, 0,
RETRO_DEVICE_KEYBOARD, 0, settings->input.binds[0][RARCH_FULLSCREEN_TOGGLE_KEY].key ))
BIT32_SET(ret, RARCH_FULLSCREEN_TOGGLE_KEY);
return ret;
}

View File

@ -216,66 +216,6 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input)
trigger_input = 0;
}
for (i = 0; i < RETROK_LAST; i++)
{
if (i == RETROK_F1 || i == RETROK_F11)
continue;
if (menu_keyboard_key_state[i])
{
if (settings->input.binds[0][RARCH_QUIT_KEY].key == (enum retro_key)i)
{
BIT32_SET(trigger_input, RARCH_QUIT_KEY);
}
else if (settings->input.binds[0][RARCH_FULLSCREEN_TOGGLE_KEY].key == (enum retro_key)i)
{
BIT32_SET(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY);
}
else
{
switch ((enum retro_key)i)
{
case RETROK_PAGEUP:
BIT32_SET(trigger_input, settings->menu_scroll_up_btn);
break;
case RETROK_PAGEDOWN:
BIT32_SET(trigger_input, settings->menu_scroll_down_btn);
break;
case RETROK_SPACE:
BIT32_SET(trigger_input, settings->menu_default_btn);
break;
case RETROK_SLASH:
BIT32_SET(trigger_input, settings->menu_search_btn);
break;
case RETROK_RSHIFT:
BIT32_SET(trigger_input, settings->menu_info_btn);
break;
case RETROK_LEFT:
BIT32_SET(trigger_input, RETRO_DEVICE_ID_JOYPAD_LEFT);
break;
case RETROK_RIGHT:
BIT32_SET(trigger_input, RETRO_DEVICE_ID_JOYPAD_RIGHT);
break;
case RETROK_UP:
BIT32_SET(trigger_input, RETRO_DEVICE_ID_JOYPAD_UP);
break;
case RETROK_DOWN:
BIT32_SET(trigger_input, RETRO_DEVICE_ID_JOYPAD_DOWN);
break;
case RETROK_BACKSPACE:
BIT32_SET(trigger_input, settings->menu_cancel_btn);
break;
case RETROK_RETURN:
BIT32_SET(trigger_input, settings->menu_ok_btn);
break;
default:
break;
}
}
menu_keyboard_key_state[i] = false;
}
}
if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_UP))
ret = MENU_ACTION_UP;
else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN))
@ -303,9 +243,6 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input)
else if (trigger_input & (UINT64_C(1) << RARCH_MENU_TOGGLE))
ret = MENU_ACTION_TOGGLE;
if (runloop_cmd_triggered(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY))
command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL);
if (menu_keyboard_key_state[RETROK_F11])
{
command_event(CMD_EVENT_GRAB_MOUSE_TOGGLE, NULL);

View File

@ -883,24 +883,32 @@ static enum runloop_state runloop_check_state(
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
{
menu_ctx_iterate_t iter;
enum menu_action action = (enum menu_action)menu_event(current_input, trigger_input);
bool focused = settings->pause_nonactive ? video_driver_is_focused() : true;
bool skip = false;
#ifdef HAVE_OVERLAY
skip = osk_enable && BIT64_GET(trigger_input, settings->menu_ok_btn);
#endif
focused = focused && !ui_companion_is_on_foreground();
if (!skip)
{
enum menu_action action = (enum menu_action)menu_event(current_input, trigger_input);
bool focused = settings->pause_nonactive ? video_driver_is_focused() : true;
iter.action = action;
focused = focused && !ui_companion_is_on_foreground();
if (!menu_driver_ctl(RARCH_MENU_CTL_ITERATE, &iter))
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
iter.action = action;
if (focused || !runloop_idle)
menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL);
if (!menu_driver_ctl(RARCH_MENU_CTL_ITERATE, &iter))
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
if (!focused)
return RUNLOOP_STATE_SLEEP;
if (focused || !runloop_idle)
menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL);
if (action == MENU_ACTION_QUIT)
return RUNLOOP_STATE_QUIT;
if (!focused)
return RUNLOOP_STATE_SLEEP;
if (action == MENU_ACTION_QUIT)
return RUNLOOP_STATE_QUIT;
}
}
#endif