added log messages for the md5 methods being used to identify games for cheevos

This commit is contained in:
Andre Leiradella 2015-11-03 15:33:49 -02:00
parent 1a73f239a1
commit 07ae4e7aeb

View File

@ -21,7 +21,6 @@
#include <rhash.h>
#include <retro_log.h>
#include <rthreads/async_job.h>
#include <retro_miscellaneous.h>
#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)