From 6c06ffbf1dd4c6b90ee43b526048785a296249b4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 13 Feb 2016 06:13:46 +0100 Subject: [PATCH] Create CHEEVOS_CTL_SET_CHEATS --- cheevos.c | 9 ++++----- cheevos.h | 10 +++++++--- command_event.c | 5 +---- content.c | 3 +-- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/cheevos.c b/cheevos.c index 9c46300815..31ae746d20 100644 --- a/cheevos.c +++ b/cheevos.c @@ -2169,11 +2169,6 @@ void cheevos_get_description(unsigned idx, char *str, size_t len) str[len - 1] = 0; } -void cheevos_set_cheats(void) -{ - cheevos_globals.cheats_were_enabled = cheevos_globals.cheats_are_enabled; -} - void cheevos_apply_cheats(bool enable) { cheevos_globals.cheats_are_enabled = enable; @@ -2215,6 +2210,10 @@ bool cheevos_ctl(enum cheevos_ctl_state state, void *data) cheevos_test_cheevo_set(&cheevos_locals.unofficial); } break; + case CHEEVOS_CTL_SET_CHEATS: + cheevos_globals.cheats_were_enabled = + cheevos_globals.cheats_are_enabled; + break; case CHEEVOS_CTL_NONE: default: break; diff --git a/cheevos.h b/cheevos.h index ade6fbbf75..ac88bc6924 100644 --- a/cheevos.h +++ b/cheevos.h @@ -24,7 +24,13 @@ enum cheevos_ctl_state CHEEVOS_CTL_NONE = 0, CHEEVOS_CTL_TEST, CHEEVOS_CTL_LOAD, - CHEEVOS_CTL_UNLOAD + + /* Unload the achievements from memory. */ + CHEEVOS_CTL_UNLOAD, + + /* Load the achievements into memory if + * the game has content. */ + CHEEVOS_CTL_SET_CHEATS }; #ifdef HAVE_MENU @@ -33,8 +39,6 @@ void cheevos_populate_menu(void *data); void cheevos_get_description(unsigned idx, char *str, size_t len); -void cheevos_set_cheats(void); - void cheevos_apply_cheats(bool enable); bool cheevos_ctl(enum cheevos_ctl_state state, void *data); diff --git a/command_event.c b/command_event.c index 916e294970..86df745828 100644 --- a/command_event.c +++ b/command_event.c @@ -395,7 +395,6 @@ static void event_init_controllers(void) static void event_deinit_core(bool reinit) { #ifdef HAVE_CHEEVOS - /* Unload the achievements from memory. */ cheevos_ctl(CHEEVOS_CTL_UNLOAD, NULL); #endif @@ -1065,11 +1064,9 @@ bool event_cmd_ctl(enum event_command cmd, void *data) runloop_msg_queue_push(msg_hash_to_str(MSG_RESET), 1, 120, true); #ifdef HAVE_CHEEVOS - cheevos_set_cheats(); + cheevos_ctl(CHEEVOS_CTL_SET_CHEATS, NULL); #endif core_ctl(CORE_CTL_RETRO_RESET, NULL); - if (ui_companion_is_on_foreground()) - ui_companion_driver_toggle(); break; case EVENT_CMD_SAVE_STATE: if (settings->savestate_auto_index) diff --git a/content.c b/content.c index 3968dcd469..c3574ddcf4 100644 --- a/content.c +++ b/content.c @@ -586,8 +586,7 @@ static bool load_content( { const void *load_data = NULL; - /* Load the achievements into memory if the game has content. */ - cheevos_set_cheats(); + cheevos_ctl(CHEEVOS_CTL_SET_CHEATS, NULL); if (*content->elems[0].data) load_data = info;