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;
}
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;

View File

@ -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);

View File

@ -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)

View File

@ -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;