fix menu toggle with F1
This commit is contained in:
parent
14ad3f9dd6
commit
b7a8ff9395
|
@ -226,24 +226,23 @@ static void menu_input_key_event(bool down, unsigned keycode,
|
||||||
RARCH_LOG("down: %d, keycode: %d, mod: %d, character: %d\n", down, keycode, mod, character);
|
RARCH_LOG("down: %d, keycode: %d, mod: %d, character: %d\n", down, keycode, mod, character);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (down)
|
menu_event_keyboard_set(down, (enum retro_key)keycode);
|
||||||
menu_event_keyboard_set((enum retro_key)keycode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_driver_toggle(bool latch)
|
static void menu_driver_toggle(bool on)
|
||||||
{
|
{
|
||||||
retro_keyboard_event_t *key_event = NULL;
|
retro_keyboard_event_t *key_event = NULL;
|
||||||
retro_keyboard_event_t *frontend_key_event = NULL;
|
retro_keyboard_event_t *frontend_key_event = NULL;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
menu_driver_toggled = latch;
|
menu_driver_toggled = on;
|
||||||
|
|
||||||
if (!latch)
|
if (!on)
|
||||||
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_NONE);
|
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_NONE);
|
||||||
|
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_TOGGLE, &latch);
|
menu_driver_ctl(RARCH_MENU_CTL_TOGGLE, &on);
|
||||||
|
|
||||||
if (latch)
|
if (on)
|
||||||
menu_driver_alive = true;
|
menu_driver_alive = true;
|
||||||
else
|
else
|
||||||
menu_driver_alive = false;
|
menu_driver_alive = false;
|
||||||
|
@ -765,12 +764,12 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||||
break;
|
break;
|
||||||
case RARCH_MENU_CTL_TOGGLE:
|
case RARCH_MENU_CTL_TOGGLE:
|
||||||
{
|
{
|
||||||
bool *latch = (bool*)data;
|
bool *on = (bool*)data;
|
||||||
if (!latch)
|
if (!on)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (menu_driver_ctx && menu_driver_ctx->toggle)
|
if (menu_driver_ctx && menu_driver_ctx->toggle)
|
||||||
menu_driver_ctx->toggle(menu_userdata, *latch);
|
menu_driver_ctx->toggle(menu_userdata, *on);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RARCH_MENU_CTL_REFRESH:
|
case RARCH_MENU_CTL_REFRESH:
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include "../retroarch.h"
|
#include "../retroarch.h"
|
||||||
#include "../runloop.h"
|
#include "../runloop.h"
|
||||||
|
|
||||||
static bool menu_keyboard_key_state[RETROK_LAST];
|
static unsigned short menu_keyboard_key_state[RETROK_LAST];
|
||||||
|
|
||||||
static int menu_event_pointer(unsigned *action)
|
static int menu_event_pointer(unsigned *action)
|
||||||
{
|
{
|
||||||
|
@ -72,19 +72,24 @@ static int menu_event_pointer(unsigned *action)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool menu_event_keyboard_is_set(enum retro_key key)
|
unsigned short menu_event_keyboard_is_set(enum retro_key key)
|
||||||
{
|
{
|
||||||
if (menu_keyboard_key_state[key] && key == RETROK_F1)
|
|
||||||
{
|
|
||||||
menu_keyboard_key_state[key] = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return menu_keyboard_key_state[key];
|
return menu_keyboard_key_state[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_event_keyboard_set(enum retro_key key)
|
void menu_event_keyboard_set(bool down, enum retro_key key)
|
||||||
{
|
{
|
||||||
menu_keyboard_key_state[key] = true;
|
if (key == RETROK_UNKNOWN)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < RETROK_LAST; i++)
|
||||||
|
{
|
||||||
|
menu_keyboard_key_state[i] = (menu_keyboard_key_state[i] & 3) << 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
menu_keyboard_key_state[key] = ((menu_keyboard_key_state[key] & 1) << 1) | down;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned menu_event(uint64_t input, uint64_t trigger_input)
|
unsigned menu_event(uint64_t input, uint64_t trigger_input)
|
||||||
|
|
|
@ -35,9 +35,9 @@ RETRO_BEGIN_DECLS
|
||||||
*/
|
*/
|
||||||
unsigned menu_event(uint64_t input, uint64_t trigger_state);
|
unsigned menu_event(uint64_t input, uint64_t trigger_state);
|
||||||
|
|
||||||
void menu_event_keyboard_set(enum retro_key key);
|
void menu_event_keyboard_set(bool down, enum retro_key key);
|
||||||
|
|
||||||
bool menu_event_keyboard_is_set(enum retro_key key);
|
unsigned short menu_event_keyboard_is_set(enum retro_key key);
|
||||||
|
|
||||||
unsigned kbd_index;
|
unsigned kbd_index;
|
||||||
char kbd_grid[41];
|
char kbd_grid[41];
|
||||||
|
|
14
runloop.c
14
runloop.c
|
@ -907,22 +907,26 @@ static enum runloop_state runloop_check_state(
|
||||||
return RUNLOOP_STATE_SLEEP;
|
return RUNLOOP_STATE_SLEEP;
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
if ( menu_event_keyboard_is_set(RETROK_F1) ||
|
if (menu_event_keyboard_is_set(RETROK_F1) == 1)
|
||||||
runloop_cmd_menu_press(current_input, old_input, trigger_input) ||
|
|
||||||
rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
|
||||||
{
|
{
|
||||||
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
|
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
|
||||||
{
|
{
|
||||||
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) &&
|
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) &&
|
||||||
!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
||||||
|
{
|
||||||
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
|
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
|
||||||
|
menu_event_keyboard_set(false, RETROK_F1);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
}
|
||||||
|
else if ((!menu_event_keyboard_is_set(RETROK_F1) && runloop_cmd_menu_press(current_input, old_input, trigger_input)) ||
|
||||||
|
rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
||||||
{
|
{
|
||||||
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_USER);
|
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_USER);
|
||||||
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
|
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
menu_event_keyboard_set(false, RETROK_F1);
|
||||||
|
|
||||||
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
|
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue