From 3246bc6655eebbe6f2171fe79bc0f7fbf3cd37b4 Mon Sep 17 00:00:00 2001 From: sonninnos <45124675+sonninnos@users.noreply.github.com> Date: Fri, 18 Aug 2023 22:38:36 +0300 Subject: [PATCH] Add visibility option for save state notifications (#15616) --- config.def.h | 3 +++ configuration.c | 1 + configuration.h | 1 + intl/msg_hash_lbl.h | 4 ++++ intl/msg_hash_us.h | 8 ++++++++ menu/cbs/menu_cbs_sublabel.c | 4 ++++ menu/menu_displaylist.c | 11 ++++++----- menu/menu_setting.c | 15 +++++++++++++++ msg_hash.h | 1 + tasks/task_save.c | 11 +++++++++++ ui/drivers/qt/qt_options.cpp | 1 + 11 files changed, 55 insertions(+), 5 deletions(-) diff --git a/config.def.h b/config.def.h index bfddfb4055..fbbb5a085d 100644 --- a/config.def.h +++ b/config.def.h @@ -1047,6 +1047,9 @@ * at launch the last used disk of multi-disk content */ #define DEFAULT_NOTIFICATION_SHOW_SET_INITIAL_DISK true +/* Display save state notifications */ +#define DEFAULT_NOTIFICATION_SHOW_SAVE_STATE true + /* Display a notification when fast forwarding * content */ #define DEFAULT_NOTIFICATION_SHOW_FAST_FORWARD true diff --git a/configuration.c b/configuration.c index b03630c73e..2086977eae 100644 --- a/configuration.c +++ b/configuration.c @@ -1821,6 +1821,7 @@ static struct config_bool_setting *populate_settings_bool( 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_save_state", &settings->bools.notification_show_save_state, true, DEFAULT_NOTIFICATION_SHOW_SAVE_STATE, false); SETTING_BOOL("notification_show_fast_forward", &settings->bools.notification_show_fast_forward, true, DEFAULT_NOTIFICATION_SHOW_FAST_FORWARD, false); #ifdef HAVE_SCREENSHOTS SETTING_BOOL("notification_show_screenshot", &settings->bools.notification_show_screenshot, true, DEFAULT_NOTIFICATION_SHOW_SCREENSHOT, false); diff --git a/configuration.h b/configuration.h index 4145a8d14a..374c9766e5 100644 --- a/configuration.h +++ b/configuration.h @@ -680,6 +680,7 @@ typedef struct settings bool notification_show_remap_load; bool notification_show_config_override_load; bool notification_show_set_initial_disk; + bool notification_show_save_state; bool notification_show_fast_forward; #ifdef HAVE_SCREENSHOTS bool notification_show_screenshot; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 5b2db27a4b..6234986c9a 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -5886,6 +5886,10 @@ MSG_HASH( MENU_ENUM_LABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK, "notification_show_set_initial_disk" ) +MSG_HASH( + MENU_ENUM_LABEL_NOTIFICATION_SHOW_SAVE_STATE, + "notification_show_save_state" + ) 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 8fd1e54894..d450dc358e 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -5326,6 +5326,14 @@ 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_SAVE_STATE, + "Save State Notifications" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SAVE_STATE, + "Display an on-screen message when saving and loading save states." + ) 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 9ac77176fc..2f81b15c5f 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -625,6 +625,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_patch_applied, M 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_save_state, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SAVE_STATE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_fast_forward, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_FAST_FORWARD) #ifdef HAVE_SCREENSHOTS DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_screenshot, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SCREENSHOT) @@ -4159,6 +4160,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, 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_SAVE_STATE: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_notification_show_save_state); + 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 24cfc83640..4757fc7fce 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -9975,10 +9975,8 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_STATISTICS_SHOW, PARSE_ONLY_BOOL, false }, {MENU_ENUM_LABEL_MEMORY_SHOW, PARSE_ONLY_BOOL, false }, {MENU_ENUM_LABEL_MEMORY_UPDATE_INTERVAL, PARSE_ONLY_UINT, false }, -#if defined(HAVE_NETWORKING) && defined(HAVE_GFX_WIDGETS) - {MENU_ENUM_LABEL_NETPLAY_PING_SHOW, PARSE_ONLY_BOOL, false }, -#endif {MENU_ENUM_LABEL_MENU_SHOW_LOAD_CONTENT_ANIMATION, PARSE_ONLY_BOOL, false }, + {MENU_ENUM_LABEL_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE, PARSE_ONLY_BOOL, false }, {MENU_ENUM_LABEL_NOTIFICATION_SHOW_AUTOCONFIG, PARSE_ONLY_BOOL, false }, #ifdef HAVE_CHEATS {MENU_ENUM_LABEL_NOTIFICATION_SHOW_CHEATS_APPLIED, PARSE_ONLY_BOOL, false }, @@ -9989,7 +9987,9 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_NOTIFICATION_SHOW_REMAP_LOAD, PARSE_ONLY_BOOL, false }, {MENU_ENUM_LABEL_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD, PARSE_ONLY_BOOL, false }, {MENU_ENUM_LABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK, PARSE_ONLY_BOOL, false }, + {MENU_ENUM_LABEL_NOTIFICATION_SHOW_SAVE_STATE, PARSE_ONLY_BOOL, false }, {MENU_ENUM_LABEL_NOTIFICATION_SHOW_FAST_FORWARD, PARSE_ONLY_BOOL, false }, + {MENU_ENUM_LABEL_NOTIFICATION_SHOW_REFRESH_RATE, PARSE_ONLY_BOOL, false }, #ifdef HAVE_SCREENSHOTS {MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT, PARSE_ONLY_BOOL, false }, #ifdef HAVE_GFX_WIDGETS @@ -9997,11 +9997,12 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH, PARSE_ONLY_UINT, false }, #endif #endif - {MENU_ENUM_LABEL_NOTIFICATION_SHOW_REFRESH_RATE, PARSE_ONLY_BOOL, false }, +#if defined(HAVE_NETWORKING) && defined(HAVE_GFX_WIDGETS) + {MENU_ENUM_LABEL_NETPLAY_PING_SHOW, PARSE_ONLY_BOOL, false }, +#endif #ifdef HAVE_NETWORKING {MENU_ENUM_LABEL_NOTIFICATION_SHOW_NETPLAY_EXTRA, PARSE_ONLY_BOOL, false }, #endif - {MENU_ENUM_LABEL_NOTIFICATION_SHOW_WHEN_MENU_IS_ALIVE, PARSE_ONLY_BOOL, false }, }; for (i = 0; i < ARRAY_SIZE(build_list); i++) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index a71688789b..53683a9b8c 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -16082,6 +16082,21 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); + CONFIG_BOOL( + list, list_info, + &settings->bools.notification_show_save_state, + MENU_ENUM_LABEL_NOTIFICATION_SHOW_SAVE_STATE, + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SAVE_STATE, + DEFAULT_NOTIFICATION_SHOW_SAVE_STATE, + 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 c11f8c112d..fce4a14f2d 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -3592,6 +3592,7 @@ enum msg_hash_enums MENU_LABEL(NOTIFICATION_SHOW_REMAP_LOAD), MENU_LABEL(NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD), MENU_LABEL(NOTIFICATION_SHOW_SET_INITIAL_DISK), + MENU_LABEL(NOTIFICATION_SHOW_SAVE_STATE), MENU_LABEL(NOTIFICATION_SHOW_FAST_FORWARD), MENU_LABEL(NOTIFICATION_SHOW_SCREENSHOT), MENU_LABEL(NOTIFICATION_SHOW_SCREENSHOT_DURATION), diff --git a/tasks/task_save.c b/tasks/task_save.c index 615991a3b8..859f1629c7 100644 --- a/tasks/task_save.c +++ b/tasks/task_save.c @@ -903,11 +903,15 @@ static bool task_push_undo_save_state(const char *path, void *data, size_t size) if (settings->bools.savestate_file_compression) state->flags |= SAVE_TASK_FLAG_COMPRESS_FILES; #endif + if (!settings->bools.notification_show_save_state) + state->flags |= SAVE_TASK_FLAG_MUTE; + task->type = TASK_TYPE_BLOCKING; task->state = state; task->handler = task_save_handler; task->callback = undo_save_state_cb; task->title = strdup(msg_hash_to_str(MSG_UNDOING_SAVE_STATE)); + task->mute = (state->flags & SAVE_TASK_FLAG_MUTE) ? true : false; task_queue_push(task); @@ -1467,6 +1471,8 @@ static void task_push_save_state(const char *path, void *data, size_t size, bool if (settings->bools.savestate_file_compression) state->flags |= SAVE_TASK_FLAG_COMPRESS_FILES; #endif + if (!settings->bools.notification_show_save_state) + state->flags |= SAVE_TASK_FLAG_MUTE; task->type = TASK_TYPE_BLOCKING; task->state = state; @@ -1571,6 +1577,8 @@ static void task_push_load_and_save_state(const char *path, void *data, if (settings->bools.savestate_file_compression) state->flags |= SAVE_TASK_FLAG_COMPRESS_FILES; #endif + if (!settings->bools.notification_show_save_state) + state->flags |= SAVE_TASK_FLAG_MUTE; task->state = state; task->type = TASK_TYPE_BLOCKING; @@ -1780,12 +1788,15 @@ bool content_load_state(const char *path, if (settings->bools.savestate_file_compression) state->flags |= SAVE_TASK_FLAG_COMPRESS_FILES; #endif + if (!settings->bools.notification_show_save_state) + state->flags |= SAVE_TASK_FLAG_MUTE; task->type = TASK_TYPE_BLOCKING; task->state = state; task->handler = task_load_handler; task->callback = content_load_state_cb; task->title = strdup(msg_hash_to_str(MSG_LOADING_STATE)); + task->mute = (state->flags & SAVE_TASK_FLAG_MUTE) ? true : false; task_queue_push(task); diff --git a/ui/drivers/qt/qt_options.cpp b/ui/drivers/qt/qt_options.cpp index d8a90a7f2e..acd38ab4cf 100644 --- a/ui/drivers/qt/qt_options.cpp +++ b/ui/drivers/qt/qt_options.cpp @@ -642,6 +642,7 @@ QWidget *NotificationsPage::widget() 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_SAVE_STATE); notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_FAST_FORWARD); notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_CHEATS_APPLIED); notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT);