mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 10:40:39 +00:00
Merge pull request #5763 from fr500/single_list
use a single list for achievements
This commit is contained in:
commit
c2eaf98c00
@ -2138,7 +2138,7 @@ void cheevos_reset_game(void)
|
||||
cheevo->last = 1;
|
||||
}
|
||||
|
||||
void cheevos_populate_menu(void *data, bool hardcore)
|
||||
void cheevos_populate_menu(void *data)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
unsigned i;
|
||||
@ -2151,39 +2151,30 @@ void cheevos_populate_menu(void *data, bool hardcore)
|
||||
|
||||
for (i = 0; cheevo < end; i++, cheevo++)
|
||||
{
|
||||
if (!hardcore)
|
||||
|
||||
if (!(cheevo->active & CHEEVOS_ACTIVE_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++;
|
||||
}
|
||||
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
|
||||
{
|
||||
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++;
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2193,42 +2184,29 @@ void cheevos_populate_menu(void *data, bool hardcore)
|
||||
end = cheevos_locals.unofficial.cheevos
|
||||
+ cheevos_locals.unofficial.count;
|
||||
|
||||
for (i = cheevos_locals.core.count; cheevo < end; i++, cheevo++)
|
||||
if (!(cheevo->active & CHEEVOS_ACTIVE_HARDCORE))
|
||||
{
|
||||
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++;
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3157,6 +3135,63 @@ 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)
|
||||
|
@ -117,7 +117,7 @@ bool cheevos_load(const void *data);
|
||||
|
||||
void cheevos_reset_game(void);
|
||||
|
||||
void cheevos_populate_menu(void *data, bool hardcore);
|
||||
void cheevos_populate_menu(void *data);
|
||||
|
||||
bool cheevos_get_description(cheevos_ctx_desc_t *desc);
|
||||
|
||||
|
@ -148,6 +148,8 @@ 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,
|
||||
|
@ -458,6 +458,10 @@ 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"
|
||||
|
@ -78,11 +78,6 @@ 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);
|
||||
@ -1533,9 +1528,6 @@ 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;
|
||||
@ -1768,9 +1760,6 @@ 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;
|
||||
|
@ -94,6 +94,21 @@ 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,
|
||||
@ -1976,6 +1991,10 @@ 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);
|
||||
|
@ -1246,6 +1246,7 @@ 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;
|
||||
|
@ -189,7 +189,6 @@ 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)
|
||||
|
||||
@ -1018,9 +1017,6 @@ 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;
|
||||
|
@ -2954,11 +2954,6 @@ 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
|
||||
}
|
||||
@ -4740,15 +4735,7 @@ 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, 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);
|
||||
cheevos_populate_menu(info);
|
||||
info->need_push = true;
|
||||
info->need_refresh = true;
|
||||
#endif
|
||||
|
@ -108,8 +108,7 @@ enum menu_displaylist_ctl_state
|
||||
DISPLAYLIST_NETWORK_INFO,
|
||||
DISPLAYLIST_SYSTEM_INFO,
|
||||
DISPLAYLIST_ACHIEVEMENT_LIST,
|
||||
DISPLAYLIST_ACHIEVEMENT_LIST_HARDCORE,
|
||||
DISPLAYLIST_USER_BINDS_LIST,
|
||||
DISPLAYLIST_USER_BINDS_LIST,
|
||||
DISPLAYLIST_ACCOUNTS_LIST,
|
||||
DISPLAYLIST_DRIVER_SETTINGS_LIST,
|
||||
DISPLAYLIST_VIDEO_SETTINGS_LIST,
|
||||
|
@ -463,6 +463,7 @@ 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,
|
||||
@ -1855,7 +1856,6 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user