From 230c1cdde22e7b96cffa64223b6fbd85aaa5b8e9 Mon Sep 17 00:00:00 2001 From: jdgleaver Date: Fri, 17 Jul 2020 12:50:28 +0100 Subject: [PATCH] Add option to show/hide 'last used disc restored' notifications --- config.def.h | 4 ++++ configuration.c | 1 + configuration.h | 1 + disk_control_interface.c | 20 +++++++++++++------- disk_control_interface.h | 7 +++++-- intl/msg_hash_lbl.h | 4 ++++ intl/msg_hash_us.h | 8 ++++++++ menu/cbs/menu_cbs_sublabel.c | 4 ++++ menu/menu_displaylist.c | 1 + menu/menu_setting.c | 15 +++++++++++++++ msg_hash.h | 1 + retroarch.c | 4 +++- ui/drivers/qt/options/osd.cpp | 1 + 13 files changed, 61 insertions(+), 10 deletions(-) diff --git a/config.def.h b/config.def.h index c6cab11e5f..293ac4b774 100644 --- a/config.def.h +++ b/config.def.h @@ -795,6 +795,10 @@ static const bool audio_enable_menu_bgm = false; * configuration override file */ #define DEFAULT_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD true +/* Display a notification when automatically restoring + * at launch the last used disk of multi-disk content */ +#define DEFAULT_NOTIFICATION_SHOW_SET_INITIAL_DISK true + /* Display a notification when fast forwarding * content */ #define DEFAULT_NOTIFICATION_SHOW_FAST_FORWARD true diff --git a/configuration.c b/configuration.c index 33002e4188..a8eeac4c32 100644 --- a/configuration.c +++ b/configuration.c @@ -1477,6 +1477,7 @@ static struct config_bool_setting *populate_settings_bool( SETTING_BOOL("notification_show_cheats_applied", &settings->bools.notification_show_cheats_applied, true, DEFAULT_NOTIFICATION_SHOW_CHEATS_APPLIED, false); SETTING_BOOL("notification_show_remap_load", &settings->bools.notification_show_remap_load, true, DEFAULT_NOTIFICATION_SHOW_REMAP_LOAD, false); SETTING_BOOL("notification_show_config_override_load", &settings->bools.notification_show_config_override_load, true, DEFAULT_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD, false); + SETTING_BOOL("notification_show_set_initial_disk", &settings->bools.notification_show_set_initial_disk, true, DEFAULT_NOTIFICATION_SHOW_SET_INITIAL_DISK, false); SETTING_BOOL("notification_show_fast_forward", &settings->bools.notification_show_fast_forward, true, DEFAULT_NOTIFICATION_SHOW_FAST_FORWARD, false); SETTING_BOOL("menu_widget_scale_auto", &settings->bools.menu_widget_scale_auto, true, DEFAULT_MENU_WIDGET_SCALE_AUTO, false); SETTING_BOOL("audio_enable_menu", &settings->bools.audio_enable_menu, true, audio_enable_menu, false); diff --git a/configuration.h b/configuration.h index 21d5ba0f72..16cf0ade4d 100644 --- a/configuration.h +++ b/configuration.h @@ -163,6 +163,7 @@ typedef struct settings bool notification_show_cheats_applied; bool notification_show_remap_load; bool notification_show_config_override_load; + bool notification_show_set_initial_disk; bool notification_show_fast_forward; bool menu_widget_scale_auto; bool menu_show_start_screen; diff --git a/disk_control_interface.c b/disk_control_interface.c index 2c1d93d5dc..d9b708d2f6 100644 --- a/disk_control_interface.c +++ b/disk_control_interface.c @@ -665,7 +665,9 @@ error: * if functionality is supported by core * NOTE: Must be called immediately after * loading content */ -bool disk_control_verify_initial_index(disk_control_interface_t *disk_control) +bool disk_control_verify_initial_index( + disk_control_interface_t *disk_control, + bool verbosity) { bool success = false; unsigned image_index = 0; @@ -723,6 +725,8 @@ bool disk_control_verify_initial_index(disk_control_interface_t *disk_control) image_index + 1, image_path); + /* Ignore 'verbosity' setting - errors should + * always be displayed */ runloop_msg_queue_push( msg_hash_to_str(MSG_FAILED_TO_SET_INITIAL_DISK), 0, 60, @@ -765,11 +769,12 @@ bool disk_control_verify_initial_index(disk_control_interface_t *disk_control) * it is likely other notifications will be * generated before setting the disk index, and * we do not want to 'overwrite' them */ - runloop_msg_queue_push( - msg, - 0, msg_duration, - false, NULL, - MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); + if (verbosity) + runloop_msg_queue_push( + msg, + 0, msg_duration, + false, NULL, + MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); } return success; @@ -777,7 +782,8 @@ bool disk_control_verify_initial_index(disk_control_interface_t *disk_control) /* Saves current disk index to file, if supported * by current core */ -bool disk_control_save_image_index(disk_control_interface_t *disk_control) +bool disk_control_save_image_index( + disk_control_interface_t *disk_control) { if (!disk_control) return false; diff --git a/disk_control_interface.h b/disk_control_interface.h index 1991b47300..695dad8fa8 100644 --- a/disk_control_interface.h +++ b/disk_control_interface.h @@ -167,11 +167,14 @@ bool disk_control_set_initial_index( * if functionality is supported by core * NOTE: Must be called immediately after * loading content */ -bool disk_control_verify_initial_index(disk_control_interface_t *disk_control); +bool disk_control_verify_initial_index( + disk_control_interface_t *disk_control, + bool verbosity); /* Saves current disk index to file, if supported * by current core */ -bool disk_control_save_image_index(disk_control_interface_t *disk_control); +bool disk_control_save_image_index( + disk_control_interface_t *disk_control); RETRO_END_DECLS diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 96f38a9db2..c3111c8163 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -4332,6 +4332,10 @@ MSG_HASH( MENU_ENUM_LABEL_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD, "notification_show_config_override_load" ) +MSG_HASH( + MENU_ENUM_LABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK, + "notification_show_set_initial_disk" + ) MSG_HASH( MENU_ENUM_LABEL_NOTIFICATION_SHOW_FAST_FORWARD, "notification_show_fast_forward" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 7c71719a46..7f478bef0f 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -3428,6 +3428,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD, "Display an on-screen message when loading configuration override files." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SET_INITIAL_DISK, + "Initial Disc Restored Notifications" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK, + "Display an on-screen message when automatically restoring at launch the last used disc of multi-disc content loaded via M3U playlists." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_FAST_FORWARD, "Fast-Forward Notifications" diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index dbba7f8858..e0f9e2cb31 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -385,6 +385,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_cheats_applied, M #endif DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_remap_load, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_REMAP_LOAD) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_config_override_load, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_set_initial_disk, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_fast_forward, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_FAST_FORWARD) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_width, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_height, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT) @@ -3000,6 +3001,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_notification_show_config_override_load); break; + case MENU_ENUM_LABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_notification_show_set_initial_disk); + break; case MENU_ENUM_LABEL_NOTIFICATION_SHOW_FAST_FORWARD: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_notification_show_fast_forward); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 8adef02a3d..a4250ffe88 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7564,6 +7564,7 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_NOTIFICATION_SHOW_CHEATS_APPLIED, PARSE_ONLY_BOOL, true }, {MENU_ENUM_LABEL_NOTIFICATION_SHOW_REMAP_LOAD, PARSE_ONLY_BOOL, true }, {MENU_ENUM_LABEL_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD, PARSE_ONLY_BOOL, true }, + {MENU_ENUM_LABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK, PARSE_ONLY_BOOL, true }, {MENU_ENUM_LABEL_NOTIFICATION_SHOW_FAST_FORWARD, PARSE_ONLY_BOOL, true }, }; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 1b11b0687a..43c0781fd4 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -12634,6 +12634,21 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); + CONFIG_BOOL( + list, list_info, + &settings->bools.notification_show_set_initial_disk, + MENU_ENUM_LABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK, + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SET_INITIAL_DISK, + DEFAULT_NOTIFICATION_SHOW_SET_INITIAL_DISK, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); + CONFIG_BOOL( list, list_info, &settings->bools.notification_show_fast_forward, diff --git a/msg_hash.h b/msg_hash.h index e498cd09ea..abfd0de30c 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -2567,6 +2567,7 @@ enum msg_hash_enums MENU_LABEL(NOTIFICATION_SHOW_CHEATS_APPLIED), MENU_LABEL(NOTIFICATION_SHOW_REMAP_LOAD), MENU_LABEL(NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD), + MENU_LABEL(NOTIFICATION_SHOW_SET_INITIAL_DISK), MENU_LABEL(NOTIFICATION_SHOW_FAST_FORWARD), MENU_LABEL(SELECT_FILE), diff --git a/retroarch.c b/retroarch.c index c0074a134d..167778bdb6 100644 --- a/retroarch.c +++ b/retroarch.c @@ -14737,6 +14737,7 @@ static bool command_event_init_core( bool auto_remaps_enable = settings->bools.auto_remaps_enable; const char *dir_input_remapping = settings->paths.directory_input_remapping; #endif + bool show_set_initial_disk_msg = settings->bools.notification_show_set_initial_disk; unsigned poll_type_behavior = settings->uints.input_poll_type_behavior; float fastforward_ratio = settings->floats.fastforward_ratio; rarch_system_info_t *sys_info = &p_rarch->runloop_system; @@ -14813,7 +14814,8 @@ static bool command_event_init_core( return false; /* Verify that initial disk index was set correctly */ - disk_control_verify_initial_index(&sys_info->disk_control); + disk_control_verify_initial_index(&sys_info->disk_control, + show_set_initial_disk_msg); if (!core_load(p_rarch, poll_type_behavior)) return false; diff --git a/ui/drivers/qt/options/osd.cpp b/ui/drivers/qt/options/osd.cpp index 01b07e0ecb..ef777cac49 100644 --- a/ui/drivers/qt/options/osd.cpp +++ b/ui/drivers/qt/options/osd.cpp @@ -62,6 +62,7 @@ QWidget *NotificationsPage::widget() notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_AUTOCONFIG); notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_REMAP_LOAD); notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD); + notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK); notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_FAST_FORWARD); layout->addWidget(notificationsGroup);