Option for disabling initial disc change (#16197)

Loading the last used disc for multi-disc content was automatic.
However, in some cases it is not wanted, as described in #16018
Option is added for controlling the function. Disabling the
option will also implicitly disable index saving.
This commit is contained in:
zoltanvb 2024-02-04 20:58:16 +01:00 committed by GitHub
parent e5029ffdfb
commit d88d0d5219
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 60 additions and 20 deletions

View File

@ -848,6 +848,7 @@
#define DEFAULT_GAME_SPECIFIC_OPTIONS true
#define DEFAULT_AUTO_OVERRIDES_ENABLE true
#define DEFAULT_AUTO_REMAPS_ENABLE true
#define DEFAULT_INITIAL_DISK_CHANGE_ENABLE true
#define DEFAULT_GLOBAL_CORE_OPTIONS false
#define DEFAULT_AUTO_SHADERS_ENABLE true

View File

@ -1719,6 +1719,7 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("game_specific_options", &settings->bools.game_specific_options, true, DEFAULT_GAME_SPECIFIC_OPTIONS, false);
SETTING_BOOL("auto_overrides_enable", &settings->bools.auto_overrides_enable, true, DEFAULT_AUTO_OVERRIDES_ENABLE, false);
SETTING_BOOL("auto_remaps_enable", &settings->bools.auto_remaps_enable, true, DEFAULT_AUTO_REMAPS_ENABLE, false);
SETTING_BOOL("initial_disk_change_enable", &settings->bools.initial_disk_change_enable, true, DEFAULT_INITIAL_DISK_CHANGE_ENABLE, false);
SETTING_BOOL("global_core_options", &settings->bools.global_core_options, true, DEFAULT_GLOBAL_CORE_OPTIONS, false);
SETTING_BOOL("auto_shaders_enable", &settings->bools.auto_shaders_enable, true, DEFAULT_AUTO_SHADERS_ENABLE, false);
SETTING_BOOL("scan_without_core_match", &settings->bools.scan_without_core_match, true, DEFAULT_SCAN_WITHOUT_CORE_MATCH, false);

View File

@ -976,6 +976,7 @@ typedef struct settings
bool game_specific_options;
bool auto_overrides_enable;
bool auto_remaps_enable;
bool initial_disk_change_enable;
bool global_core_options;
bool auto_shaders_enable;

View File

@ -754,7 +754,8 @@ error:
**/
bool disk_control_verify_initial_index(
disk_control_interface_t *disk_control,
bool verbosity)
bool verbosity,
bool enabled)
{
bool success = false;
unsigned image_index = 0;
@ -766,7 +767,7 @@ bool disk_control_verify_initial_index(
return false;
/* If index record is disabled, can return immediately */
if (!disk_control->record_enabled)
if (!disk_control->record_enabled && enabled)
return false;
/* Check that 'initial index' functionality is enabled */
@ -803,10 +804,10 @@ bool disk_control_verify_initial_index(
}
/* If current disk is incorrect, notify user */
if (!success)
if (!success && enabled)
{
RARCH_ERR(
"[Disc]: Failed to set initial disk index:\n> Expected"
"[Disc]: Failed to set initial disc index:\n> Expected"
" [%u] %s\n> Detected [%u] %s\n",
disk_control->index_record.image_index + 1,
disk_control->index_record.image_path,
@ -830,6 +831,11 @@ bool disk_control_verify_initial_index(
disk_index_file_set(&disk_control->index_record, 0, NULL);
disk_index_file_save(&disk_control->index_record);
}
else if (!enabled)
{
RARCH_LOG("[Disc]: Initial disc index setting disabled.");
}
/* If current disk is correct and recorded image
* path is empty (i.e. first run), need to register
* current image path */

View File

@ -241,7 +241,8 @@ bool disk_control_set_initial_index(
**/
bool disk_control_verify_initial_index(
disk_control_interface_t *disk_control,
bool verbosity);
bool verbosity,
bool enabled);
/**
* disk_control_save_image_index:

View File

@ -401,6 +401,10 @@ MSG_HASH(
MENU_ENUM_LABEL_AUTO_REMAPS_ENABLE,
"auto_remaps_enable"
)
MSG_HASH(
MENU_ENUM_LABEL_INITIAL_DISK_CHANGE_ENABLE,
"initial_disk_change_enable"
)
MSG_HASH(
MENU_ENUM_LABEL_GLOBAL_CORE_OPTIONS,
"global_core_options"

View File

@ -4456,6 +4456,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_AUTO_REMAPS_ENABLE,
"Load customized controls at startup."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INITIAL_DISK_CHANGE_ENABLE,
"Load Initial Disc Index Files Automatically"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_INITIAL_DISK_CHANGE_ENABLE,
"Change to last used disc when starting multi-disc content."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_AUTO_SHADERS_ENABLE,
"Load Shader Presets Automatically"
@ -15063,7 +15071,7 @@ MSG_HASH(
)
MSG_HASH(
MSG_FAILED_TO_SET_INITIAL_DISK,
"Failed to set last used disc..."
"Failed to set last used disc."
)
MSG_HASH(
MSG_FAILED_TO_CONNECT_TO_CLIENT,

View File

@ -958,6 +958,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_filebrowser_settings,
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_filebrowser_open_uwp_permissions, MENU_ENUM_SUBLABEL_FILE_BROWSER_OPEN_UWP_PERMISSIONS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_filebrowser_open_picker, MENU_ENUM_SUBLABEL_FILE_BROWSER_OPEN_PICKER)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_auto_remaps_enable, MENU_ENUM_SUBLABEL_AUTO_REMAPS_ENABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_initial_disk_change_enable, MENU_ENUM_SUBLABEL_INITIAL_DISK_CHANGE_ENABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_auto_overrides_enable, MENU_ENUM_SUBLABEL_AUTO_OVERRIDES_ENABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_game_specific_options, MENU_ENUM_SUBLABEL_GAME_SPECIFIC_OPTIONS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_global_core_options, MENU_ENUM_SUBLABEL_GLOBAL_CORE_OPTIONS)
@ -3440,6 +3441,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_AUTO_REMAPS_ENABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_auto_remaps_enable);
break;
case MENU_ENUM_LABEL_INITIAL_DISK_CHANGE_ENABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_initial_disk_change_enable);
break;
case MENU_ENUM_LABEL_MENU_FILE_BROWSER_SETTINGS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_filebrowser_settings);
break;

View File

@ -2144,6 +2144,7 @@ static uintptr_t ozone_entries_icon_get_texture(
case MENU_ENUM_LABEL_OVERRIDE_FILE_LOAD:
case MENU_ENUM_LABEL_AUTO_OVERRIDES_ENABLE:
case MENU_ENUM_LABEL_AUTO_REMAPS_ENABLE:
case MENU_ENUM_LABEL_INITIAL_DISK_CHANGE_ENABLE:
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET:
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_PREPEND:
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_APPEND:

View File

@ -2960,6 +2960,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
case MENU_ENUM_LABEL_OVERRIDE_FILE_LOAD:
case MENU_ENUM_LABEL_AUTO_OVERRIDES_ENABLE:
case MENU_ENUM_LABEL_AUTO_REMAPS_ENABLE:
case MENU_ENUM_LABEL_INITIAL_DISK_CHANGE_ENABLE:
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET:
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_PREPEND:
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_APPEND:

View File

@ -10785,12 +10785,13 @@ unsigned menu_displaylist_build_list(
case DISPLAYLIST_CONFIGURATION_SETTINGS_LIST:
{
menu_displaylist_build_info_t build_list[] = {
{MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_REMAP_SAVE_ON_EXIT, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_AUTO_OVERRIDES_ENABLE, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_AUTO_REMAPS_ENABLE, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_GLOBAL_CORE_OPTIONS, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_REMAP_SAVE_ON_EXIT, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_GAME_SPECIFIC_OPTIONS, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_AUTO_OVERRIDES_ENABLE, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_AUTO_REMAPS_ENABLE, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_INITIAL_DISK_CHANGE_ENABLE, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_GLOBAL_CORE_OPTIONS, PARSE_ONLY_BOOL},
};
for (i = 0; i < ARRAY_SIZE(build_list); i++)

View File

@ -10859,7 +10859,7 @@ static bool setting_append_list(
case SETTINGS_LIST_CONFIGURATION:
{
uint8_t i, listing = 0;
struct bool_entry bool_entries[8];
struct bool_entry bool_entries[9];
START_GROUP(list, list_info, &group_info,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONFIGURATION_SETTINGS), parent_group);
@ -10903,6 +10903,13 @@ static bool setting_append_list(
bool_entries[listing].flags = SD_FLAG_ADVANCED;
listing++;
bool_entries[listing].target = &settings->bools.initial_disk_change_enable;
bool_entries[listing].name_enum_idx = MENU_ENUM_LABEL_INITIAL_DISK_CHANGE_ENABLE;
bool_entries[listing].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_INITIAL_DISK_CHANGE_ENABLE;
bool_entries[listing].default_value = DEFAULT_INITIAL_DISK_CHANGE_ENABLE;
bool_entries[listing].flags = SD_FLAG_ADVANCED;
listing++;
bool_entries[listing].target = &settings->bools.auto_shaders_enable;
bool_entries[listing].name_enum_idx = MENU_ENUM_LABEL_AUTO_SHADERS_ENABLE;
bool_entries[listing].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_AUTO_SHADERS_ENABLE;

View File

@ -2284,6 +2284,7 @@ enum msg_hash_enums
MENU_LABEL(AUTO_OVERRIDES_ENABLE),
MENU_LABEL(AUTO_REMAPS_ENABLE),
MENU_LABEL(INITIAL_DISK_CHANGE_ENABLE),
MENU_LABEL(GLOBAL_CORE_OPTIONS),
MENU_LABEL(AUTO_SHADERS_ENABLE),
MENU_LABEL(RGUI_SHOW_START_SCREEN),

View File

@ -4634,6 +4634,7 @@ bool runloop_event_init_core(
bool auto_remaps_enable = false;
const char *dir_input_remapping = NULL;
#endif
bool initial_disk_change_enable = true;
bool show_set_initial_disk_msg = false;
unsigned poll_type_behavior = 0;
float fastforward_ratio = 0.0f;
@ -4705,12 +4706,13 @@ bool runloop_event_init_core(
/* Cannot access these settings-related parameters
* until *after* config overrides have been loaded */
#ifdef HAVE_CONFIGFILE
auto_remaps_enable = settings->bools.auto_remaps_enable;
dir_input_remapping = settings->paths.directory_input_remapping;
auto_remaps_enable = settings->bools.auto_remaps_enable;
dir_input_remapping = settings->paths.directory_input_remapping;
#endif
show_set_initial_disk_msg = settings->bools.notification_show_set_initial_disk;
poll_type_behavior = settings->uints.input_poll_type_behavior;
fastforward_ratio = runloop_get_fastforward_ratio(
initial_disk_change_enable = settings->bools.initial_disk_change_enable;
show_set_initial_disk_msg = settings->bools.notification_show_set_initial_disk;
poll_type_behavior = settings->uints.input_poll_type_behavior;
fastforward_ratio = runloop_get_fastforward_ratio(
settings, &runloop_st->fastmotion_override.current);
#ifdef HAVE_CHEEVOS
@ -4754,7 +4756,8 @@ bool runloop_event_init_core(
runloop_st->current_core.flags |= RETRO_CORE_FLAG_INITED;
/* Attempt to set initial disk index */
disk_control_set_initial_index(
if (initial_disk_change_enable)
disk_control_set_initial_index(
&sys_info->disk_control,
path_get(RARCH_PATH_CONTENT),
runloop_st->savefile_dir);
@ -4767,7 +4770,7 @@ bool runloop_event_init_core(
/* Verify that initial disk index was set correctly */
disk_control_verify_initial_index(&sys_info->disk_control,
show_set_initial_disk_msg);
show_set_initial_disk_msg, initial_disk_change_enable);
if (!runloop_event_load_core(runloop_st, poll_type_behavior))
return false;