From 3744108790607cf20482b3967f82cd4eba7e7946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s?= Date: Thu, 23 Nov 2017 20:49:42 -0500 Subject: [PATCH] Revert "use a single list for achievements" --- cheevos/cheevos.c | 165 ++++++++++++------------------ cheevos/cheevos.h | 2 +- intl/msg_hash_lbl.h | 2 - intl/msg_hash_us.h | 4 - menu/cbs/menu_cbs_deferred_push.c | 11 ++ menu/cbs/menu_cbs_get_value.c | 19 ---- menu/cbs/menu_cbs_sublabel.c | 1 - menu/cbs/menu_cbs_title.c | 4 + menu/menu_displaylist.c | 15 ++- menu/menu_displaylist.h | 3 +- msg_hash.h | 2 +- 11 files changed, 98 insertions(+), 130 deletions(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 79f2562b42..575ac7d0b1 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -2138,7 +2138,7 @@ void cheevos_reset_game(void) cheevo->last = 1; } -void cheevos_populate_menu(void *data) +void cheevos_populate_menu(void *data, bool hardcore) { #ifdef HAVE_MENU unsigned i; @@ -2151,30 +2151,39 @@ void cheevos_populate_menu(void *data) for (i = 0; cheevo < end; i++, cheevo++) { - - if (!(cheevo->active & CHEEVOS_ACTIVE_HARDCORE)) + if (!hardcore) { - menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); - items_found++; - set_badge_info(&badges_ctx, i, cheevo->badge, (cheevo->active & CHEEVOS_ACTIVE_HARDCORE)); - } - else if (!(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)) - { - menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); - items_found++; - set_badge_info(&badges_ctx, i, cheevo->badge, (cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)); + if (!(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)) + { + menu_entries_append_enum(info->list, cheevo->title, + cheevo->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + items_found++; + } + else + { + menu_entries_append_enum(info->list, cheevo->title, + cheevo->description, MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + items_found++; + } } else { - menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); - items_found++; - set_badge_info(&badges_ctx, i, cheevo->badge, (cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)); + if (!(cheevo->active & CHEEVOS_ACTIVE_HARDCORE)) + { + menu_entries_append_enum(info->list, cheevo->title, + cheevo->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + items_found++; + } + else + { + menu_entries_append_enum(info->list, cheevo->title, + cheevo->description, MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + items_found++; + } } } @@ -2184,29 +2193,42 @@ void cheevos_populate_menu(void *data) end = cheevos_locals.unofficial.cheevos + cheevos_locals.unofficial.count; - if (!(cheevo->active & CHEEVOS_ACTIVE_HARDCORE)) + for (i = cheevos_locals.core.count; cheevo < end; i++, cheevo++) { - menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); - items_found++; - set_badge_info(&badges_ctx, i, cheevo->badge, (cheevo->active & CHEEVOS_ACTIVE_HARDCORE)); - } - else if (!(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)) - { - menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); - items_found++; - set_badge_info(&badges_ctx, i, cheevo->badge, (cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)); - } - else - { - menu_entries_append_enum(info->list, cheevo->title, - cheevo->description, MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); - items_found++; - set_badge_info(&badges_ctx, i, cheevo->badge, (cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)); + if (!hardcore) + { + if (!(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE)) + { + menu_entries_append_enum(info->list, cheevo->title, + cheevo->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + items_found++; + } + else + { + menu_entries_append_enum(info->list, cheevo->title, + cheevo->description, MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + items_found++; + } + } + else + { + if (!(cheevo->active & CHEEVOS_ACTIVE_HARDCORE)) + { + menu_entries_append_enum(info->list, cheevo->title, + cheevo->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + items_found++; + } + else + { + menu_entries_append_enum(info->list, cheevo->title, + cheevo->description, MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, + MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + items_found++; + } + } } } @@ -3135,63 +3157,6 @@ static int cheevos_iterate(coro_t* coro) CORO_RET(); /************************************************************************** -<<<<<<< Updated upstream -======= - * Info Gets the achievements from Retro Achievements - * Inputs CHEEVOS_VAR_GAMEID - * Outputs CHEEVOS_VAR_JSON - *************************************************************************/ - CORO_SUB(GET_BADGES) - - badges_ctx = new_badges_ctx; - - settings_t *settings = config_get_ptr(); - if (!string_is_equal(settings->arrays.menu_driver, "xmb") || - !settings->bools.cheevos_badges_enable) - CORO_RET(); - - CHEEVOS_VAR_CHEEVO_CURR = cheevos_locals.core.cheevos; - CHEEVOS_VAR_CHEEVO_END = cheevos_locals.core.cheevos + cheevos_locals.core.count; - - for (; CHEEVOS_VAR_CHEEVO_CURR < CHEEVOS_VAR_CHEEVO_END ; CHEEVOS_VAR_CHEEVO_CURR++) - { - for (CHEEVOS_VAR_J = 0 ; CHEEVOS_VAR_J < 2; CHEEVOS_VAR_J++) - { - CHEEVOS_VAR_BADGE_PATH[0] = '\0'; - fill_pathname_application_special(CHEEVOS_VAR_BADGE_BASE_PATH, sizeof(CHEEVOS_VAR_BADGE_BASE_PATH), - APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES); - - if (!path_is_directory(CHEEVOS_VAR_BADGE_BASE_PATH)) - path_mkdir(CHEEVOS_VAR_BADGE_BASE_PATH); - CORO_YIELD(); - if (CHEEVOS_VAR_J == 0) - snprintf(CHEEVOS_VAR_BADGE_NAME, sizeof(CHEEVOS_VAR_BADGE_NAME), "%s.png", CHEEVOS_VAR_CHEEVO_CURR->badge); - else - snprintf(CHEEVOS_VAR_BADGE_NAME, sizeof(CHEEVOS_VAR_BADGE_NAME), "%s_lock.png", CHEEVOS_VAR_CHEEVO_CURR->badge); - - fill_pathname_join(CHEEVOS_VAR_BADGE_PATH, CHEEVOS_VAR_BADGE_BASE_PATH, CHEEVOS_VAR_BADGE_NAME, sizeof(CHEEVOS_VAR_BADGE_PATH)); - - if (!badge_exists(CHEEVOS_VAR_BADGE_PATH)) - { - snprintf(CHEEVOS_VAR_URL, sizeof(CHEEVOS_VAR_URL), "http://i.retroachievements.org/Badge/%s", CHEEVOS_VAR_BADGE_NAME); - - CORO_GOSUB(HTTP_GET); - if (CHEEVOS_VAR_JSON != NULL) - { - if (filestream_write_file(CHEEVOS_VAR_BADGE_PATH, CHEEVOS_VAR_JSON, CHEEVOS_VAR_K)) - RARCH_ERR("[CHEEVOS]: error writing badge %s\n", CHEEVOS_VAR_BADGE_PATH); -#ifdef CHEEVOS_LOG_BADGES - RARCH_LOG("[CHEEVOS]: downloaded badge %s\n", CHEEVOS_VAR_BADGE_PATH); -#endif - } - } - } - } - - CORO_RET(); - - /************************************************************************** ->>>>>>> Stashed changes * Info Logs in the user at Retro Achievements *************************************************************************/ CORO_SUB(LOGIN) diff --git a/cheevos/cheevos.h b/cheevos/cheevos.h index cf2526e504..dedc017ec3 100644 --- a/cheevos/cheevos.h +++ b/cheevos/cheevos.h @@ -117,7 +117,7 @@ bool cheevos_load(const void *data); void cheevos_reset_game(void); -void cheevos_populate_menu(void *data); +void cheevos_populate_menu(void *data, bool hardcore); bool cheevos_get_description(cheevos_ctx_desc_t *desc); diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 2cf909eab3..fbf28f4ca6 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -148,8 +148,6 @@ MSG_HASH(MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ACHIEVEMENTS, "cheevos_unlocked_achievements") MSG_HASH(MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, "cheevos_unlocked_entry") -MSG_HASH(MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, - "cheevos_unlocked_entry_hardcore") MSG_HASH(MENU_ENUM_LABEL_CHEEVOS_USERNAME, "cheevos_username") MSG_HASH(MENU_ENUM_LABEL_CHEEVOS_VERBOSE_ENABLE, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index deda2721b9..a7f516c586 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -458,10 +458,6 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY, "Unlocked" ) -MSG_HASH( - MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY_HARDCORE, - "Hardcore" - ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CHEEVOS_VERBOSE_ENABLE, "Achievements Verbose Mode" diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 538198987c..8ab480aefd 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -78,6 +78,11 @@ static int deferred_push_achievement_list(menu_displaylist_info_t *info) return deferred_push_dlist(info, DISPLAYLIST_ACHIEVEMENT_LIST); } +static int deferred_push_achievement_list_hardcore(menu_displaylist_info_t *info) +{ + return deferred_push_dlist(info, DISPLAYLIST_ACHIEVEMENT_LIST_HARDCORE); +} + static int deferred_push_rdb_collection(menu_displaylist_info_t *info) { return deferred_push_dlist(info, DISPLAYLIST_PLAYLIST_COLLECTION); @@ -1528,6 +1533,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label( case MENU_ENUM_LABEL_ACHIEVEMENT_LIST: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_achievement_list); break; + case MENU_ENUM_LABEL_ACHIEVEMENT_LIST_HARDCORE: + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_achievement_list_hardcore); + break; case MENU_ENUM_LABEL_CORE_COUNTERS: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_core_counters); break; @@ -1760,6 +1768,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label( case MENU_LABEL_ACHIEVEMENT_LIST: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_achievement_list); break; + case MENU_LABEL_ACHIEVEMENT_LIST_HARDCORE: + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_achievement_list_hardcore); + break; case MENU_LABEL_CORE_COUNTERS: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_core_counters); break; diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 508121696a..183dfe2305 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -94,21 +94,6 @@ static void menu_action_setting_disp_set_label_cheevos_unlocked_entry( msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY), len); } -static void menu_action_setting_disp_set_label_cheevos_unlocked_entry_hardcore( - file_list_t* list, - unsigned *w, unsigned type, unsigned i, - const char *label, - char *s, size_t len, - const char *entry_label, - const char *path, - char *s2, size_t len2) -{ - *w = 19; - strlcpy(s2, path, len2); - strlcpy(s, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY_HARDCORE), len); -} - static void menu_action_setting_disp_set_label_remap_file_load( file_list_t* list, unsigned *w, unsigned type, unsigned i, @@ -1991,10 +1976,6 @@ int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs, BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_cheevos_unlocked_entry); return 0; - case MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY_HARDCORE: - BIND_ACTION_GET_VALUE(cbs, - menu_action_setting_disp_set_label_cheevos_unlocked_entry_hardcore); - return 0; case MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY: BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_cheevos_locked_entry); diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 9367b4fb9c..9b1013905a 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -1246,7 +1246,6 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_shared_context); break; case MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY: - case MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY_HARDCORE: case MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheevos_entry); break; diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index d01c701c23..7cb532788e 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -189,6 +189,7 @@ default_fill_title_macro(action_get_title_collection, MENU_ENUM_LABE default_title_copy_macro(action_get_title_help, MENU_ENUM_LABEL_VALUE_HELP_LIST) default_title_copy_macro(action_get_title_input_settings, MENU_ENUM_LABEL_VALUE_INPUT_SETTINGS) default_title_copy_macro(action_get_title_cheevos_list, MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST) +default_title_copy_macro(action_get_title_cheevos_list_hardcore, MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST_HARDCORE) default_title_copy_macro(action_get_title_video_shader_parameters,MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS) default_title_copy_macro(action_get_title_video_shader_preset_parameters,MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS) @@ -1017,6 +1018,9 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_ACHIEVEMENT_LIST: BIND_ACTION_GET_TITLE(cbs, action_get_title_cheevos_list); break; + case MENU_LABEL_ACHIEVEMENT_LIST_HARDCORE: + BIND_ACTION_GET_TITLE(cbs, action_get_title_cheevos_list_hardcore); + break; case MENU_LABEL_VIDEO_SHADER_PARAMETERS: BIND_ACTION_GET_TITLE(cbs, action_get_title_video_shader_parameters); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index d97852b039..e4dd8450d1 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2954,6 +2954,11 @@ static int menu_displaylist_parse_load_content_settings( msg_hash_to_str(MENU_ENUM_LABEL_ACHIEVEMENT_LIST), MENU_ENUM_LABEL_ACHIEVEMENT_LIST, MENU_SETTING_ACTION, 0, 0); + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST_HARDCORE), + msg_hash_to_str(MENU_ENUM_LABEL_ACHIEVEMENT_LIST_HARDCORE), + MENU_ENUM_LABEL_ACHIEVEMENT_LIST_HARDCORE, + MENU_SETTING_ACTION, 0, 0); } #endif } @@ -4735,7 +4740,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_ACHIEVEMENT_LIST: #ifdef HAVE_CHEEVOS menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - cheevos_populate_menu(info); + cheevos_populate_menu(info, false); + info->need_push = true; + info->need_refresh = true; +#endif + break; + case DISPLAYLIST_ACHIEVEMENT_LIST_HARDCORE: +#ifdef HAVE_CHEEVOS + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + cheevos_populate_menu(info, true); info->need_push = true; info->need_refresh = true; #endif diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 9e2294b687..9572d5ebf5 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -108,7 +108,8 @@ enum menu_displaylist_ctl_state DISPLAYLIST_NETWORK_INFO, DISPLAYLIST_SYSTEM_INFO, DISPLAYLIST_ACHIEVEMENT_LIST, - DISPLAYLIST_USER_BINDS_LIST, + DISPLAYLIST_ACHIEVEMENT_LIST_HARDCORE, + DISPLAYLIST_USER_BINDS_LIST, DISPLAYLIST_ACCOUNTS_LIST, DISPLAYLIST_DRIVER_SETTINGS_LIST, DISPLAYLIST_VIDEO_SETTINGS_LIST, diff --git a/msg_hash.h b/msg_hash.h index c5a54a3418..25f83229b8 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -463,7 +463,6 @@ enum msg_hash_enums MENU_ENUM_LABEL_PLAYLIST_COLLECTION_ENTRY, MENU_LABEL(CHEEVOS_UNLOCKED_ENTRY), - MENU_LABEL(CHEEVOS_UNLOCKED_ENTRY_HARDCORE), MENU_LABEL(CHEEVOS_LOCKED_ENTRY), MENU_ENUM_LABEL_SHADER_PARAMETERS_ENTRY, @@ -1856,6 +1855,7 @@ enum msg_hash_enums #define MENU_LABEL_FRONTEND_COUNTERS 0xe5696877U #define MENU_LABEL_CORE_COUNTERS 0x64cc83e0U #define MENU_LABEL_ACHIEVEMENT_LIST 0x7b90fc49U +#define MENU_LABEL_ACHIEVEMENT_LIST_HARDCORE 0x7c632930U #define MENU_LABEL_CORE_INFORMATION 0xb638e0d3U #define MENU_LABEL_CORE_OPTIONS 0xf65e60f9U #define MENU_LABEL_SHADER_OPTIONS 0x1f7d2fc7U