fix(desktop): run a store game's exe through its launcher so the EA environment and Origin process are set up (#2486)

* fix(desktop): run a store game's exe through its launcher so the EA environment and Origin process are set up

* fix(desktop): keep a store game's prefix and resolve its launcher through symlinks and deep folders

* fix(desktop): keep the exe's resolved compatdata folder when running its launcher and find the sidecar beside a symlinked exe
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-11 20:55:37 -05:00
1 parent 2953739f1e
commit 8961d088f2
5 files changed
+130 -7

No files matched your search

@@ -17,6 +17,7 @@ PROTON_RUN = os.path.join(BIN, "droiddeck-proton-run")
APPIMAGE_RUN = os.path.join(BIN, "droiddeck-appimage-run")
SCRIPT_RUN = os.path.join(BIN, "droiddeck-script-run")
STEAM_LAUNCH = os.path.join(BIN, "droiddeck-steam-launch")
STORE_LAUNCH = os.path.join(BIN, "droiddeck-store-launch")
PROGRAMS = os.path.join(BIN, "droiddeck-desktop-programs")
CACHE = os.path.join(HOME, ".cache", "droiddeck")
IMPORTS = {"appimage": ("/opt/appimages/user", "app"), "folder": ("/opt/droiddeck-apps", "entry")}
@@ -272,12 +273,32 @@ def steam_title(path):
return None
def exe_prefix(path):
try:
run = runpy.run_path(PROTON_RUN)
root = os.environ.get("STEAM_COMPAT_CLIENT_INSTALL_PATH") or run["STEAM_ROOT"]
target = run["locate"](path, root)
return ["--prefix", target.appid, "--compatdata", target.compatdata]
except (OSError, ValueError, KeyError, IndexError):
return None
def store_launcher(path):
try:
return runpy.run_path(STORE_LAUNCH)["store_launcher"](path)
except (OSError, ValueError, KeyError):
return None
def command(path, args, what, window=False, appid=None):
folder = os.path.dirname(path)
if what == "steam":
return [STEAM_LAUNCH, "desktop", appid], folder
if what == "windows":
return [PROTON_RUN] + (["--window"] if window else []) + [path] + args, folder
launcher = None if args else store_launcher(path)
prefix = exe_prefix(path) if launcher else None
keep = prefix or []
return [PROTON_RUN] + (["--window"] if window else []) + keep + [launcher or path] + args, folder
if what == "x86 script":
return [FEX, "run", "--mode", "on", "--for", folder, "--"] + interpreter(path) + [path] + args, folder
if what == "script":
@@ -315,8 +315,8 @@ def locate(program, root):
os.path.dirname(program), root, "own")
def fixed(program, root, appid):
return Target(appid, os.path.join(root, "steamapps", "compatdata", str(appid)),
def fixed(program, root, appid, compatdata=None):
return Target(appid, compatdata or os.path.join(root, "steamapps", "compatdata", str(appid)),
os.path.dirname(program), root, "fixed")
@@ -451,6 +451,7 @@ def arguments(program, args, desktop=None, compatdata=None):
def main(argv):
window = False
prefix = None
compatdata = None
verb = VERB
game_id = None
desktop = None
@@ -461,6 +462,8 @@ def main(argv):
window = True
elif option == "--prefix" and argv and prefix_id(argv[0]):
prefix = argv.pop(0)
elif option == "--compatdata" and argv and os.path.isabs(argv[0]):
compatdata = argv.pop(0)
elif option == "--verb" and argv and argv[0] in VERBS:
verb = argv.pop(0)
elif option == "--game-id" and argv and argv[0].isdigit() and argv[0] != "0":
@@ -484,7 +487,7 @@ def main(argv):
say("%s is not an app id" % app)
return 2
if not argv and app is None:
say("usage: droiddeck-proton-run [--window] [--prefix ID] [--verb run] [--game-id ID] [--desktop WxH] PROGRAM [ARGS...]")
say("usage: droiddeck-proton-run [--window] [--prefix ID [--compatdata DIR]] [--verb run] [--game-id ID] [--desktop WxH] PROGRAM [ARGS...]")
return 2
root = os.environ.get("STEAM_COMPAT_CLIENT_INSTALL_PATH") or STEAM_ROOT
if options is None:
@@ -509,7 +512,7 @@ def main(argv):
if app is not None and int(app) >= STEAM_APP_LIMIT:
target = shortcut_target(app, program, start, root)
elif prefix:
target = fixed(program, root, prefix)
target = fixed(program, root, prefix, compatdata)
else:
target = locate(program, root)
available = tools(root)
@@ -48,14 +48,14 @@ def sidecar_at(folder):
return sidecar
def find_store_game(argv):
def find_store_game(argv, depth=MAX_DEPTH):
for raw in argv:
arg = raw.strip().strip('"').strip("'").replace("\\", "/")
low = arg.lower()
if not (low.endswith(LAUNCHER) or low.endswith(".exe") or low.endswith(".bat")) or "/" not in arg:
continue
folder = Path(arg).parent
for _ in range(MAX_DEPTH):
for _ in range(depth):
sidecar = sidecar_at(folder)
if sidecar is not None:
return folder, sidecar
@@ -65,6 +65,21 @@ def find_store_game(argv):
return None
def store_launcher(path):
real = os.path.realpath(path)
for start in dict.fromkeys([os.path.abspath(path), real]):
found = find_store_game([start], depth=len(Path(start).parts))
if found is None:
continue
folder, sidecar = found
launcher, exe = str(sidecar.get("launcher") or ""), str(sidecar.get("exe") or "")
if not launcher or not exe or (folder / launcher).is_symlink() or not (folder / launcher).is_file():
continue
if os.path.realpath(folder / exe).lower() == real.lower():
return str(folder / launcher)
return None
def drop_stale(folder, now=None):
code = folder / EPIC_CODE
try: