[GameMode] Don't probe libgamemode on every config load, preserve user setting

Two related fixes for the GameMode startup behavior on Linux:

1. configuration.c: Only call frontend_driver_set_gamemode() during config
   load when gamemode_enable is actually true. Previously the probe ran
   unconditionally with the current setting value, meaning every user on
   every config load triggered a dlopen of libgamemode.so even when the
   feature was off - producing log spam ("[GameMode] GameMode cannot be
   enabled on this system...") for the majority of users who don't have
   libgamemode installed.

   Also stop force-disabling gamemode_enable in the config when the probe
   fails. Silently flipping the user's preference to false and persisting
   it to retroarch.cfg meant a transient failure (sandbox path issue,
   library not yet installed, multi-arch mismatch, etc.) would require
   the user to manually re-enable the option on every subsequent launch.
   The user's intent should survive across sessions; if libgamemode shows
   up later, the next launch picks it up automatically.

2. frontend/drivers/platform_unix.c: Latch the unavailable state inside
   frontend_unix_set_gamemode() once gamemode_query_status() reports
   failure. The result will not change for the lifetime of the process,
   so subsequent calls (deinit cleanup, menu toggles) short-circuit
   without re-entering the Feral client code and without re-emitting the
   warning. The warning now fires exactly once per process when the user
   has gamemode enabled but libgamemode is missing.

The redundant "[Config] GameMode unsupported - disabling..." follow-up
warning is removed - it added no information beyond what the GameMode
warning already conveys.
This commit is contained in:
U-DESKTOP-SPFP6AQ\twistedtechre committed 2026-05-01 11:35:46 +02:00
1 parent 0a7758076d
commit cd386a3933
2 files changed
+25 -10

No files matched your search

+10 -8
View File
@@ -4653,14 +4653,16 @@ static bool config_load_file(global_t *global,
if (!(bool)RHMAP_HAS_STR(conf->entries_map, "user_language"))
msg_hash_set_uint(MSG_HASH_USER_LANGUAGE, frontend_driver_get_user_language());
if (frontend_driver_has_gamemode() &&
!frontend_driver_set_gamemode(settings->bools.gamemode_enable) &&
settings->bools.gamemode_enable)
{
RARCH_WARN("[Config] GameMode unsupported - disabling...\n");
configuration_set_bool(settings,
settings->bools.gamemode_enable, false);
}
/* If GameMode is enabled in the config but libgamemode is not
* available, warn once. Do NOT clear the setting: that would
* silently overwrite the user's preference in retroarch.cfg, so
* a transient failure (sandbox path issue, library not yet
* installed, etc.) would force them to re-enable it manually on
* every subsequent launch. The probe is latched inside the
* frontend driver, so it will not be retried this session. */
if ( settings->bools.gamemode_enable
&& frontend_driver_has_gamemode())
frontend_driver_set_gamemode(true);
/* If this is the first run of an existing installation
* after the independent favourites playlist size limit was
+15 -2
View File
@@ -2186,8 +2186,20 @@ static void android_app_destroy(struct android_app *android_app)
static bool frontend_unix_set_gamemode(bool on)
{
#ifdef FERAL_GAMEMODE
int gamemode_status = gamemode_query_status();
bool gamemode_active = (gamemode_status == 2);
/* Once gamemode_query_status() reports failure (typically because
* libgamemode.so is not installed), there is no point repeatedly
* re-probing on every config load or menu toggle - the result will
* not change for the lifetime of the process, and each probe emits
* a warning. Latch the unavailable state and short-circuit. */
static bool gamemode_unavailable = false;
int gamemode_status;
bool gamemode_active;
if (gamemode_unavailable)
return false;
gamemode_status = gamemode_query_status();
gamemode_active = (gamemode_status == 2);
if (gamemode_status < 0)
{
@@ -2196,6 +2208,7 @@ static bool frontend_unix_set_gamemode(bool on)
"https://github.com/FeralInteractive/gamemode needs to be installed.\n",
gamemode_error_string());
gamemode_unavailable = true;
return false;
}