diff --git a/cheevos.c b/cheevos.c index 59e87df1c1..46332b3aee 100644 --- a/cheevos.c +++ b/cheevos.c @@ -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; diff --git a/cheevos.h b/cheevos.h index b03ae66b62..864a2471e4 100644 --- a/cheevos.h +++ b/cheevos.h @@ -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); diff --git a/runloop.c b/runloop.c index 9c4bc63c3f..0836ca9053 100644 --- a/runloop.c +++ b/runloop.c @@ -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++)