mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
menu_input_bind_dialog.c - more refactors
This commit is contained in:
parent
a9b8114109
commit
e602f534c7
@ -198,10 +198,6 @@ bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
|
|||||||
case MENU_INPUT_CTL_UNSET_POINTER_DRAGGED:
|
case MENU_INPUT_CTL_UNSET_POINTER_DRAGGED:
|
||||||
pointer_dragging = false;
|
pointer_dragging = false;
|
||||||
break;
|
break;
|
||||||
case MENU_INPUT_CTL_BIND_NONE:
|
|
||||||
case MENU_INPUT_CTL_BIND_SINGLE:
|
|
||||||
case MENU_INPUT_CTL_BIND_ALL:
|
|
||||||
return menu_input_key_bind_set_mode(state, data);
|
|
||||||
default:
|
default:
|
||||||
case MENU_INPUT_CTL_NONE:
|
case MENU_INPUT_CTL_NONE:
|
||||||
break;
|
break;
|
||||||
|
@ -76,10 +76,7 @@ enum menu_input_ctl_state
|
|||||||
MENU_INPUT_CTL_IS_POINTER_DRAGGED,
|
MENU_INPUT_CTL_IS_POINTER_DRAGGED,
|
||||||
MENU_INPUT_CTL_SET_POINTER_DRAGGED,
|
MENU_INPUT_CTL_SET_POINTER_DRAGGED,
|
||||||
MENU_INPUT_CTL_UNSET_POINTER_DRAGGED,
|
MENU_INPUT_CTL_UNSET_POINTER_DRAGGED,
|
||||||
MENU_INPUT_CTL_DEINIT,
|
MENU_INPUT_CTL_DEINIT
|
||||||
MENU_INPUT_CTL_BIND_NONE,
|
|
||||||
MENU_INPUT_CTL_BIND_SINGLE,
|
|
||||||
MENU_INPUT_CTL_BIND_ALL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct menu_input_ctx_hitbox
|
typedef struct menu_input_ctx_hitbox
|
||||||
|
@ -1242,7 +1242,7 @@ static int setting_action_right_bind_device(void *data, bool wraparound)
|
|||||||
static int setting_action_ok_bind_all(void *data, bool wraparound)
|
static int setting_action_ok_bind_all(void *data, bool wraparound)
|
||||||
{
|
{
|
||||||
(void)wraparound;
|
(void)wraparound;
|
||||||
if (!menu_input_ctl(MENU_INPUT_CTL_BIND_ALL, data))
|
if (!menu_input_key_bind_set_mode(MENU_INPUT_BINDS_CTL_BIND_ALL, data))
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ static bool menu_input_key_bind_custom_bind_keyboard_cb(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int menu_input_key_bind_set_mode_common(
|
static int menu_input_key_bind_set_mode_common(
|
||||||
enum menu_input_ctl_state state,
|
enum menu_input_binds_ctl_state state,
|
||||||
rarch_setting_t *setting)
|
rarch_setting_t *setting)
|
||||||
{
|
{
|
||||||
size_t selection;
|
size_t selection;
|
||||||
@ -98,9 +98,7 @@ static int menu_input_key_bind_set_mode_common(
|
|||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case MENU_INPUT_CTL_BIND_NONE:
|
case MENU_INPUT_BINDS_CTL_BIND_SINGLE:
|
||||||
return -1;
|
|
||||||
case MENU_INPUT_CTL_BIND_SINGLE:
|
|
||||||
keybind = (struct retro_keybind*)setting_get_ptr(setting);
|
keybind = (struct retro_keybind*)setting_get_ptr(setting);
|
||||||
|
|
||||||
if (!keybind)
|
if (!keybind)
|
||||||
@ -123,7 +121,7 @@ static int menu_input_key_bind_set_mode_common(
|
|||||||
if (menu_displaylist_ctl(DISPLAYLIST_INFO, &info))
|
if (menu_displaylist_ctl(DISPLAYLIST_INFO, &info))
|
||||||
menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info);
|
menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info);
|
||||||
break;
|
break;
|
||||||
case MENU_INPUT_CTL_BIND_ALL:
|
case MENU_INPUT_BINDS_CTL_BIND_ALL:
|
||||||
menu_input_binds.target = &settings->input.binds
|
menu_input_binds.target = &settings->input.binds
|
||||||
[index_offset][0];
|
[index_offset][0];
|
||||||
menu_input_binds.begin = MENU_SETTINGS_BIND_BEGIN;
|
menu_input_binds.begin = MENU_SETTINGS_BIND_BEGIN;
|
||||||
@ -141,7 +139,7 @@ static int menu_input_key_bind_set_mode_common(
|
|||||||
menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info);
|
menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case MENU_INPUT_CTL_NONE:
|
case MENU_INPUT_BINDS_CTL_BIND_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +234,7 @@ static void menu_input_key_bind_poll_bind_state(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool menu_input_key_bind_set_mode(
|
bool menu_input_key_bind_set_mode(
|
||||||
enum menu_input_ctl_state state, void *data)
|
enum menu_input_binds_ctl_state state, void *data)
|
||||||
{
|
{
|
||||||
unsigned index_offset;
|
unsigned index_offset;
|
||||||
input_keyboard_ctx_wait_t keys;
|
input_keyboard_ctx_wait_t keys;
|
||||||
|
@ -28,6 +28,13 @@
|
|||||||
|
|
||||||
RETRO_BEGIN_DECLS
|
RETRO_BEGIN_DECLS
|
||||||
|
|
||||||
|
enum menu_input_binds_ctl_state
|
||||||
|
{
|
||||||
|
MENU_INPUT_BINDS_CTL_BIND_NONE = 0,
|
||||||
|
MENU_INPUT_BINDS_CTL_BIND_SINGLE,
|
||||||
|
MENU_INPUT_BINDS_CTL_BIND_ALL
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct menu_input_ctx_bind
|
typedef struct menu_input_ctx_bind
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
@ -41,7 +48,7 @@ typedef struct menu_input_ctx_bind_limits
|
|||||||
} menu_input_ctx_bind_limits_t;
|
} menu_input_ctx_bind_limits_t;
|
||||||
|
|
||||||
bool menu_input_key_bind_set_mode(
|
bool menu_input_key_bind_set_mode(
|
||||||
enum menu_input_ctl_state state, void *data);
|
enum menu_input_binds_ctl_state state, void *data);
|
||||||
|
|
||||||
bool menu_input_key_bind_set_min_max(menu_input_ctx_bind_limits_t *lim);
|
bool menu_input_key_bind_set_min_max(menu_input_ctx_bind_limits_t *lim);
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
#include "menu/menu_driver.h"
|
#include "menu/menu_driver.h"
|
||||||
#include "menu/widgets/menu_input_dialog.h"
|
#include "menu/widgets/menu_input_dialog.h"
|
||||||
|
#include "menu/widgets/menu_input_bind_dialog.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
@ -141,7 +142,7 @@ static int setting_bind_action_ok(void *data, bool wraparound)
|
|||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
/* TODO - get rid of menu dependency */
|
/* TODO - get rid of menu dependency */
|
||||||
if (!menu_input_ctl(MENU_INPUT_CTL_BIND_SINGLE, data))
|
if (!menu_input_key_bind_set_mode(MENU_INPUT_BINDS_CTL_BIND_SINGLE, data))
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user