mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-14 06:18:34 +00:00
(RGUI) add dpad-emulation configuration
This commit is contained in:
parent
9c1725358b
commit
213823fd84
@ -49,6 +49,12 @@ char rarch_default_libretro_keybind_name_lut[RARCH_FIRST_META_KEY][32] = {
|
||||
"RetroPad Button R3", /* RETRO_DEVICE_ID_JOYPAD_R3 */
|
||||
};
|
||||
|
||||
char rarch_dpad_emulation_name_lut[KEYBIND_DEFAULT][32] = {
|
||||
"None", /* DPAD_EMULATION_NONE */
|
||||
"Left Stick", /* DPAD_EMULATION_LSTICK */
|
||||
"Right Stick", /* DPAD_EMULATION_RSTICK */
|
||||
};
|
||||
|
||||
extern const struct platform_bind platform_keys[];
|
||||
extern const unsigned int platform_keys_size;
|
||||
|
||||
|
@ -31,7 +31,8 @@ enum
|
||||
{
|
||||
DPAD_EMULATION_NONE = 0,
|
||||
DPAD_EMULATION_LSTICK,
|
||||
DPAD_EMULATION_RSTICK
|
||||
DPAD_EMULATION_RSTICK,
|
||||
DPAD_EMULATION_LAST
|
||||
};
|
||||
|
||||
enum
|
||||
@ -48,6 +49,7 @@ enum
|
||||
|
||||
extern uint64_t rarch_default_keybind_lut[RARCH_FIRST_META_KEY];
|
||||
extern char rarch_default_libretro_keybind_name_lut[RARCH_FIRST_META_KEY][32];
|
||||
extern char rarch_dpad_emulation_name_lut[KEYBIND_DEFAULT][32];
|
||||
|
||||
const char *rarch_input_find_platform_key_label(uint64_t joykey);
|
||||
|
||||
|
@ -362,6 +362,9 @@ static void render_text(rgui_handle_t *rgui)
|
||||
case RGUI_SETTINGS_BIND_DEVICE:
|
||||
snprintf(type_str, sizeof(type_str), "%s", rgui_device_labels[g_settings.input.device[port]]);
|
||||
break;
|
||||
case RGUI_SETTINGS_BIND_DPAD_EMULATION:
|
||||
snprintf(type_str, sizeof(type_str), "%s", rarch_dpad_emulation_name_lut[g_settings.input.dpad_emulation[port]]);
|
||||
break;
|
||||
case RGUI_SETTINGS_BIND_UP:
|
||||
case RGUI_SETTINGS_BIND_DOWN:
|
||||
case RGUI_SETTINGS_BIND_LEFT:
|
||||
@ -583,6 +586,17 @@ static void rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
|
||||
rarch_input_set_default_keybinds(port);
|
||||
input_gx.set_analog_dpad_mapping(g_settings.input.device[port], g_settings.input.dpad_emulation[port], port);
|
||||
break;
|
||||
case RGUI_SETTINGS_BIND_DPAD_EMULATION:
|
||||
g_settings.input.dpad_emulation[port] += DPAD_EMULATION_LAST;
|
||||
if (action == RGUI_ACTION_START)
|
||||
g_settings.input.dpad_emulation[port] = DPAD_EMULATION_LSTICK;
|
||||
else if (action == RGUI_ACTION_LEFT)
|
||||
g_settings.input.dpad_emulation[port]--;
|
||||
else if (action == RGUI_ACTION_RIGHT)
|
||||
g_settings.input.dpad_emulation[port]++;
|
||||
g_settings.input.dpad_emulation[port] %= DPAD_EMULATION_LAST;
|
||||
input_gx.set_analog_dpad_mapping(g_settings.input.device[port], g_settings.input.dpad_emulation[port], port);
|
||||
break;
|
||||
case RGUI_SETTINGS_BIND_UP:
|
||||
case RGUI_SETTINGS_BIND_DOWN:
|
||||
case RGUI_SETTINGS_BIND_LEFT:
|
||||
@ -655,6 +669,7 @@ static void rgui_settings_controller_populate_entries(rgui_handle_t *rgui)
|
||||
rgui_list_clear(rgui->folder_buf);
|
||||
|
||||
RGUI_MENU_ITEM("Device", RGUI_SETTINGS_BIND_DEVICE);
|
||||
RGUI_MENU_ITEM("DPad Emulation", RGUI_SETTINGS_BIND_DPAD_EMULATION);
|
||||
RGUI_MENU_ITEM("Up", RGUI_SETTINGS_BIND_UP);
|
||||
RGUI_MENU_ITEM("Down", RGUI_SETTINGS_BIND_DOWN);
|
||||
RGUI_MENU_ITEM("Left", RGUI_SETTINGS_BIND_LEFT);
|
||||
|
@ -57,6 +57,7 @@ typedef enum
|
||||
RGUI_SETTINGS_RESTART_EMULATOR,
|
||||
|
||||
RGUI_SETTINGS_BIND_DEVICE,
|
||||
RGUI_SETTINGS_BIND_DPAD_EMULATION,
|
||||
RGUI_SETTINGS_BIND_UP,
|
||||
RGUI_SETTINGS_BIND_DOWN,
|
||||
RGUI_SETTINGS_BIND_LEFT,
|
||||
|
Loading…
Reference in New Issue
Block a user