mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Merge pull request #2367 from leiradel/master
list cheevos in the frontend menu
This commit is contained in:
commit
3f4974285b
52
cheevos.c
52
cheevos.c
@ -28,6 +28,7 @@
|
||||
#include "configuration.h"
|
||||
#include "performance.h"
|
||||
#include "runloop.h"
|
||||
#include "menu/menu.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@ -1880,3 +1881,54 @@ int cheevos_load(const struct retro_game_info *info)
|
||||
rarch_main_msg_queue_push("Error loading achievements", 0, 5 * 60, false);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void cheevos_populate_menu(menu_displaylist_info_t *info)
|
||||
{
|
||||
const cheevo_t *end;
|
||||
cheevo_t *cheevo;
|
||||
|
||||
menu_entries_push(info->list, "Unlocked Achievements:", "", MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "", "", MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
|
||||
for (cheevo = cheevos_locals.core.cheevos, end = cheevos_locals.core.cheevos + cheevos_locals.core.count; cheevo < end; cheevo++)
|
||||
{
|
||||
if (!cheevo->active)
|
||||
{
|
||||
menu_entries_push(info->list, cheevo->title, cheevo->description, MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (config_get_ptr()->cheevos.test_unofficial)
|
||||
{
|
||||
for (cheevo = cheevos_locals.unofficial.cheevos, end = cheevos_locals.unofficial.cheevos + cheevos_locals.unofficial.count; cheevo < end; cheevo++)
|
||||
{
|
||||
if (!cheevo->active)
|
||||
{
|
||||
menu_entries_push(info->list, cheevo->title, cheevo->description, MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
menu_entries_push(info->list, "", "", MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "Locked Achievements:", "", MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "", "", MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
|
||||
for (cheevo = cheevos_locals.core.cheevos, end = cheevos_locals.core.cheevos + cheevos_locals.core.count; cheevo < end; cheevo++)
|
||||
{
|
||||
if (cheevo->active)
|
||||
{
|
||||
menu_entries_push(info->list, cheevo->title, cheevo->description, MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (config_get_ptr()->cheevos.test_unofficial)
|
||||
{
|
||||
for (cheevo = cheevos_locals.unofficial.cheevos, end = cheevos_locals.unofficial.cheevos + cheevos_locals.unofficial.count; cheevo < end; cheevo++)
|
||||
{
|
||||
if (cheevo->active)
|
||||
{
|
||||
menu_entries_push(info->list, cheevo->title, cheevo->description, MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libretro.h"
|
||||
#include "menu/menu_entries.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -31,6 +32,8 @@ extern cheevos_globals_t cheevos_globals;
|
||||
|
||||
int cheevos_load(const struct retro_game_info *info);
|
||||
|
||||
void cheevos_populate_menu(menu_displaylist_info_t *info);
|
||||
|
||||
void cheevos_test(void);
|
||||
|
||||
void cheevos_unload(void);
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "../input/input_common.h"
|
||||
#include "../dir_list_special.h"
|
||||
#include "../string_list_special.h"
|
||||
#include "../cheevos.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include "../frontend/drivers/platform_linux.h"
|
||||
@ -386,49 +387,6 @@ static int menu_displaylist_parse_debug_info(menu_displaylist_info_t *info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int menu_displaylist_parse_achievement_list(menu_displaylist_info_t *info)
|
||||
{
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
bool ret;
|
||||
|
||||
/* do these on a loop, process your data and add them to the list */
|
||||
|
||||
/* presentation idea 1: multiline */
|
||||
menu_entries_push(info->list, "Example Achievement 1 Name", "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "- Example Achievement 1 Description", "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "- Example Achievement 1 Status", "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
|
||||
menu_entries_push(info->list, "", "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
/* presentation idea 2: single line, ideally the description would be shown by pressing select */
|
||||
menu_entries_push(info->list, "Locked Achievements:", "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "Example Achievement 2 Name", "Description",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "Example Achievement 3 Name", "Description",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "", "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "Unlocked Achievements:", "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "Example Achievement 4 Name", "Description",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
|
||||
/* it would be cool to be able to show images per-list item (that would also allow showing boxart
|
||||
for a list item in the future), it would make this whole thing nicer
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
|
||||
{
|
||||
int controller;
|
||||
@ -1786,7 +1744,7 @@ static int menu_displaylist_parse_load_content_settings(menu_displaylist_info_t
|
||||
menu_hash_to_str(MENU_LABEL_SHADER_OPTIONS),
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
#endif
|
||||
#if 0
|
||||
#ifdef HAVE_CHEEVOS
|
||||
menu_entries_push(info->list,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_ACHIEVEMENT_LIST),
|
||||
menu_hash_to_str(MENU_LABEL_ACHIEVEMENT_LIST),
|
||||
@ -2977,11 +2935,15 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
info->need_push = true;
|
||||
info->need_refresh = true;
|
||||
break;
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
case DISPLAYLIST_ACHIEVEMENT_LIST:
|
||||
menu_displaylist_parse_achievement_list(info);
|
||||
cheevos_populate_menu(info);
|
||||
info->need_push = true;
|
||||
info->need_refresh = true;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case DISPLAYLIST_CORES_SUPPORTED:
|
||||
case DISPLAYLIST_CORES_COLLECTION_SUPPORTED:
|
||||
info->need_sort = true;
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "menu_setting.h"
|
||||
#include "menu_entry.h"
|
||||
#include "menu_displaylist.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user