1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 12:15:49 +00:00

just check hardcore mode changes on menu

also fix a rewind deinit
This commit is contained in:
David Skywalker 2016-03-14 12:53:56 +01:00
parent 91361f26de
commit 1a5273a73b
6 changed files with 33 additions and 16 deletions

View File

@ -240,8 +240,6 @@ static cheevos_locals_t cheevos_locals =
{0},
};
static bool last_hardcore_mode_value = false;
/* forward declaration */
int rarch_main_async_job_add(async_task_t task, void *payload);
@ -2200,7 +2198,6 @@ bool cheevos_ctl(enum cheevos_ctl_state state, void *data)
if (!cheevos_load((const void*)data))
return false;
last_hardcore_mode_value = settings->cheevos.hardcore_mode_enable;
break;
case CHEEVOS_CTL_UNLOAD:
if (!cheevos_locals.loaded)
@ -2211,6 +2208,24 @@ bool cheevos_ctl(enum cheevos_ctl_state state, void *data)
cheevos_locals.loaded = 0;
break;
case CHEEVOS_CTL_TOGGLE_HARDCORE_MODE:
/* reset and deinit rewind to avoid cheat the score */
if (settings->cheevos.hardcore_mode_enable)
{
/* send reset core cmd to avoid any user savestate previusly loaded */
event_cmd_ctl(EVENT_CMD_RESET, NULL);
if (settings->rewind_enable)
event_cmd_ctl(EVENT_CMD_REWIND_DEINIT, NULL);
RARCH_LOG("%s\n", msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_ENABLE));
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_ENABLE), 0, 3 * 60, true);
}
else
{
if (settings->rewind_enable)
event_cmd_ctl(EVENT_CMD_REWIND_INIT, NULL);
}
break;
case CHEEVOS_CTL_TEST:
if (!cheevos_locals.loaded)
return false;
@ -2220,18 +2235,6 @@ bool cheevos_ctl(enum cheevos_ctl_state state, void *data)
if (!settings->cheevos.enable)
return false;
/* just a quick check on hardcore last value to avoid cheat the score */
if (last_hardcore_mode_value == false
&& last_hardcore_mode_value != settings->cheevos.hardcore_mode_enable)
{
last_hardcore_mode_value = settings->cheevos.hardcore_mode_enable;
/* send reset core cmd to avoid any user savestate previusly loaded */
event_cmd_ctl(EVENT_CMD_RESET, NULL);
RARCH_LOG("%s\n", msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_ENABLE));
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_ENABLE), 0, 3 * 60, true);
}
cheevos_test_cheevo_set(&cheevos_locals.core);
if (settings->cheevos.test_unofficial)

View File

@ -30,6 +30,9 @@ enum cheevos_ctl_state
/* Unload the achievements from memory. */
CHEEVOS_CTL_UNLOAD,
/* Toggle Hardcore Mode */
CHEEVOS_CTL_TOGGLE_HARDCORE_MODE,
/* Load the achievements into memory if
* the game has content. */
CHEEVOS_CTL_SET_CHEATS,

View File

@ -1115,6 +1115,11 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
case EVENT_CMD_QUIT:
rarch_ctl(RARCH_CTL_QUIT, NULL);
break;
case EVENT_CMD_CHEEVOS_HARDCORE_MODE_TOGGLE:
#ifdef HAVE_CHEEVOS
cheevos_ctl(CHEEVOS_CTL_TOGGLE_HARDCORE_MODE, NULL);
#endif
break;
case EVENT_CMD_REINIT:
{
struct retro_hw_render_callback *hwr = NULL;

View File

@ -52,6 +52,8 @@ enum event_command
EVENT_CMD_QUIT,
/* Reinitialize all drivers. */
EVENT_CMD_REINIT,
/* Toggles cheevos hardcore mode. */
EVENT_CMD_CHEEVOS_HARDCORE_MODE_TOGGLE,
/* Deinitialize rewind. */
EVENT_CMD_REWIND_DEINIT,
/* Initializes rewind. */

View File

@ -6256,6 +6256,7 @@ static bool setting_append_list_cheevos_options(
parent_group,
general_write_handler,
general_read_handler);
menu_settings_list_current_add_cmd(list, list_info, EVENT_CMD_CHEEVOS_HARDCORE_MODE_TOGGLE);
END_SUB_GROUP(list, list_info, parent_group);
END_GROUP(list, list_info, parent_group);

View File

@ -725,7 +725,10 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
else if (runloop_cmd_triggered(cmd, RARCH_LOAD_STATE_KEY))
event_cmd_ctl(EVENT_CMD_LOAD_STATE, NULL);
state_manager_check_rewind(runloop_cmd_press(cmd, RARCH_REWIND));
#ifdef HAVE_CHEEVOS
if(!settings->cheevos.hardcore_mode_enable)
#endif
state_manager_check_rewind(runloop_cmd_press(cmd, RARCH_REWIND));
tmp = runloop_cmd_press(cmd, RARCH_SLOWMOTION);