From 84e80e47df768fc4d8c393d2fec467bce29e39e3 Mon Sep 17 00:00:00 2001 From: GameDragon2k Date: Fri, 20 Oct 2017 20:26:13 -0400 Subject: [PATCH] Initial test for badge icon --- cheevos/cheevos.c | 12 ++++++++++-- menu/drivers/xmb.c | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 9ad63a365c..0ed68488ae 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -2157,14 +2157,14 @@ void cheevos_populate_menu(void *data, bool hardcore) { menu_entries_append_enum(info->list, cheevo->title, cheevo->description, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, - MENU_SETTINGS_CHEEVOS_START + i, 0, 0); + MENU_SETTINGS_CHEEVOS_START + i, 0, atoi(cheevo->badge)); 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); + MENU_SETTINGS_CHEEVOS_START + i, 0, atoi(cheevo->badge)); items_found++; } } @@ -3337,8 +3337,12 @@ static int cheevos_iterate(coro_t* coro) else RARCH_ERR("[CHEEVOS]: error deactivating unlocked achievements in softcore mode.\n"); +<<<<<<< HEAD if ((void*)CHEEVOS_VAR_JSON) free((void*)CHEEVOS_VAR_JSON); +======= + free((void*)CHEEVOS_VAR_JSON); +>>>>>>> Initial test for badge icon } else RARCH_ERR("[CHEEVOS]: error retrieving list of unlocked achievements in softcore mode.\n"); @@ -3366,8 +3370,12 @@ static int cheevos_iterate(coro_t* coro) else RARCH_ERR("[CHEEVOS]: error deactivating unlocked achievements in hardcore mode.\n"); +<<<<<<< HEAD if ((void*)CHEEVOS_VAR_JSON) free((void*)CHEEVOS_VAR_JSON); +======= + free((void*)CHEEVOS_VAR_JSON); +>>>>>>> Initial test for badge icon } else RARCH_ERR("[CHEEVOS]: error retrieving list of unlocked achievements in hardcore mode.\n"); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index c1d5dac42e..49df1ce1c8 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -252,6 +252,15 @@ typedef struct xmb_handle menu_texture_item list[XMB_TEXTURE_LAST]; } textures; +#ifdef HAVE_CHEEVOS + struct + { + size_t current_badge; + menu_texture_item test; + menu_texture_item list[XMB_TEXTURE_LAST]; + } badges; +#endif + xmb_node_t main_menu_node; #ifdef HAVE_IMAGEVIEWER xmb_node_t images_tab_node; @@ -2239,6 +2248,20 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, #endif } +#ifdef HAVE_CHEEVOS + if ((type >= MENU_SETTINGS_CHEEVOS_START) && + (type < MENU_SETTINGS_NETPLAY_ROOMS_START)) + { + unsigned new_id = type - MENU_SETTINGS_CHEEVOS_START; + int bufferSize = 16; + char new_str[bufferSize]; + snprintf(new_str, bufferSize, "%05d", (int)xmb->badges.current_badge); + strcat(new_str, ".png"); + menu_display_reset_textures_list(new_str, "badges", &xmb->badges.list[new_id], TEXTURE_FILTER_MIPMAP_LINEAR); + return xmb->badges.list[new_id]; + } +#endif + return xmb->textures.list[XMB_TEXTURE_SUBSETTING]; } @@ -2466,6 +2489,10 @@ static int xmb_draw_item( if (color[3] != 0) { +#ifdef HAVE_CHEEVOS + xmb->badges.current_badge = entry->entry_idx; +#endif + math_matrix_4x4 mymat_tmp; menu_display_ctx_rotate_draw_t rotate_draw; uintptr_t texture = xmb_icon_get_id(xmb, core_node, node,