From 881ea95f148511b629b0b92653745b8bc678f8a1 Mon Sep 17 00:00:00 2001 From: Ariel Juodziukynas Date: Sat, 1 Mar 2025 16:24:12 -0300 Subject: [PATCH] [UX/Fix] Respect experimental UMU support disabled (#4191) * Respect experimental UMU config after new default change * umuSupport experimental feature optional * fix comparison of disableUMU check * fix default `disableUMU` config for new games and old games --- src/backend/game_config.ts | 4 ++++ src/backend/utils/compatibility_layers.ts | 17 ++++++++++++++++- src/common/types.ts | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/backend/game_config.ts b/src/backend/game_config.ts index f116e149af..5678c09c6c 100644 --- a/src/backend/game_config.ts +++ b/src/backend/game_config.ts @@ -277,6 +277,10 @@ class GameConfigV0 extends GameConfig { // read game's settings const settings = JSON.parse(readFileSync(this.path, 'utf-8')) gameSettings = settings[this.appName] || ({} as GameSettings) + } else { + // only set the `disableUMU` default value when getting settings for a new game + // we want it to be `undefined` for games that were installed already + defaultSettings.disableUMU = false } if (!isWindows) { diff --git a/src/backend/utils/compatibility_layers.ts b/src/backend/utils/compatibility_layers.ts index d128bccc8e..f8118f827c 100644 --- a/src/backend/utils/compatibility_layers.ts +++ b/src/backend/utils/compatibility_layers.ts @@ -559,7 +559,22 @@ export async function isUmuSupported( ): Promise { if (!isLinux) return false if (gameSettings.wineVersion.type !== 'proton') return false - if (gameSettings.disableUMU) return false + if (gameSettings.disableUMU === true) return false + if (gameSettings.disableUMU === undefined) { + // If the disableUMU setting is undefined it means the game was installed and configured + // before the introduction of this setting, so the usage of UMU was dictated by the + // experimental feature configuration. + // + // We have to check this to not enable UMU incorrectly even if the setting is not editable + // anymore. + // If we don't, we would end up enabling UMU for games that are already functional with proton + // without UMU to not mess their prefix + const experimentalFeatures = + GlobalConfig.get().getSettings().experimentalFeatures + + // if UMU was never enabled or was enabled and then disabled + if (!experimentalFeatures?.umuSupport) return false + } if (!checkUmuInstalled) return true if (!existsSync(await getUmuPath())) return false diff --git a/src/common/types.ts b/src/common/types.ts index 51e3570b35..aa88a9272c 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -66,6 +66,7 @@ export type ExperimentalFeatures = { enableNewDesign: boolean enableHelp: boolean cometSupport: boolean + umuSupport?: boolean } export interface AppSettings extends GameSettings {