mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
chore: drop comments
This commit is contained in:
1 parent
a4abb797a7
commit
3e85e4a614
2 files changed
-16
No files matched your search
@@ -617,7 +617,6 @@ class Helper:
|
||||
current[app] = ""
|
||||
elif not current.get(app):
|
||||
current.pop(app, None)
|
||||
# The client's pick of a tool the app chose for a game wins once the app's choice was applied.
|
||||
requests = COMPAT["settled_game_requests"](state, current, catalog)
|
||||
overrides = COMPAT["requested_games"](requests or {}, catalog, [t["name"] for t in live])
|
||||
overrides = {app: tool for app, tool in overrides.items() if app not in refused}
|
||||
|
||||
@@ -1117,7 +1117,6 @@ def game_requests(directory=None):
|
||||
|
||||
|
||||
def read_game_requests(directory=None):
|
||||
"""The app's per-game Proton choices, and the file's text so a rewrite can tell the app wrote it since."""
|
||||
try:
|
||||
with open(state_path("games.json", directory), encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
@@ -1130,7 +1129,6 @@ def read_game_requests(directory=None):
|
||||
|
||||
|
||||
def write_game_requests(requests, original, directory=None):
|
||||
"""Rewrites games.json unless the app replaced it after it was read; that newer choice wins."""
|
||||
path = state_path("games.json", directory)
|
||||
try:
|
||||
with open(path, encoding="utf-8") as f:
|
||||
@@ -1149,17 +1147,10 @@ def valid_game_request(app, request):
|
||||
|
||||
|
||||
def settle_game_requests(requests, state, current, catalog, missing_is_cleared=False):
|
||||
"""Whichever side changed a game's tool last wins. A choice the app makes is applied once; after
|
||||
that the client's own pick stands: a pick of one of our Protons becomes the app's choice too, any
|
||||
other pick (FEX, a Steam Linux Runtime, clearing the forced tool) ends the app's choice. "Use the
|
||||
default" (null, also what a profile reset writes) is applied once and then dropped, so the game
|
||||
follows the default like one the app never touched. Returns the new requests and whether they changed."""
|
||||
recorded = state.get("games_applied")
|
||||
if isinstance(recorded, dict):
|
||||
applied = dict(recorded)
|
||||
else:
|
||||
# Builds before this one kept no record but had already applied every choice they found; a
|
||||
# first start has applied nothing yet.
|
||||
applied = dict(requests) if "tools" in state else {}
|
||||
by_name = {t["name"]: t for t in catalog}
|
||||
out = dict(requests)
|
||||
@@ -1189,9 +1180,6 @@ def settle_game_requests(requests, state, current, catalog, missing_is_cleared=F
|
||||
|
||||
|
||||
def settled_game_requests(state, current, catalog, missing_is_cleared=False, directory=None):
|
||||
"""Reads the app's choices, settles them against the client's picks and stores the result. When the
|
||||
app rewrote the file meanwhile, its newer choices are settled again; they are never overwritten.
|
||||
None when the app kept rewriting it: this pass then applies no per-game choice and records nothing."""
|
||||
for _ in range(2):
|
||||
requests, text = read_game_requests(directory)
|
||||
settled, moved = settle_game_requests(requests, state, current, catalog, missing_is_cleared)
|
||||
@@ -1201,8 +1189,6 @@ def settled_game_requests(state, current, catalog, missing_is_cleared=False, dir
|
||||
|
||||
|
||||
def applied_game_requests(requests, overrides, state):
|
||||
"""What the app asked for that is now in the mapping. A tool not installed yet stays unapplied, and a
|
||||
game this pass did not handle (the client refused to report it) keeps what was applied before."""
|
||||
recorded = state.get("games_applied")
|
||||
before = recorded if isinstance(recorded, dict) else {}
|
||||
if requests is None:
|
||||
@@ -1399,7 +1385,6 @@ def register_default(config_path, apps=(), protect=(), default=None, catalog=Non
|
||||
else:
|
||||
default = state.get("default") if state.get("default") in names else TOOL
|
||||
steam_root = os.path.dirname(os.path.dirname(os.path.abspath(config_path)))
|
||||
# With the client stopped, config.vdf is what it last kept: an app missing from it has no forced tool.
|
||||
requests = settled_game_requests(state, current, catalog, not steam_running(), directory)
|
||||
overrides = requested_games(requests or {}, catalog)
|
||||
managed = state.get("auto", {}).keys() if isinstance(state.get("auto"), dict) else ()
|
||||
|
||||
Reference in new issue
Block a user