Skip to content

Commit

Permalink
fix hardcore acting as if it's enabled when it isn't
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamiras committed May 15, 2024
1 parent ce6dbcd commit 6b5d529
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cheevos/cheevos.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ static rcheevos_locals_t rcheevos_locals =
#endif
#ifdef HAVE_RC_CLIENT
true, /* hardcore_allowed */
false,/* hardcore_being_enabled */
#else
#ifdef HAVE_GFX_WIDGETS
0, /* active_lboard_trackers */
Expand Down Expand Up @@ -1194,7 +1195,7 @@ bool rcheevos_hardcore_active(void)

/* if we're trying to enable hardcore, pretend it's on so the caller can decide to disable
* it (by calling rcheevos_pause_hardcore) before we actually turn it on. */
return rcheevos_locals.hardcore_allowed;
return rcheevos_locals.hardcore_being_enabled;
#else
return rcheevos_locals.hardcore_active;
#endif
Expand Down Expand Up @@ -1532,6 +1533,7 @@ static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
if (!was_enabled)
{
#ifdef HAVE_RC_CLIENT
locals->hardcore_being_enabled = true;
locals->hardcore_allowed = true;
#else
/* Activate hardcore */
Expand All @@ -1542,7 +1544,10 @@ static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
rcheevos_validate_config_settings();
#ifdef HAVE_RC_CLIENT
if (!locals->hardcore_allowed)
{
locals->hardcore_being_enabled = false;
return;
}
#else
if (!locals->hardcore_active)
return;
Expand All @@ -1553,8 +1558,11 @@ static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
cheat_manager_apply_cheats();
#ifdef HAVE_RC_CLIENT
if (!locals->hardcore_allowed)
{
locals->hardcore_being_enabled = false;
return;
#else
}
#else
if (!locals->hardcore_active)
return;
#endif
Expand Down Expand Up @@ -1596,6 +1604,7 @@ static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals)
}

#ifdef HAVE_RC_CLIENT
locals->hardcore_being_enabled = false;
rc_client_set_hardcore_enabled(locals->client, 1);
#endif
}
Expand Down
1 change: 1 addition & 0 deletions cheevos/cheevos_locals.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ typedef struct rcheevos_locals_t

#ifdef HAVE_RC_CLIENT
bool hardcore_allowed; /* prevents enabling hardcore if illegal settings detected */
bool hardcore_being_enabled; /* allows callers to detect hardcore mode while it's being enabled */
#else

#ifdef HAVE_GFX_WIDGETS
Expand Down

0 comments on commit 6b5d529

Please sign in to comment.