Create CHEEVOS_CTL_SET_CHEATS

This commit is contained in:
twinaphex 2016-02-13 06:13:46 +01:00
parent fc6d22d47b
commit 6c06ffbf1d
4 changed files with 13 additions and 14 deletions

View File

@ -2169,11 +2169,6 @@ void cheevos_get_description(unsigned idx, char *str, size_t len)
str[len - 1] = 0; 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) void cheevos_apply_cheats(bool enable)
{ {
cheevos_globals.cheats_are_enabled = 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); cheevos_test_cheevo_set(&cheevos_locals.unofficial);
} }
break; break;
case CHEEVOS_CTL_SET_CHEATS:
cheevos_globals.cheats_were_enabled =
cheevos_globals.cheats_are_enabled;
break;
case CHEEVOS_CTL_NONE: case CHEEVOS_CTL_NONE:
default: default:
break; break;

View File

@ -24,7 +24,13 @@ enum cheevos_ctl_state
CHEEVOS_CTL_NONE = 0, CHEEVOS_CTL_NONE = 0,
CHEEVOS_CTL_TEST, CHEEVOS_CTL_TEST,
CHEEVOS_CTL_LOAD, 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 #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_get_description(unsigned idx, char *str, size_t len);
void cheevos_set_cheats(void);
void cheevos_apply_cheats(bool enable); void cheevos_apply_cheats(bool enable);
bool cheevos_ctl(enum cheevos_ctl_state state, void *data); bool cheevos_ctl(enum cheevos_ctl_state state, void *data);

View File

@ -395,7 +395,6 @@ static void event_init_controllers(void)
static void event_deinit_core(bool reinit) static void event_deinit_core(bool reinit)
{ {
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
/* Unload the achievements from memory. */
cheevos_ctl(CHEEVOS_CTL_UNLOAD, NULL); cheevos_ctl(CHEEVOS_CTL_UNLOAD, NULL);
#endif #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); runloop_msg_queue_push(msg_hash_to_str(MSG_RESET), 1, 120, true);
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
cheevos_set_cheats(); cheevos_ctl(CHEEVOS_CTL_SET_CHEATS, NULL);
#endif #endif
core_ctl(CORE_CTL_RETRO_RESET, NULL); core_ctl(CORE_CTL_RETRO_RESET, NULL);
if (ui_companion_is_on_foreground())
ui_companion_driver_toggle();
break; break;
case EVENT_CMD_SAVE_STATE: case EVENT_CMD_SAVE_STATE:
if (settings->savestate_auto_index) if (settings->savestate_auto_index)

View File

@ -586,8 +586,7 @@ static bool load_content(
{ {
const void *load_data = NULL; const void *load_data = NULL;
/* Load the achievements into memory if the game has content. */ cheevos_ctl(CHEEVOS_CTL_SET_CHEATS, NULL);
cheevos_set_cheats();
if (*content->elems[0].data) if (*content->elems[0].data)
load_data = info; load_data = info;