mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-18 00:32:46 +00:00
Create CHEEVOS_CTL_UNLOAD
This commit is contained in:
parent
a36382b938
commit
fc6d22d47b
21
cheevos.c
21
cheevos.c
@ -964,7 +964,7 @@ static int cheevos_parse(const char *json)
|
||||
|
||||
if (jsonsax_parse(json, &handlers, (void*)&ud) != JSONSAX_OK)
|
||||
{
|
||||
cheevos_unload();
|
||||
cheevos_ctl(CHEEVOS_CTL_UNLOAD, NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1446,16 +1446,6 @@ static void cheevos_free_cheevo_set(const cheevoset_t *set)
|
||||
free((void*)set->cheevos);
|
||||
}
|
||||
|
||||
void cheevos_unload(void)
|
||||
{
|
||||
if (cheevos_locals.loaded)
|
||||
{
|
||||
cheevos_free_cheevo_set(&cheevos_locals.core);
|
||||
cheevos_free_cheevo_set(&cheevos_locals.unofficial);
|
||||
|
||||
cheevos_locals.loaded = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Load achievements from retroachievements.org.
|
||||
@ -2200,6 +2190,15 @@ bool cheevos_ctl(enum cheevos_ctl_state state, void *data)
|
||||
if (!cheevos_load((const void*)data))
|
||||
return false;
|
||||
break;
|
||||
case CHEEVOS_CTL_UNLOAD:
|
||||
if (!cheevos_locals.loaded)
|
||||
return false;
|
||||
|
||||
cheevos_free_cheevo_set(&cheevos_locals.core);
|
||||
cheevos_free_cheevo_set(&cheevos_locals.unofficial);
|
||||
|
||||
cheevos_locals.loaded = 0;
|
||||
break;
|
||||
case CHEEVOS_CTL_TEST:
|
||||
if (!cheevos_locals.loaded)
|
||||
return false;
|
||||
|
@ -23,7 +23,8 @@ enum cheevos_ctl_state
|
||||
{
|
||||
CHEEVOS_CTL_NONE = 0,
|
||||
CHEEVOS_CTL_TEST,
|
||||
CHEEVOS_CTL_LOAD
|
||||
CHEEVOS_CTL_LOAD,
|
||||
CHEEVOS_CTL_UNLOAD
|
||||
};
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
@ -36,8 +37,6 @@ void cheevos_set_cheats(void);
|
||||
|
||||
void cheevos_apply_cheats(bool enable);
|
||||
|
||||
void cheevos_unload(void);
|
||||
|
||||
bool cheevos_ctl(enum cheevos_ctl_state state, void *data);
|
||||
|
||||
#endif /* __RARCH_CHEEVOS_H */
|
||||
|
@ -396,7 +396,7 @@ static void event_deinit_core(bool reinit)
|
||||
{
|
||||
#ifdef HAVE_CHEEVOS
|
||||
/* Unload the achievements from memory. */
|
||||
cheevos_unload();
|
||||
cheevos_ctl(CHEEVOS_CTL_UNLOAD, NULL);
|
||||
#endif
|
||||
|
||||
core_ctl(CORE_CTL_RETRO_UNLOAD_GAME, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user