From 07ae4e7aebf2212787a0493ee6efab2d76bd6cc6 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Tue, 3 Nov 2015 15:33:49 -0200 Subject: [PATCH] added log messages for the md5 methods being used to identify games for cheevos --- cheevos.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/cheevos.c b/cheevos.c index e49e081633..0c237e29c9 100644 --- a/cheevos.c +++ b/cheevos.c @@ -21,7 +21,6 @@ #include #include #include -#include #include "cheevos.h" #include "dynamic.h" @@ -1510,6 +1509,19 @@ static int cheevos_deactivate_unlocks(unsigned game_id, retro_time_t *timeout) #define CHEEVOS_SIX_MB (6 * 1024 * 1024) #define CHEEVOS_EIGHT_MB (8 * 1024 * 1024) +static INLINE unsigned next_power_of_2(unsigned n) +{ + n--; + + n |= n >> 1; + n |= n >> 2; + n |= n >> 4; + n |= n >> 8; + n |= n >> 16; + + return n + 1; +} + static size_t cheevos_eval_md5(const struct retro_game_info *info, MD5_CTX *ctx) { MD5_Init(ctx); @@ -1670,7 +1682,7 @@ static unsigned cheevos_find_game_id_nes(const struct retro_game_info *info, ret return 0; if (header.rom_size) - rom_size = next_pow2(header.rom_size) * 16384; + rom_size = next_power_of_2(header.rom_size) * 16384; else rom_size = 4194304; @@ -1728,6 +1740,14 @@ int cheevos_load(const struct retro_game_info *info) cheevos_find_game_id_nes, }; + static const char *finders_names[] = + { + "Genesis (6Mb padding)", + "Generic (plain content)", + "SNES (8Mb padding)", + "NES (discards VROM)", + }; + retro_time_t timeout = 5000000; unsigned game_id = 0; int i; @@ -1747,6 +1767,7 @@ int cheevos_load(const struct retro_game_info *info) for (i = 0; i < sizeof(finders) / sizeof(finders[0]); i++) { + RARCH_LOG("CHEEVOS trying method %s\n", finders_names[i]); game_id = finders[i](info, 5000000); if (game_id)