Create CHEEVOS_CTL_TEST

This commit is contained in:
twinaphex 2016-02-13 06:09:37 +01:00
parent d255d6609b
commit a36382b938
3 changed files with 20 additions and 24 deletions

View File

@ -1417,26 +1417,6 @@ static void cheevos_test_cheevo_set(const cheevoset_t *set)
}
}
void cheevos_test(void)
{
if (!cheevos_locals.loaded)
return;
if ( !cheevos_globals.cheats_are_enabled
&& !cheevos_globals.cheats_were_enabled)
{
settings_t *settings = config_get_ptr();
if (!settings->cheevos.enable)
return;
cheevos_test_cheevo_set(&cheevos_locals.core);
if (settings->cheevos.test_unofficial)
cheevos_test_cheevo_set(&cheevos_locals.unofficial);
}
}
/*****************************************************************************
Free the loaded achievements.
*****************************************************************************/
@ -2212,12 +2192,30 @@ void cheevos_apply_cheats(bool enable)
bool cheevos_ctl(enum cheevos_ctl_state state, void *data)
{
settings_t *settings = config_get_ptr();
switch (state)
{
case CHEEVOS_CTL_LOAD:
if (!cheevos_load((const void*)data))
return false;
break;
case CHEEVOS_CTL_TEST:
if (!cheevos_locals.loaded)
return false;
if ( !cheevos_globals.cheats_are_enabled
&& !cheevos_globals.cheats_were_enabled)
{
if (!settings->cheevos.enable)
return false;
cheevos_test_cheevo_set(&cheevos_locals.core);
if (settings->cheevos.test_unofficial)
cheevos_test_cheevo_set(&cheevos_locals.unofficial);
}
break;
case CHEEVOS_CTL_NONE:
default:
break;

View File

@ -22,6 +22,7 @@
enum cheevos_ctl_state
{
CHEEVOS_CTL_NONE = 0,
CHEEVOS_CTL_TEST,
CHEEVOS_CTL_LOAD
};
@ -35,8 +36,6 @@ void cheevos_set_cheats(void);
void cheevos_apply_cheats(bool enable);
void cheevos_test(void);
void cheevos_unload(void);
bool cheevos_ctl(enum cheevos_ctl_state state, void *data);

View File

@ -1417,8 +1417,7 @@ int runloop_iterate(unsigned *sleep_ms)
core_ctl(CORE_CTL_RETRO_RUN, NULL);
#ifdef HAVE_CHEEVOS
/* Test the achievements. */
cheevos_test();
cheevos_ctl(CHEEVOS_CTL_TEST, NULL);
#endif
for (i = 0; i < settings->input.max_users; i++)