Allow changing savestate slots with left/right on save/load (#14078)

This commit is contained in:
sonninnos 2022-06-21 01:57:04 +03:00 committed by GitHub
parent 61e08ee35b
commit 645b4864fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

View File

@ -950,6 +950,21 @@ static int action_left_video_gpu_index(unsigned type, const char *label,
return 0;
}
static int action_left_state_slot(unsigned type, const char *label,
bool wraparound)
{
settings_t *settings = config_get_ptr();
settings->ints.state_slot--;
if (settings->ints.state_slot < -1)
settings->ints.state_slot = 999;
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_PATH, NULL);
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_IMAGE, NULL);
return 0;
}
static int bind_left_generic(unsigned type, const char *label,
bool wraparound)
{
@ -1252,6 +1267,10 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs,
case MENU_SETTING_ACTION_CORE_SET_STANDALONE_EXEMPT:
BIND_ACTION_LEFT(cbs, action_left_core_set_standalone_exempt);
break;
case MENU_SETTING_ACTION_SAVESTATE:
case MENU_SETTING_ACTION_LOADSTATE:
BIND_ACTION_LEFT(cbs, action_left_state_slot);
break;
case MENU_SETTING_DROPDOWN_ITEM_INPUT_DESCRIPTION:
case MENU_SETTING_DROPDOWN_ITEM_INPUT_DESCRIPTION_KBD:
BIND_ACTION_LEFT(cbs, action_left_scroll);

View File

@ -948,6 +948,21 @@ static int disk_options_disk_idx_right(unsigned type, const char *label,
return 0;
}
static int action_right_state_slot(unsigned type, const char *label,
bool wraparound)
{
settings_t *settings = config_get_ptr();
settings->ints.state_slot++;
if (settings->ints.state_slot > 999)
settings->ints.state_slot = -1;
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_PATH, NULL);
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_IMAGE, NULL);
return 0;
}
int bind_right_generic(unsigned type, const char *label,
bool wraparound)
{
@ -1068,6 +1083,10 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
case MENU_SETTING_ACTION_CORE_SET_STANDALONE_EXEMPT:
BIND_ACTION_RIGHT(cbs, action_right_core_set_standalone_exempt);
break;
case MENU_SETTING_ACTION_SAVESTATE:
case MENU_SETTING_ACTION_LOADSTATE:
BIND_ACTION_RIGHT(cbs, action_right_state_slot);
break;
case MENU_SETTING_DROPDOWN_ITEM_INPUT_DESCRIPTION:
case MENU_SETTING_DROPDOWN_ITEM_INPUT_DESCRIPTION_KBD:
BIND_ACTION_RIGHT(cbs, action_right_scroll);