Refactor cheevos_load
This commit is contained in:
parent
2357c9ef82
commit
2c28505e04
|
@ -2944,7 +2944,7 @@ static unsigned cheevos_find_game_id_nes(
|
||||||
return cheevos_get_game_id(hash, &timeout);
|
return cheevos_get_game_id(hash, &timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cheevos_load(const void *data)
|
bool cheevos_load(bool cheevos_enable, const struct retro_game_info *info)
|
||||||
{
|
{
|
||||||
static const uint32_t genesis_exts[] =
|
static const uint32_t genesis_exts[] =
|
||||||
{
|
{
|
||||||
|
@ -2988,15 +2988,13 @@ bool cheevos_load(const void *data)
|
||||||
const char *json = NULL;
|
const char *json = NULL;
|
||||||
retro_time_t timeout = 5000000;
|
retro_time_t timeout = 5000000;
|
||||||
unsigned game_id = 0;
|
unsigned game_id = 0;
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
const struct retro_game_info *info = (const struct retro_game_info*)data;
|
|
||||||
|
|
||||||
url[0] = '\0';
|
url[0] = '\0';
|
||||||
|
|
||||||
cheevos_loaded = 0;
|
cheevos_loaded = 0;
|
||||||
|
|
||||||
/* Just return OK if the core doesn't support cheevos, or info is NULL. */
|
/* Just return OK if the core doesn't support cheevos, or info is NULL. */
|
||||||
if (!cheevos_locals.core_supports || !info)
|
if (!cheevos_locals.core_supports)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
cheevos_locals.meminfo[0].id = RETRO_MEMORY_SYSTEM_RAM;
|
cheevos_locals.meminfo[0].id = RETRO_MEMORY_SYSTEM_RAM;
|
||||||
|
@ -3024,7 +3022,7 @@ bool cheevos_load(const void *data)
|
||||||
|
|
||||||
/* Bail out if cheevos are disabled.
|
/* Bail out if cheevos are disabled.
|
||||||
* But set the above anyways, command_read_ram needs it. */
|
* But set the above anyways, command_read_ram needs it. */
|
||||||
if (!settings->bools.cheevos_enable)
|
if (!cheevos_enable)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* Use the supported extensions as a hint
|
/* Use the supported extensions as a hint
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <retro_common_api.h>
|
#include <retro_common_api.h>
|
||||||
|
#include <boolean.h>
|
||||||
|
#include <libretro.h>
|
||||||
|
|
||||||
RETRO_BEGIN_DECLS
|
RETRO_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -39,7 +41,7 @@ typedef struct
|
||||||
unsigned previous;
|
unsigned previous;
|
||||||
} cheevos_var_t;
|
} cheevos_var_t;
|
||||||
|
|
||||||
bool cheevos_load(const void *data);
|
bool cheevos_load(bool cheevos_enable, const struct retro_game_info *info);
|
||||||
|
|
||||||
void cheevos_reset_game(void);
|
void cheevos_reset_game(void);
|
||||||
|
|
||||||
|
|
|
@ -591,14 +591,15 @@ static bool content_file_load(
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (!special)
|
if (!special)
|
||||||
{
|
{
|
||||||
const void *load_data = NULL;
|
|
||||||
const char *path = content->elems[0].data;
|
const char *path = content->elems[0].data;
|
||||||
|
|
||||||
cheevos_set_cheats();
|
cheevos_set_cheats();
|
||||||
|
|
||||||
if (!string_is_empty(path))
|
if (!string_is_empty(path))
|
||||||
load_data = info;
|
{
|
||||||
cheevos_load(load_data);
|
settings_t *settings = config_get_ptr();
|
||||||
|
cheevos_load(settings->bools.cheevos_enable, info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue