eliminate exposed variables for tracking hardcore
This commit is contained in:
parent
4ec216dc0b
commit
2f69d2d4ed
|
@ -153,6 +153,8 @@ typedef struct
|
||||||
slock_t* task_lock;
|
slock_t* task_lock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool hardcore_active;
|
||||||
|
bool loaded;
|
||||||
bool core_supports;
|
bool core_supports;
|
||||||
bool invalid_peek_address;
|
bool invalid_peek_address;
|
||||||
|
|
||||||
|
@ -166,6 +168,7 @@ typedef struct
|
||||||
|
|
||||||
char token[32];
|
char token[32];
|
||||||
char hash[33];
|
char hash[33];
|
||||||
|
char user_agent_prefix[128];
|
||||||
} rcheevos_locals_t;
|
} rcheevos_locals_t;
|
||||||
|
|
||||||
static rcheevos_locals_t rcheevos_locals =
|
static rcheevos_locals_t rcheevos_locals =
|
||||||
|
@ -174,6 +177,8 @@ static rcheevos_locals_t rcheevos_locals =
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
NULL, /* task_lock */
|
NULL, /* task_lock */
|
||||||
#endif
|
#endif
|
||||||
|
false,/* hardcore_active */
|
||||||
|
false,/* loaded */
|
||||||
true, /* core_supports */
|
true, /* core_supports */
|
||||||
false,/* invalid_peek_address */
|
false,/* invalid_peek_address */
|
||||||
{0}, /* patchdata */
|
{0}, /* patchdata */
|
||||||
|
@ -184,15 +189,9 @@ static rcheevos_locals_t rcheevos_locals =
|
||||||
{{0}},/* memory */
|
{{0}},/* memory */
|
||||||
{0}, /* token */
|
{0}, /* token */
|
||||||
"N/A",/* hash */
|
"N/A",/* hash */
|
||||||
|
"", /* user_agent_prefix */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* TODO/FIXME - public global variables */
|
|
||||||
bool rcheevos_loaded = false;
|
|
||||||
bool rcheevos_hardcore_active = false;
|
|
||||||
bool rcheevos_hardcore_paused = false;
|
|
||||||
bool rcheevos_state_loaded_flag = false;
|
|
||||||
char rcheevos_user_agent_prefix[128] = "";
|
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
#define CHEEVOS_LOCK(l) do { slock_lock(l); } while (0)
|
#define CHEEVOS_LOCK(l) do { slock_lock(l); } while (0)
|
||||||
#define CHEEVOS_UNLOCK(l) do { slock_unlock(l); } while (0)
|
#define CHEEVOS_UNLOCK(l) do { slock_unlock(l); } while (0)
|
||||||
|
@ -220,13 +219,13 @@ static void rcheevos_get_user_agent(char* buffer)
|
||||||
const char* scan;
|
const char* scan;
|
||||||
char* ptr;
|
char* ptr;
|
||||||
|
|
||||||
if (!rcheevos_user_agent_prefix[0])
|
if (!rcheevos_locals.user_agent_prefix[0])
|
||||||
{
|
{
|
||||||
const frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
const frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||||
int major, minor;
|
int major, minor;
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
|
|
||||||
ptr = rcheevos_user_agent_prefix + sprintf(rcheevos_user_agent_prefix, "RetroArch/%s", PACKAGE_VERSION);
|
ptr = rcheevos_locals.user_agent_prefix + sprintf(rcheevos_locals.user_agent_prefix, "RetroArch/%s", PACKAGE_VERSION);
|
||||||
|
|
||||||
if (frontend && frontend->get_os)
|
if (frontend && frontend->get_os)
|
||||||
{
|
{
|
||||||
|
@ -235,7 +234,7 @@ static void rcheevos_get_user_agent(char* buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = buffer + sprintf(buffer, "%s", rcheevos_user_agent_prefix);
|
ptr = buffer + sprintf(buffer, "%s", rcheevos_locals.user_agent_prefix);
|
||||||
|
|
||||||
if (system && !string_is_empty(system->library_name))
|
if (system && !string_is_empty(system->library_name))
|
||||||
{
|
{
|
||||||
|
@ -869,12 +868,11 @@ static int rcheevos_has_indirect_memref(const rc_memref_value_t* memrefs)
|
||||||
|
|
||||||
static void rcheevos_test_cheevo_set(bool official)
|
static void rcheevos_test_cheevo_set(bool official)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
int mode = RCHEEVOS_ACTIVE_SOFTCORE;
|
int mode = RCHEEVOS_ACTIVE_SOFTCORE;
|
||||||
rcheevos_cheevo_t* cheevo;
|
rcheevos_cheevo_t* cheevo;
|
||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
if (settings && settings->bools.cheevos_hardcore_mode_enable && !rcheevos_hardcore_paused)
|
if (rcheevos_locals.hardcore_active)
|
||||||
mode = RCHEEVOS_ACTIVE_HARDCORE;
|
mode = RCHEEVOS_ACTIVE_HARDCORE;
|
||||||
|
|
||||||
if (official)
|
if (official)
|
||||||
|
@ -1121,9 +1119,7 @@ void rcheevos_get_achievement_state(unsigned index, char *buffer, size_t buffer_
|
||||||
else if (!(cheevo->active & RCHEEVOS_ACTIVE_SOFTCORE))
|
else if (!(cheevo->active & RCHEEVOS_ACTIVE_SOFTCORE))
|
||||||
{
|
{
|
||||||
/* if in hardcore mode, track progress towards hardcore unlock */
|
/* if in hardcore mode, track progress towards hardcore unlock */
|
||||||
const settings_t* settings = config_get_ptr();
|
check_measured = rcheevos_locals.hardcore_active;
|
||||||
const bool hardcore = settings->bools.cheevos_hardcore_mode_enable && !rcheevos_hardcore_paused;
|
|
||||||
check_measured = hardcore;
|
|
||||||
|
|
||||||
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY;
|
enum_idx = MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY;
|
||||||
}
|
}
|
||||||
|
@ -1188,9 +1184,9 @@ void rcheevos_populate_menu(void* data)
|
||||||
|
|
||||||
if ( cheevos_enable
|
if ( cheevos_enable
|
||||||
&& cheevos_hardcore_mode_enable
|
&& cheevos_hardcore_mode_enable
|
||||||
&& rcheevos_loaded)
|
&& rcheevos_locals.loaded)
|
||||||
{
|
{
|
||||||
if (!rcheevos_hardcore_paused)
|
if (rcheevos_locals.hardcore_active)
|
||||||
menu_entries_append_enum(info->list,
|
menu_entries_append_enum(info->list,
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_PAUSE),
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_PAUSE),
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_ACHIEVEMENT_PAUSE),
|
msg_hash_to_str(MENU_ENUM_LABEL_ACHIEVEMENT_PAUSE),
|
||||||
|
@ -1236,7 +1232,7 @@ bool rcheevos_get_description(rcheevos_ctx_desc_t* desc)
|
||||||
|
|
||||||
*desc->s = 0;
|
*desc->s = 0;
|
||||||
|
|
||||||
if (rcheevos_loaded)
|
if (rcheevos_locals.loaded)
|
||||||
{
|
{
|
||||||
idx = desc->idx;
|
idx = desc->idx;
|
||||||
|
|
||||||
|
@ -1258,9 +1254,15 @@ bool rcheevos_get_description(rcheevos_ctx_desc_t* desc)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool rcheevos_hardcore_active(void)
|
||||||
|
{
|
||||||
|
return rcheevos_locals.hardcore_active;
|
||||||
|
}
|
||||||
|
|
||||||
void rcheevos_pause_hardcore(void)
|
void rcheevos_pause_hardcore(void)
|
||||||
{
|
{
|
||||||
rcheevos_hardcore_paused = true;
|
if (rcheevos_locals.hardcore_active)
|
||||||
|
rcheevos_toggle_hardcore_paused();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rcheevos_unload(void)
|
bool rcheevos_unload(void)
|
||||||
|
@ -1288,7 +1290,7 @@ bool rcheevos_unload(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcheevos_loaded)
|
if (rcheevos_locals.loaded)
|
||||||
{
|
{
|
||||||
for (i = 0, count = rcheevos_locals.patchdata.core_count; i < count; i++)
|
for (i = 0, count = rcheevos_locals.patchdata.core_count; i < count; i++)
|
||||||
{
|
{
|
||||||
|
@ -1320,10 +1322,8 @@ bool rcheevos_unload(void)
|
||||||
rcheevos_locals.lboards = NULL;
|
rcheevos_locals.lboards = NULL;
|
||||||
rcheevos_locals.richpresence.richpresence = NULL;
|
rcheevos_locals.richpresence.richpresence = NULL;
|
||||||
|
|
||||||
rcheevos_loaded = false;
|
rcheevos_locals.loaded = false;
|
||||||
rcheevos_hardcore_active = false;
|
rcheevos_locals.hardcore_active = false;
|
||||||
rcheevos_hardcore_paused = false;
|
|
||||||
rcheevos_state_loaded_flag = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if the config-level token has been cleared, we need to re-login on loading the next game */
|
/* if the config-level token has been cleared, we need to re-login on loading the next game */
|
||||||
|
@ -1333,40 +1333,63 @@ bool rcheevos_unload(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rcheevos_toggle_hardcore_mode(void)
|
static void rcheevos_toggle_hardcore_active(void)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t* settings = config_get_ptr();
|
||||||
bool cheevos_hardcore_mode_enable = settings->bools.cheevos_hardcore_mode_enable;
|
bool rewind_enable = settings->bools.rewind_enable;
|
||||||
bool rewind_enable = settings->bools.rewind_enable;
|
|
||||||
|
|
||||||
/* reset and deinit rewind to avoid cheat the score */
|
if (!rcheevos_locals.hardcore_active)
|
||||||
if (cheevos_hardcore_mode_enable
|
|
||||||
&& !rcheevos_hardcore_paused)
|
|
||||||
{
|
{
|
||||||
const char *msg = msg_hash_to_str(
|
/* activate hardcore */
|
||||||
MSG_CHEEVOS_HARDCORE_MODE_ENABLE);
|
rcheevos_locals.hardcore_active = true;
|
||||||
|
|
||||||
/* reset the state loaded flag in case it was set */
|
if (rcheevos_locals.loaded)
|
||||||
rcheevos_state_loaded_flag = false;
|
{
|
||||||
|
const char* msg = msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_ENABLE);
|
||||||
|
CHEEVOS_LOG("%s\n", msg);
|
||||||
|
runloop_msg_queue_push(msg, 0, 3 * 60, true, NULL,
|
||||||
|
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||||
|
|
||||||
/* send reset core cmd to avoid any user
|
/* reset the game */
|
||||||
* savestate previusly loaded. */
|
command_event(CMD_EVENT_RESET, NULL);
|
||||||
command_event(CMD_EVENT_RESET, NULL);
|
}
|
||||||
|
|
||||||
|
/* deinit rewind */
|
||||||
if (rewind_enable)
|
if (rewind_enable)
|
||||||
command_event(CMD_EVENT_REWIND_DEINIT, NULL);
|
command_event(CMD_EVENT_REWIND_DEINIT, NULL);
|
||||||
|
|
||||||
CHEEVOS_LOG("%s\n", msg);
|
|
||||||
runloop_msg_queue_push(msg, 0, 3 * 60, true, NULL,
|
|
||||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* pause hardcore */
|
||||||
|
rcheevos_locals.hardcore_active = false;
|
||||||
|
|
||||||
|
if (rcheevos_locals.loaded)
|
||||||
|
{
|
||||||
|
CHEEVOS_LOG(RCHEEVOS_TAG "Hardcore paused\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* re-init rewind */
|
||||||
if (rewind_enable)
|
if (rewind_enable)
|
||||||
command_event(CMD_EVENT_REWIND_INIT, NULL);
|
command_event(CMD_EVENT_REWIND_INIT, NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
void rcheevos_toggle_hardcore_paused(void)
|
||||||
|
{
|
||||||
|
settings_t* settings = config_get_ptr();
|
||||||
|
|
||||||
|
/* if hardcore mode is not enabled, we can't toggle it */
|
||||||
|
if (settings->bools.cheevos_hardcore_mode_enable)
|
||||||
|
rcheevos_toggle_hardcore_active();
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcheevos_hardcore_enabled_changed(void)
|
||||||
|
{
|
||||||
|
const settings_t* settings = config_get_ptr();
|
||||||
|
const bool enabled = settings && settings->bools.cheevos_enable && settings->bools.cheevos_hardcore_mode_enable;
|
||||||
|
|
||||||
|
if (enabled != rcheevos_locals.hardcore_active)
|
||||||
|
rcheevos_toggle_hardcore_active();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -1374,7 +1397,12 @@ Test all the achievements (call once per frame).
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void rcheevos_test(void)
|
void rcheevos_test(void)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t* settings;
|
||||||
|
|
||||||
|
if (!rcheevos_locals.loaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
settings = config_get_ptr();
|
||||||
|
|
||||||
if (rcheevos_locals.memory.count == 0)
|
if (rcheevos_locals.memory.count == 0)
|
||||||
{
|
{
|
||||||
|
@ -1383,10 +1411,11 @@ void rcheevos_test(void)
|
||||||
{
|
{
|
||||||
CHEEVOS_ERR(RCHEEVOS_TAG "No memory exposed by core\n");
|
CHEEVOS_ERR(RCHEEVOS_TAG "No memory exposed by core\n");
|
||||||
|
|
||||||
if (settings->bools.cheevos_verbose_enable)
|
if (settings && settings->bools.cheevos_verbose_enable)
|
||||||
runloop_msg_queue_push("Cannot activate achievements using this core.", 0, 4 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
|
runloop_msg_queue_push("Cannot activate achievements using this core.", 0, 4 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
|
||||||
|
|
||||||
rcheevos_loaded = false;
|
rcheevos_locals.loaded = false;
|
||||||
|
rcheevos_pause_hardcore();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1398,9 +1427,7 @@ void rcheevos_test(void)
|
||||||
if (settings->bools.cheevos_test_unofficial)
|
if (settings->bools.cheevos_test_unofficial)
|
||||||
rcheevos_test_cheevo_set(false);
|
rcheevos_test_cheevo_set(false);
|
||||||
|
|
||||||
if (settings->bools.cheevos_hardcore_mode_enable &&
|
if (rcheevos_locals.hardcore_active && settings->bools.cheevos_leaderboards_enable)
|
||||||
settings->bools.cheevos_leaderboards_enable &&
|
|
||||||
!rcheevos_hardcore_paused)
|
|
||||||
rcheevos_test_leaderboards();
|
rcheevos_test_leaderboards();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1556,7 +1583,7 @@ static int rcheevos_iterate(rcheevos_coro_t* coro)
|
||||||
{
|
{
|
||||||
CHEEVOS_LOG(RCHEEVOS_TAG "this game doesn't feature achievements\n");
|
CHEEVOS_LOG(RCHEEVOS_TAG "this game doesn't feature achievements\n");
|
||||||
strcpy(rcheevos_locals.hash, "N/A");
|
strcpy(rcheevos_locals.hash, "N/A");
|
||||||
rcheevos_hardcore_paused = true;
|
rcheevos_pause_hardcore();
|
||||||
CORO_STOP();
|
CORO_STOP();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1609,12 +1636,11 @@ static int rcheevos_iterate(rcheevos_coro_t* coro)
|
||||||
"This game has no achievements.",
|
"This game has no achievements.",
|
||||||
0, 5 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
0, 5 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||||
|
|
||||||
rcheevos_hardcore_paused = true;
|
rcheevos_pause_hardcore();
|
||||||
|
|
||||||
CORO_STOP();
|
CORO_STOP();
|
||||||
}
|
}
|
||||||
|
|
||||||
rcheevos_loaded = true;
|
rcheevos_locals.loaded = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Inputs: CHEEVOS_VAR_GAMEID
|
* Inputs: CHEEVOS_VAR_GAMEID
|
||||||
|
@ -1638,7 +1664,7 @@ static int rcheevos_iterate(rcheevos_coro_t* coro)
|
||||||
int number_of_unlocked = rcheevos_locals.patchdata.core_count;
|
int number_of_unlocked = rcheevos_locals.patchdata.core_count;
|
||||||
int number_of_unsupported = 0;
|
int number_of_unsupported = 0;
|
||||||
|
|
||||||
if (coro->settings->bools.cheevos_hardcore_mode_enable && !rcheevos_hardcore_paused)
|
if (rcheevos_locals.hardcore_active)
|
||||||
mode = RCHEEVOS_ACTIVE_HARDCORE;
|
mode = RCHEEVOS_ACTIVE_HARDCORE;
|
||||||
|
|
||||||
for (; cheevo < end; cheevo++)
|
for (; cheevo < end; cheevo++)
|
||||||
|
@ -2256,15 +2282,17 @@ bool rcheevos_load(const void *data)
|
||||||
struct rc_hash_filereader filereader;
|
struct rc_hash_filereader filereader;
|
||||||
struct rc_hash_cdreader cdreader;
|
struct rc_hash_cdreader cdreader;
|
||||||
|
|
||||||
rcheevos_loaded = false;
|
rcheevos_locals.loaded = false;
|
||||||
rcheevos_hardcore_paused = false;
|
|
||||||
|
|
||||||
if (!cheevos_enable || !rcheevos_locals.core_supports || !data)
|
if (!cheevos_enable || !rcheevos_locals.core_supports || !data)
|
||||||
{
|
{
|
||||||
rcheevos_hardcore_paused = true;
|
rcheevos_pause_hardcore();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* reset hardcore mode based on configs */
|
||||||
|
rcheevos_hardcore_enabled_changed();
|
||||||
|
|
||||||
coro = (rcheevos_coro_t*)calloc(1, sizeof(*coro));
|
coro = (rcheevos_coro_t*)calloc(1, sizeof(*coro));
|
||||||
|
|
||||||
if (!coro)
|
if (!coro)
|
||||||
|
|
|
@ -53,7 +53,8 @@ void rcheevos_pause_hardcore();
|
||||||
|
|
||||||
bool rcheevos_unload(void);
|
bool rcheevos_unload(void);
|
||||||
|
|
||||||
bool rcheevos_toggle_hardcore_mode(void);
|
void rcheevos_hardcore_enabled_changed(void);
|
||||||
|
void rcheevos_toggle_hardcore_paused(void);
|
||||||
|
|
||||||
void rcheevos_test(void);
|
void rcheevos_test(void);
|
||||||
|
|
||||||
|
@ -67,10 +68,7 @@ const char *rcheevos_get_richpresence(void);
|
||||||
|
|
||||||
uint8_t* rcheevos_patch_address(unsigned address);
|
uint8_t* rcheevos_patch_address(unsigned address);
|
||||||
|
|
||||||
extern bool rcheevos_loaded;
|
bool rcheevos_hardcore_active(void);
|
||||||
extern bool rcheevos_hardcore_active;
|
|
||||||
extern bool rcheevos_hardcore_paused;
|
|
||||||
extern bool rcheevos_state_loaded_flag;
|
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -108,11 +108,8 @@ void cheat_manager_apply_cheats(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (idx != 0)
|
if (idx != 0 && rcheevos_hardcore_active())
|
||||||
if ( rcheevos_hardcore_active
|
cheat_manager_pause_cheevos();
|
||||||
&& rcheevos_loaded
|
|
||||||
&& !rcheevos_hardcore_paused)
|
|
||||||
cheat_manager_pause_cheevos();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1568,11 +1565,8 @@ void cheat_manager_apply_retro_cheats(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (cheat_applied)
|
if (cheat_applied && rcheevos_hardcore_active())
|
||||||
if ( rcheevos_hardcore_active
|
cheat_manager_pause_cheevos();
|
||||||
&& rcheevos_loaded
|
|
||||||
&& !rcheevos_hardcore_paused)
|
|
||||||
cheat_manager_pause_cheevos();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,10 +85,6 @@
|
||||||
#include "../../network/netplay/netplay_discovery.h"
|
#include "../../network/netplay/netplay_discovery.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CHEEVOS
|
|
||||||
#include "../../cheevos/cheevos.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __WINRT__
|
#ifdef __WINRT__
|
||||||
#include "../../uwp/uwp_func.h"
|
#include "../../uwp/uwp_func.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -3965,9 +3961,6 @@ static int action_ok_save_state(const char *path,
|
||||||
static int action_ok_cheevos_toggle_hardcore_mode(const char *path,
|
static int action_ok_cheevos_toggle_hardcore_mode(const char *path,
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CHEEVOS
|
|
||||||
rcheevos_hardcore_paused = !rcheevos_hardcore_paused;
|
|
||||||
#endif
|
|
||||||
generic_action_ok_command(CMD_EVENT_CHEEVOS_HARDCORE_MODE_TOGGLE);
|
generic_action_ok_command(CMD_EVENT_CHEEVOS_HARDCORE_MODE_TOGGLE);
|
||||||
return generic_action_ok_command(CMD_EVENT_RESUME);
|
return generic_action_ok_command(CMD_EVENT_RESUME);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2509,7 +2509,7 @@ static int menu_displaylist_parse_load_content_settings(
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (!rcheevos_hardcore_active)
|
if (!rcheevos_hardcore_active())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (menu_entries_append_enum(list,
|
if (menu_entries_append_enum(list,
|
||||||
|
@ -2525,7 +2525,7 @@ static int menu_displaylist_parse_load_content_settings(
|
||||||
settings->bools.quick_menu_show_undo_save_load_state)
|
settings->bools.quick_menu_show_undo_save_load_state)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (!rcheevos_hardcore_active)
|
if (!rcheevos_hardcore_active())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (menu_entries_append_enum(list,
|
if (menu_entries_append_enum(list,
|
||||||
|
|
|
@ -7389,16 +7389,7 @@ static void change_handler_video_layout_selected_view(rarch_setting_t *setting)
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
static void achievement_hardcore_mode_write_handler(rarch_setting_t *setting)
|
static void achievement_hardcore_mode_write_handler(rarch_setting_t *setting)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
rcheevos_hardcore_enabled_changed();
|
||||||
|
|
||||||
if (!setting)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (settings && settings->bools.cheevos_enable && settings->bools.cheevos_hardcore_mode_enable)
|
|
||||||
{
|
|
||||||
rcheevos_toggle_hardcore_mode();
|
|
||||||
command_event(CMD_EVENT_RESET, NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
43
retroarch.c
43
retroarch.c
|
@ -12972,7 +12972,7 @@ static bool command_write_ram(const char *arg)
|
||||||
if (!data)
|
if (!data)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (rcheevos_hardcore_active && rcheevos_loaded && !rcheevos_hardcore_paused)
|
if (rcheevos_hardcore_active())
|
||||||
{
|
{
|
||||||
RARCH_LOG("Achievements hardcore mode disabled by WRITE_CORE_RAM\n");
|
RARCH_LOG("Achievements hardcore mode disabled by WRITE_CORE_RAM\n");
|
||||||
rcheevos_pause_hardcore();
|
rcheevos_pause_hardcore();
|
||||||
|
@ -14846,7 +14846,7 @@ static void command_event_load_auto_state(
|
||||||
if (!global || !savestate_auto_load)
|
if (!global || !savestate_auto_load)
|
||||||
return;
|
return;
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (rcheevos_hardcore_active)
|
if (rcheevos_hardcore_active())
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
|
@ -15249,7 +15249,7 @@ static bool command_event_save_auto_state(
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (rcheevos_hardcore_active)
|
if (rcheevos_hardcore_active())
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -15552,8 +15552,11 @@ static bool command_event_main_state(
|
||||||
if (content_load_state(state_path, false, false))
|
if (content_load_state(state_path, false, false))
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (rcheevos_hardcore_active)
|
if (rcheevos_hardcore_active())
|
||||||
rcheevos_state_loaded_flag = true;
|
{
|
||||||
|
rcheevos_pause_hardcore();
|
||||||
|
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_DISABLED), 0, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
ret = true;
|
ret = true;
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
|
@ -15978,7 +15981,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (rcheevos_hardcore_active)
|
if (rcheevos_hardcore_active())
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
if (!command_event_main_state(p_rarch, cmd))
|
if (!command_event_main_state(p_rarch, cmd))
|
||||||
|
@ -16005,10 +16008,6 @@ bool command_event(enum event_command cmd, void *data)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case CMD_EVENT_RESET:
|
case CMD_EVENT_RESET:
|
||||||
#ifdef HAVE_CHEEVOS
|
|
||||||
rcheevos_state_loaded_flag = false;
|
|
||||||
rcheevos_hardcore_paused = false;
|
|
||||||
#endif
|
|
||||||
RARCH_LOG("%s.\n", msg_hash_to_str(MSG_RESET));
|
RARCH_LOG("%s.\n", msg_hash_to_str(MSG_RESET));
|
||||||
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET), 1, 120, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET), 1, 120, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||||
|
|
||||||
|
@ -16141,7 +16140,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||||
break;
|
break;
|
||||||
case CMD_EVENT_CHEEVOS_HARDCORE_MODE_TOGGLE:
|
case CMD_EVENT_CHEEVOS_HARDCORE_MODE_TOGGLE:
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
rcheevos_toggle_hardcore_mode();
|
rcheevos_toggle_hardcore_paused();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case CMD_EVENT_REINIT_FROM_TOGGLE:
|
case CMD_EVENT_REINIT_FROM_TOGGLE:
|
||||||
|
@ -16159,10 +16158,6 @@ bool command_event(enum event_command cmd, void *data)
|
||||||
break;
|
break;
|
||||||
case CMD_EVENT_REWIND_DEINIT:
|
case CMD_EVENT_REWIND_DEINIT:
|
||||||
#ifdef HAVE_REWIND
|
#ifdef HAVE_REWIND
|
||||||
#ifdef HAVE_CHEEVOS
|
|
||||||
if (rcheevos_hardcore_active)
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
state_manager_event_deinit();
|
state_manager_event_deinit();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -16172,7 +16167,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||||
bool rewind_enable = settings->bools.rewind_enable;
|
bool rewind_enable = settings->bools.rewind_enable;
|
||||||
unsigned rewind_buf_size = settings->sizes.rewind_buffer_size;
|
unsigned rewind_buf_size = settings->sizes.rewind_buffer_size;
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (rcheevos_hardcore_active)
|
if (rcheevos_hardcore_active())
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
if (rewind_enable)
|
if (rewind_enable)
|
||||||
|
@ -39378,17 +39373,7 @@ static enum runloop_state runloop_check_state(
|
||||||
HOTKEY_CHECK(RARCH_LOAD_STATE_KEY, CMD_EVENT_LOAD_STATE, true, NULL);
|
HOTKEY_CHECK(RARCH_LOAD_STATE_KEY, CMD_EVENT_LOAD_STATE, true, NULL);
|
||||||
|
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
rcheevos_hardcore_active = settings->bools.cheevos_enable
|
if (!rcheevos_hardcore_active())
|
||||||
&& settings->bools.cheevos_hardcore_mode_enable
|
|
||||||
&& !rcheevos_hardcore_paused;
|
|
||||||
|
|
||||||
if (rcheevos_hardcore_active && rcheevos_state_loaded_flag)
|
|
||||||
{
|
|
||||||
rcheevos_hardcore_paused = true;
|
|
||||||
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEEVOS_HARDCORE_MODE_DISABLED), 0, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!rcheevos_hardcore_active)
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_REWIND
|
#ifdef HAVE_REWIND
|
||||||
{
|
{
|
||||||
|
@ -39419,7 +39404,7 @@ static enum runloop_state runloop_check_state(
|
||||||
|
|
||||||
/* Checks if slowmotion toggle/hold was being pressed and/or held. */
|
/* Checks if slowmotion toggle/hold was being pressed and/or held. */
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (!rcheevos_hardcore_active)
|
if (!rcheevos_hardcore_active())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
static bool old_slowmotion_button_state = false;
|
static bool old_slowmotion_button_state = false;
|
||||||
|
@ -39746,7 +39731,7 @@ int runloop_iterate(void)
|
||||||
p_rarch, current_time);
|
p_rarch, current_time);
|
||||||
|
|
||||||
#ifdef HAVE_CHEEVOS
|
#ifdef HAVE_CHEEVOS
|
||||||
if (settings->bools.cheevos_enable && rcheevos_loaded)
|
if (settings->bools.cheevos_enable)
|
||||||
rcheevos_test();
|
rcheevos_test();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CHEATS
|
#ifdef HAVE_CHEATS
|
||||||
|
|
|
@ -1059,10 +1059,10 @@ static bool content_file_load(
|
||||||
if (type == RARCH_CONTENT_NONE && !string_is_empty(content_path))
|
if (type == RARCH_CONTENT_NONE && !string_is_empty(content_path))
|
||||||
rcheevos_load(info);
|
rcheevos_load(info);
|
||||||
else
|
else
|
||||||
rcheevos_hardcore_paused = true;
|
rcheevos_pause_hardcore();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rcheevos_hardcore_paused = true;
|
rcheevos_pause_hardcore();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue