From 69949187f67f7b60a82cf133b1feb97224858340 Mon Sep 17 00:00:00 2001 From: meleu Date: Fri, 15 May 2020 11:00:48 -0300 Subject: [PATCH] add cheevos_start_active option --- cheevos-new/cheevos.c | 35 ++++++++++++++++++++------ configuration.c | 7 +++--- configuration.h | 1 + intl/msg_hash_lbl.h | 4 +++ intl/msg_hash_us.h | 8 ++++++ menu/cbs/menu_cbs_sublabel.c | 10 +++++--- menu/menu_displaylist.c | 49 ++++++++++++++++++------------------ menu/menu_setting.c | 20 +++++++++++++-- msg_hash.h | 1 + retroarch.cfg | 10 +++++--- 10 files changed, 102 insertions(+), 43 deletions(-) diff --git a/cheevos-new/cheevos.c b/cheevos-new/cheevos.c index b185579258..51c076a582 100644 --- a/cheevos-new/cheevos.c +++ b/cheevos-new/cheevos.c @@ -1552,7 +1552,7 @@ static int rcheevos_prepare_hash_psx(rcheevos_coro_t* coro) /* find the data track - it should be the first one */ coro->track = cdfs_open_data_track(coro->path); - + if (!coro->track) { CHEEVOS_LOG(RCHEEVOS_TAG "could not open CD\n"); @@ -1991,7 +1991,8 @@ found: * Inputs: CHEEVOS_VAR_GAMEID * Outputs: */ - CORO_GOSUB(RCHEEVOS_DEACTIVATE); + if (!coro->settings->bools.cheevos_start_active) + CORO_GOSUB(RCHEEVOS_DEACTIVATE); /* * Inputs: CHEEVOS_VAR_GAMEID @@ -2021,15 +2022,33 @@ found: if (!number_of_unsupported) { - snprintf(msg, sizeof(msg), - "You have %d of %d achievements unlocked.", - number_of_unlocked, rcheevos_locals.patchdata.core_count); + if (coro->settings->bools.cheevos_start_active) { + snprintf(msg, sizeof(msg), + "All %d achievements activated for this session.", + rcheevos_locals.patchdata.core_count); + } + else + { + snprintf(msg, sizeof(msg), + "You have %d of %d achievements unlocked.", + number_of_unlocked, rcheevos_locals.patchdata.core_count); + } } else { - snprintf(msg, sizeof(msg), - "You have %d of %d achievements unlocked (%d unsupported).", - number_of_unlocked - number_of_unsupported, rcheevos_locals.patchdata.core_count, number_of_unsupported); + if (coro->settings->bools.cheevos_start_active) { + snprintf(msg, sizeof(msg), + "All %d achievements activated for this session (%d unsupported).", + rcheevos_locals.patchdata.core_count, + number_of_unsupported); + } + else{ + snprintf(msg, sizeof(msg), + "You have %d of %d achievements unlocked (%d unsupported).", + number_of_unlocked - number_of_unsupported, + rcheevos_locals.patchdata.core_count, + number_of_unsupported); + } } msg[sizeof(msg) - 1] = 0; diff --git a/configuration.c b/configuration.c index 34dac4fd8c..7299146e05 100644 --- a/configuration.c +++ b/configuration.c @@ -332,7 +332,7 @@ static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_XENON360; #elif defined(HAVE_D3D11) static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_D3D11; #elif defined(HAVE_D3D12) -/* FIXME/WARNING: DX12 performance on Xbox is horrible for +/* FIXME/WARNING: DX12 performance on Xbox is horrible for * some reason. For now, we will default to D3D11 when possible. */ static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_D3D12; #elif defined(HAVE_D3D10) @@ -1588,6 +1588,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("cheevos_verbose_enable", &settings->bools.cheevos_verbose_enable, true, false, false); SETTING_BOOL("cheevos_auto_screenshot", &settings->bools.cheevos_auto_screenshot, true, false, false); SETTING_BOOL("cheevos_badges_enable", &settings->bools.cheevos_badges_enable, true, false, false); + SETTING_BOOL("cheevos_start_active", &settings->bools.cheevos_start_active, true, false, false); #endif #ifdef HAVE_OVERLAY SETTING_BOOL("input_overlay_enable", &settings->bools.input_overlay_enable, true, config_overlay_enable_default(), false); @@ -2674,7 +2675,7 @@ static config_file_t *open_default_config_file(void) skeleton_conf[0] = '\0'; - /* Build a retroarch.cfg path from the + /* Build a retroarch.cfg path from the * global config directory (/etc). */ fill_pathname_join(skeleton_conf, GLOBAL_CONFIG_DIR, file_path_str(FILE_PATH_MAIN_CONFIG), path_size); @@ -2689,7 +2690,7 @@ static config_file_t *open_default_config_file(void) if (conf) { - /* Since this is a clean config file, we can + /* Since this is a clean config file, we can * safely use config_save_on_exit. */ config_set_bool(conf, "config_save_on_exit", true); saved = config_file_write(conf, conf_path, true); diff --git a/configuration.h b/configuration.h index 0363cb7121..fb24ef8c40 100644 --- a/configuration.h +++ b/configuration.h @@ -304,6 +304,7 @@ typedef struct settings bool cheevos_badges_enable; bool cheevos_verbose_enable; bool cheevos_auto_screenshot; + bool cheevos_start_active; /* Camera */ bool camera_allow; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index b14c5e66f3..ce3db58484 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -368,6 +368,10 @@ MSG_HASH( MENU_ENUM_LABEL_CHEEVOS_AUTO_SCREENSHOT, "cheevos_auto_screenshot" ) +MSG_HASH( + MENU_ENUM_LABEL_CHEEVOS_START_ACTIVE, + "cheevos_start_active" + ) MSG_HASH( MENU_ENUM_LABEL_CLOSE_CONTENT, "unload_core" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 0af56c7a4d..422999fc8d 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -4155,6 +4155,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_CHEEVOS_AUTO_SCREENSHOT, "Automatically take a screenshot when an achievement is triggered." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CHEEVOS_START_ACTIVE, + "Start Active" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CHEEVOS_START_ACTIVE, + "Start the session with all achievements active (even the ones you previously unlocked)." + ) /* Settings > Network */ diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 6aff97f596..6c8e8ab826 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -169,6 +169,7 @@ default_sublabel_macro(action_bind_sublabel_cheevos_richpresence_enable, MENU_ default_sublabel_macro(action_bind_sublabel_cheevos_badges_enable, MENU_ENUM_SUBLABEL_CHEEVOS_BADGES_ENABLE) default_sublabel_macro(action_bind_sublabel_cheevos_verbose_enable, MENU_ENUM_SUBLABEL_CHEEVOS_VERBOSE_ENABLE) default_sublabel_macro(action_bind_sublabel_cheevos_auto_screenshot, MENU_ENUM_SUBLABEL_CHEEVOS_AUTO_SCREENSHOT) +default_sublabel_macro(action_bind_sublabel_cheevos_start_active, MENU_ENUM_SUBLABEL_CHEEVOS_START_ACTIVE) default_sublabel_macro(action_bind_sublabel_menu_views_settings_list, MENU_ENUM_SUBLABEL_MENU_VIEWS_SETTINGS) default_sublabel_macro(action_bind_sublabel_quick_menu_views_settings_list, MENU_ENUM_SUBLABEL_QUICK_MENU_VIEWS_SETTINGS) default_sublabel_macro(action_bind_sublabel_settings_views_settings_list, MENU_ENUM_SUBLABEL_SETTINGS_VIEWS_SETTINGS) @@ -1111,14 +1112,14 @@ static int action_bind_sublabel_playlist_entry( /* Only add sublabel if a core is currently assigned * > Both core name and core path must be valid */ - if ( string_is_empty(entry->core_name) || + if ( string_is_empty(entry->core_name) || string_is_equal(entry->core_name, "DETECT") || string_is_empty(entry->core_path) || string_is_equal(entry->core_path, "DETECT")) return 0; /* Add core name */ - strlcpy(s, + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), len); strlcat(s, " ", len); strlcat(s, entry->core_name, len); @@ -1224,7 +1225,7 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, info_range_list_t info_list[] = { { MENU_SETTINGS_INPUT_DESC_KBD_BEGIN, - MENU_SETTINGS_INPUT_DESC_KBD_END, + MENU_SETTINGS_INPUT_DESC_KBD_END, action_bind_sublabel_remap_kbd_sublabel }, #ifdef HAVE_AUDIOMIXER @@ -2746,6 +2747,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_CHEEVOS_AUTO_SCREENSHOT: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheevos_auto_screenshot); break; + case MENU_ENUM_LABEL_CHEEVOS_START_ACTIVE: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheevos_start_active); + break; case MENU_ENUM_LABEL_SETTINGS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_settings); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 3c9e5815f0..6fcd6cc379 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -101,7 +101,7 @@ #include "../runtime_file.h" #include "../manual_content_scan.h" -/* TODO/FIXME - globals - need to find a way to +/* TODO/FIXME - globals - need to find a way to * get rid of these */ static char new_path_entry[4096] = {0}; static char new_lbl_entry[4096] = {0}; @@ -2259,7 +2259,7 @@ static int menu_displaylist_parse_horizontal_content_actions( MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST, FILE_TYPE_PLAYLIST_ENTRY, 0, 0); } - if ( settings->bools.quick_menu_show_set_core_association && + if ( settings->bools.quick_menu_show_set_core_association && !settings->bools.kiosk_mode_enable) { menu_entries_append_enum(info->list, @@ -2269,7 +2269,7 @@ static int menu_displaylist_parse_horizontal_content_actions( } if ( - settings->bools.quick_menu_show_reset_core_association && + settings->bools.quick_menu_show_reset_core_association && !settings->bools.kiosk_mode_enable) { menu_entries_append_enum(info->list, @@ -2289,7 +2289,7 @@ static int menu_displaylist_parse_horizontal_content_actions( #ifdef HAVE_NETWORKING if ( - settings->bools.quick_menu_show_download_thumbnails && + settings->bools.quick_menu_show_download_thumbnails && !settings->bools.kiosk_mode_enable) { bool download_enabled = true; @@ -2321,7 +2321,7 @@ static int menu_displaylist_parse_horizontal_content_actions( !string_is_equal(system, "music_history") && !string_is_equal(system, "video_history"); } - + if (settings->bools.network_on_demand_thumbnails) download_enabled = false; @@ -4068,13 +4068,13 @@ static unsigned menu_displaylist_populate_subsystem( unsigned i = 0; int n = 0; bool is_rgui = string_is_equal(menu_driver, "rgui"); - + /* Select appropriate 'star' marker for subsystem menu entries * (i.e. RGUI does not support unicode, so use a 'standard' * character fallback) */ snprintf(star_char, sizeof(star_char), "%s", is_rgui ? "*" : utf8_star_char); - + if (menu_displaylist_has_subsystems()) { for (i = 0; i < subsystem_current_count; i++, subsystem++) @@ -4088,13 +4088,13 @@ static unsigned menu_displaylist_populate_subsystem( "Load %s %s", subsystem->desc, star_char); - + /* If using RGUI with sublabels disabled, add the * appropriate text to the menu entry itself... */ if (is_rgui && !menu_show_sublabels) { char tmp[PATH_MAX_LENGTH]; - + n = snprintf(tmp, sizeof(tmp), "%s [%s %s]", s, "Current Content:", subsystem->roms[content_get_subsystem_rom_id()].desc); @@ -4121,7 +4121,7 @@ static unsigned menu_displaylist_populate_subsystem( strlcpy(s, tmp, sizeof(s)); } - + if (menu_entries_append_enum(list, s, msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD), @@ -4135,7 +4135,7 @@ static unsigned menu_displaylist_populate_subsystem( "Start %s %s", subsystem->desc, star_char); - + /* If using RGUI with sublabels disabled, add the * appropriate text to the menu entry itself... */ if (is_rgui && !menu_show_sublabels) @@ -4156,7 +4156,7 @@ static unsigned menu_displaylist_populate_subsystem( if (!string_is_empty(rom_buff)) { n = snprintf(tmp, sizeof(tmp), "%s [%s]", s, rom_buff); - + /* More snprintf() gcc warning suppression... */ if ((n < 0) || (n >= PATH_MAX_LENGTH)) { @@ -4165,11 +4165,11 @@ static unsigned menu_displaylist_populate_subsystem( RARCH_WARN("Menu subsystem entry: Description label truncated.\n"); } } - + strlcpy(s, tmp, sizeof(s)); } } - + if (menu_entries_append_enum(list, s, msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_LOAD), @@ -4183,7 +4183,7 @@ static unsigned menu_displaylist_populate_subsystem( snprintf(s, sizeof(s), "Load %s", subsystem->desc); - + /* If using RGUI with sublabels disabled, add the * appropriate text to the menu entry itself... */ if (is_rgui && !menu_show_sublabels) @@ -4194,11 +4194,11 @@ static unsigned menu_displaylist_populate_subsystem( if (subsystem->num_roms > 0) { char tmp[PATH_MAX_LENGTH]; - + n = snprintf(tmp, sizeof(tmp), "%s [%s %s]", s, "Current Content:", subsystem->roms[0].desc); - + /* More snprintf() gcc warning suppression... */ if ((n < 0) || (n >= PATH_MAX_LENGTH)) { @@ -4211,7 +4211,7 @@ static unsigned menu_displaylist_populate_subsystem( strlcpy(s, tmp, sizeof(s)); } } - + if (menu_entries_append_enum(list, s, msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD), @@ -4238,7 +4238,7 @@ unsigned menu_displaylist_build_list( case DISPLAYLIST_SUBSYSTEM_SETTINGS_LIST: { const struct retro_subsystem_info* subsystem = subsystem_data; - rarch_system_info_t *sys_info = + rarch_system_info_t *sys_info = runloop_get_system_info(); /* Core not loaded completely, use the data we * peeked on load core */ @@ -5490,12 +5490,12 @@ unsigned menu_displaylist_build_list( bool show_hidden_files = settings->bools.show_hidden_files; #ifdef HAVE_LIBRETRODB const char *path_content_database = settings->paths.path_content_database; - struct string_list *system_name_list = + struct string_list *system_name_list = manual_content_scan_get_menu_system_name_list( path_content_database, show_hidden_files); #else - struct string_list *system_name_list = + struct string_list *system_name_list = manual_content_scan_get_menu_system_name_list(NULL, show_hidden_files); #endif @@ -5540,7 +5540,7 @@ unsigned menu_displaylist_build_list( case DISPLAYLIST_DROPDOWN_LIST_MANUAL_CONTENT_SCAN_CORE_NAME: { /* Get core name list */ - struct string_list *core_name_list = + struct string_list *core_name_list = manual_content_scan_get_menu_core_name_list(); if (core_name_list) @@ -6075,6 +6075,7 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_CHEEVOS_TEST_UNOFFICIAL, PARSE_ONLY_BOOL, false }, {MENU_ENUM_LABEL_CHEEVOS_VERBOSE_ENABLE, PARSE_ONLY_BOOL, false }, {MENU_ENUM_LABEL_CHEEVOS_AUTO_SCREENSHOT, PARSE_ONLY_BOOL, false }, + {MENU_ENUM_LABEL_CHEEVOS_START_ACTIVE, PARSE_ONLY_BOOL, false }, }; for (i = 0; i < ARRAY_SIZE(build_list); i++) @@ -6677,7 +6678,7 @@ unsigned menu_displaylist_build_list( count++; } } - + { settings_t *settings = config_get_ptr(); bool runahead_enabled = settings->bools.run_ahead_enabled; @@ -7738,7 +7739,7 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list) bool menu_displaylist_has_subsystems(void) { const struct retro_subsystem_info* subsystem = subsystem_data; - rarch_system_info_t *sys_info = + rarch_system_info_t *sys_info = runloop_get_system_info(); /* Core not loaded completely, use the data we * peeked on load core */ diff --git a/menu/menu_setting.c b/menu/menu_setting.c index d0cd342925..6f92962843 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2581,7 +2581,7 @@ static int setting_action_ok_bind_all_save_autoconfig(rarch_setting_t *setting, index_offset = setting->index_offset; name = input_config_get_device_name(index_offset); - if (!string_is_empty(name) && + if (!string_is_empty(name) && config_save_autoconf_profile(name, index_offset)) runloop_msg_queue_push( msg_hash_to_str(MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY), 1, 100, true, @@ -7135,7 +7135,7 @@ static void change_handler_video_layout_enable(rarch_setting_t *setting) static void change_handler_video_layout_path(rarch_setting_t *setting) { settings_t *settings = config_get_ptr(); - configuration_set_uint(settings, + configuration_set_uint(settings, settings->uints.video_layout_selected_view, 0); video_layout_load(setting->value.target.string); @@ -15936,6 +15936,22 @@ static bool setting_append_list( SD_FLAG_NONE ); + CONFIG_BOOL( + list, list_info, + &settings->bools.cheevos_start_active, + MENU_ENUM_LABEL_CHEEVOS_START_ACTIVE, + MENU_ENUM_LABEL_VALUE_CHEEVOS_START_ACTIVE, + false, + 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.cheevos_hardcore_mode_enable, diff --git a/msg_hash.h b/msg_hash.h index e489f3e457..8c0f065e02 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1238,6 +1238,7 @@ enum msg_hash_enums MENU_LABEL(CHEEVOS_TEST_UNOFFICIAL), MENU_LABEL(CHEEVOS_VERBOSE_ENABLE), MENU_LABEL(CHEEVOS_AUTO_SCREENSHOT), + MENU_LABEL(CHEEVOS_START_ACTIVE), MENU_LABEL(CHEEVOS_ENABLE), MENU_LABEL(CHEEVOS_DESCRIPTION), MENU_LABEL(ACCOUNTS_RETRO_ACHIEVEMENTS), diff --git a/retroarch.cfg b/retroarch.cfg index 2f20ebe700..07eccebafa 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -851,8 +851,8 @@ # cheevos_enable = false # RetroAchievements.org credentials. -# cheevos_username = -# cheevos_password = +# cheevos_username = +# cheevos_password = # The hardcore mode disables savestates and cheating features, but it # makes the achievements points double. @@ -875,7 +875,11 @@ # Send some messages to the RetroAchievements.org saying, for example, # where you are in the game, how many lives you have, your score, etc. -# cheevos_richpresence_enable = false +# cheevos_richpresence_enable = true + +# Even after unlocking achievements in previous sessions, you may still want +# to see them triggering in the current session. +# cheevos_start_active = false # Unnoficial achievements are used only for achievement creators and testers. # cheevos_test_unofficial = false