Submenu for Mouse Index

This commit is contained in:
sonninnos 2021-02-06 01:59:54 +02:00
parent e4f8f64336
commit 40b0001fb5
3 changed files with 37 additions and 9 deletions

View File

@ -303,6 +303,11 @@ static int action_get_title_dropdown_item(
(enum_idx <= MENU_ENUM_LABEL_INPUT_DEVICE_INDEX_LAST)) (enum_idx <= MENU_ENUM_LABEL_INPUT_DEVICE_INDEX_LAST))
enum_idx = MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_INDEX; enum_idx = MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_INDEX;
/* Mouse Index */
if ((enum_idx >= MENU_ENUM_LABEL_INPUT_MOUSE_INDEX) &&
(enum_idx <= MENU_ENUM_LABEL_INPUT_MOUSE_INDEX_LAST))
enum_idx = MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_INDEX;
{ {
const char *title = msg_hash_to_str(enum_idx); const char *title = msg_hash_to_str(enum_idx);

View File

@ -5363,11 +5363,11 @@ static int setting_action_left_mouse_index(
return -1; return -1;
if (settings->uints.input_mouse_index[setting->index_offset]) if (settings->uints.input_mouse_index[setting->index_offset])
{
--settings->uints.input_mouse_index[setting->index_offset]; --settings->uints.input_mouse_index[setting->index_offset];
settings->modified = true; else
} settings->uints.input_mouse_index[setting->index_offset] = MAX_USERS - 1;
settings->modified = true;
return 0; return 0;
} }
@ -6818,6 +6818,18 @@ static int setting_action_start_video_refresh_rate_auto(
return 0; return 0;
} }
static int setting_action_start_mouse_index(rarch_setting_t *setting)
{
settings_t *settings = config_get_ptr();
if (!setting)
return -1;
settings->uints.input_mouse_index[setting->index_offset] = 0;
settings->modified = true;
return 0;
}
/** /**
******* ACTION TOGGLE CALLBACK FUNCTIONS ******* ******* ACTION TOGGLE CALLBACK FUNCTIONS *******
**/ **/
@ -6909,9 +6921,12 @@ static int setting_action_right_mouse_index(
if (!setting) if (!setting)
return -1; return -1;
++settings->uints.input_mouse_index[setting->index_offset]; if (settings->uints.input_mouse_index[setting->index_offset] < MAX_USERS - 1)
settings->modified = true; ++settings->uints.input_mouse_index[setting->index_offset];
else
settings->uints.input_mouse_index[setting->index_offset] = 0;
settings->modified = true;
return 0; return 0;
} }
@ -8034,10 +8049,16 @@ static bool setting_append_list_input_player_options(
parent_group, parent_group,
general_write_handler, general_write_handler,
general_read_handler); general_read_handler);
(*list)[list_info->index - 1].index = user + 1; (*list)[list_info->index - 1].index = user + 1;
(*list)[list_info->index - 1].index_offset = user; (*list)[list_info->index - 1].index_offset = user;
(*list)[list_info->index - 1].action_left = &setting_action_left_mouse_index; (*list)[list_info->index - 1].action_start = &setting_action_start_mouse_index;
(*list)[list_info->index - 1].action_right = &setting_action_right_mouse_index; (*list)[list_info->index - 1].action_left = &setting_action_left_mouse_index;
(*list)[list_info->index - 1].action_right = &setting_action_right_mouse_index;
(*list)[list_info->index - 1].action_select = &setting_action_right_mouse_index;
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
menu_settings_list_current_add_range(list, list_info, 0, MAX_USERS - 1, 1.0, true, true);
MENU_SETTINGS_LIST_CURRENT_ADD_ENUM_IDX_PTR(list, list_info,
(enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_MOUSE_INDEX + user));
} }
for (i = 0; i < RARCH_BIND_LIST_END; i ++) for (i = 0; i < RARCH_BIND_LIST_END; i ++)

View File

@ -731,6 +731,8 @@ enum msg_hash_enums
MENU_ENUM_LABEL_INPUT_PLAYER_ANALOG_DPAD_MODE_LAST = MENU_ENUM_LABEL_INPUT_PLAYER_ANALOG_DPAD_MODE + MAX_USERS, MENU_ENUM_LABEL_INPUT_PLAYER_ANALOG_DPAD_MODE_LAST = MENU_ENUM_LABEL_INPUT_PLAYER_ANALOG_DPAD_MODE + MAX_USERS,
MENU_ENUM_LABEL_INPUT_DEVICE_INDEX, MENU_ENUM_LABEL_INPUT_DEVICE_INDEX,
MENU_ENUM_LABEL_INPUT_DEVICE_INDEX_LAST = MENU_ENUM_LABEL_INPUT_DEVICE_INDEX + MAX_USERS, MENU_ENUM_LABEL_INPUT_DEVICE_INDEX_LAST = MENU_ENUM_LABEL_INPUT_DEVICE_INDEX + MAX_USERS,
MENU_ENUM_LABEL_INPUT_MOUSE_INDEX,
MENU_ENUM_LABEL_INPUT_MOUSE_INDEX_LAST = MENU_ENUM_LABEL_INPUT_MOUSE_INDEX + MAX_USERS,
MENU_ENUM_LABEL_INPUT_SETTINGS_BEGIN, MENU_ENUM_LABEL_INPUT_SETTINGS_BEGIN,
MENU_LABEL(INPUT_HOTKEY_BINDS), MENU_LABEL(INPUT_HOTKEY_BINDS),