Add files to handle all cheevos badges.

This commit is contained in:
GameDragon2k 2017-10-21 17:46:13 -04:00
parent 84e80e47df
commit ec2808685d
3 changed files with 62 additions and 0 deletions

View File

@ -1474,8 +1474,12 @@ ifeq ($(HAVE_NETWORKING), 1)
ifeq ($(HAVE_CHEEVOS), 1)
DEFINES += -DHAVE_CHEEVOS
OBJ += cheevos/cheevos.o \
<<<<<<< HEAD
cheevos/var.o \
cheevos/cond.o \
=======
cheevos/badges.o \
>>>>>>> Add files to handle all cheevos badges.
$(LIBRETRO_COMM_DIR)/utils/md5.o
endif

31
cheevos/badges.c Normal file
View File

@ -0,0 +1,31 @@
#include "badges.h"
#include "../menu/menu_driver.h"
#include "../verbosity.h"
badges_ctx_t badges_ctx;
void set_badge_menu_texture(badges_ctx_t * badges, int i)
{
const char * locked_suffix = (badges->badge_locked[i] == true) ? "_lock.png" : ".png";
unsigned int bufferSize = 16;
char badge_file[bufferSize];
snprintf(badge_file, bufferSize, "%s", badges->badge_id_list[i]);
strcat(badge_file, locked_suffix);
// Badge directory should probably use a definition
menu_display_reset_textures_list(badge_file, "badges", &badges->menu_texture_list[i],TEXTURE_FILTER_MIPMAP_LINEAR);
}
void set_badge_info (badges_ctx_t *badge_struct, int id, const char *badge_id, bool active)
{
badge_struct->badge_id_list[id] = badge_id;
badge_struct->badge_locked[id] = active;
set_badge_menu_texture(badge_struct, id);
}
menu_texture_item get_badge_texture (int id)
{
return badges_ctx.menu_texture_list[id];
}

27
cheevos/badges.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef __RARCH_BADGE_H
#define __RARCH_BADGE_H
#include "../menu/menu_driver.h"
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
#define CHEEVOS_BADGE_LIMIT 256
typedef struct
{
bool badge_locked[CHEEVOS_BADGE_LIMIT];
const char * badge_id_list[CHEEVOS_BADGE_LIMIT];
menu_texture_item menu_texture_list[CHEEVOS_BADGE_LIMIT];
} badges_ctx_t;
void set_badge_menu_texture(badges_ctx_t * badges, int i);
extern void set_badge_info (badges_ctx_t *badge_struct, int id, const char *badge_id, bool active);
extern menu_texture_item get_badge_texture(int id);
extern badges_ctx_t badges_ctx;
RETRO_END_DECLS
#endif