diff --git a/tools/linuxfs/overlay/usr/local/bin/steam-compatibility b/tools/linuxfs/overlay/usr/local/bin/steam-compatibility index 426b6c173..cf616c86f 100755 --- a/tools/linuxfs/overlay/usr/local/bin/steam-compatibility +++ b/tools/linuxfs/overlay/usr/local/bin/steam-compatibility @@ -1540,7 +1540,7 @@ def register_default(config_path, apps=(), protect=(), default=None, catalog=Non auto = followers(state, current) known = {app for app in state.get("owned", ()) if isinstance(app, str)} if isinstance(state.get("owned"), list) else set() pinned = {app: current[app] for app in set(owned) - known - if current.get(app) in {TOOL, previous} | gone and app not in auto} + if app in current and current.get(app) in {TOOL, previous} | gone and app not in auto} if pinned and isinstance(auto, dict): state["auto"] = dict(auto, **pinned) state["owned"] = sorted(set(owned), key=app_order) diff --git a/tools/tests/test_steam_compat_x64.py b/tools/tests/test_steam_compat_x64.py index 9f9abc478..9d9bf109e 100644 --- a/tools/tests/test_steam_compat_x64.py +++ b/tools/tests/test_steam_compat_x64.py @@ -99,6 +99,31 @@ class X64RepointTest(unittest.TestCase): self.assertEqual(COMPAT["x64_repoint"](str(self.root), None), []) self.assertEqual((self.root / "config" / "config.vdf").read_text(), before) + def test_new_owned_shortcut_gets_the_x64_default_and_explicit_choice_stays(self): + app = "2350879490" + chosen = "proton-cachyos-a64" + config = self.root / "config" / "config.vdf" + state = self.root / "droiddeck-compat" + self.assertEqual(COMPAT["register_default"]( + str(config), apps=[app], protect={chosen: "proton-cachyos-a64"}, + default="GE-Proton11-7-a64", directory=str(state), + linux_tool="droiddeck-direct", owned=[app]), "GE-Proton11-7-a64") + self.assertEqual(self.mapping()[app], "GE-Proton11-7-a64") + self.assertEqual(COMPAT["register_default"]( + str(config), apps=[app], protect={chosen: "proton-cachyos-a64"}, + default="GE-Proton11-7-a64", directory=str(state), + linux_tool="droiddeck-direct", owned=[app]), "GE-Proton11-7-a64") + self.assertEqual(self.mapping()[app], "GE-Proton11-7-a64") + tokens = COMPAT["tokenize"](config.read_text()) + mapping = COMPAT["mapping_block"](tokens) + COMPAT["set_mapping"](tokens, mapping, app, chosen) + config.write_text(COMPAT["serialize"](tokens)) + COMPAT["register_default"]( + str(config), apps=[app], protect={chosen: "proton-cachyos-a64"}, + default="GE-Proton11-7-a64", directory=str(state), + linux_tool="droiddeck-direct", owned=[app]) + self.assertEqual(self.mapping()[app], chosen) + if __name__ == "__main__": unittest.main()