mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
Refs #1248 ## Problem Users report that changing a game's compatibility tool in Steam's game properties doesn't stick: it goes back to DroidDeck's default. #1248 was closed by #1250, but its reporter still saw it after clearing the game's DroidDeck profile. A game's tool can be chosen in two places, DroidDeck's per-game Proton (`games.json`, written by `ProtonDefault.requestGame`) and Steam. `plan_mapping` treats every `games.json` entry as an override that always wins, so the live helper (`droiddeck-steam-compat`, on `CompatManager.NotifyStateChanged`) sets it back within a second, and `steam-compatibility` does again at every session start. A `null` entry ("use the default", also written by a profile reset) is forced as the default, so resetting the profile made it worse. Reproduced with the real `plan_mapping` (game 220, Steam set to `droiddeck-fex`): | `games.json` entry | before | |---|---| | none | kept | | `null` (profile reset / "Default") | reverted to default | | a DroidDeck Proton | reverted to it | ## Change Whichever side changed a game's tool last wins: - A DroidDeck choice is applied once (as now). Once applied, a different pick in Steam stands: - a pick of one of DroidDeck's Protons becomes the DroidDeck choice too (`games.json` updated, so the app shows it); - any other pick (FEX, a Steam Linux Runtime, clearing the forced tool) removes the game from `games.json`. - `null` is applied once and then dropped, so the game follows the default like one DroidDeck never managed. - What was applied is kept in `state.json` as `games_applied`. Choices an earlier build already applied count as applied (when `state.json` is from an earlier build), so upgrading respects the Steam picks users already made. - `games.json` is rewritten only if the app didn't replace it after it was read, so a newer app choice is never overwritten. - An x86-only Valve Proton picked in Steam is still replaced (`unrunnable`), unchanged. Both paths share the logic: `register_default` (session start, reads config.vdf; with the client stopped, an app missing from the mapping counts as cleared) and the live helper's `reconcile`. ## Tests - `test_steam_compat_live.py` + `test_game_environment.py`: 109 pass locally (103 existing + 6 new). The 6 new tests fail on the old scripts. - Steam pick after an app choice is kept live, and a new app choice applies again - Steam pick of a DroidDeck Proton becomes the app's choice - "use the default" applies once, then Steam picks stand - upgrade: choices an earlier build applied give way to Steam picks - an app choice written during a sync is not overwritten - session start keeps a Steam pick from config.vdf Not device-tested. ## Side note: `test_authorship` writes into the global git hooks `InstalledHooksTest.setUp` runs `tools/release/install_authorship_hooks.py` in a temp repo, but the installer reads `core.hooksPath` from the **global** config. On a machine with a global hooks path, running the suite replaced the user's global `commit-msg`/`prepare-commit-msg`/`pre-push` with hooks pointing into the deleted temp repo (every later commit failed), and the saved originals were deleted with the temp repo. The test should isolate `HOME`/`GIT_CONFIG_GLOBAL`. Not changed in this PR.