From 124a884e1b582ccac62255aaedd6911a99c7344e Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Wed, 23 Apr 2025 18:35:30 +0200 Subject: [PATCH] custom wine: also share library --- gamiki/support/commands.py | 5 +++-- gamiki/support/custom_commands.py | 12 +++++++----- gamiki/support/support_win.py | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gamiki/support/commands.py b/gamiki/support/commands.py index eb3b600..edf0f74 100644 --- a/gamiki/support/commands.py +++ b/gamiki/support/commands.py @@ -37,12 +37,13 @@ def dosbox(dir: PurePath, link: PurePath, opt: str = None) -> int: return run(cmd, cwd=dir, env=env).returncode -def wine(dir: PurePath) -> int: +def wine(dir: PurePath, link: PurePath, opt: str = None) -> int: + # TODO: wine-{opt}.bat wine_bat = dir.joinpath("wine.bat") wine_prefix = dir.joinpath("wine.prefix") - cmd, env = custom.cmd("wine", wine_bat, wine_prefix) + cmd, env = custom.cmd("wine", wine_bat, link, wine_prefix) if (not cmd): prog = custom.program("wine") if (prog): diff --git a/gamiki/support/custom_commands.py b/gamiki/support/custom_commands.py index bbfd764..c4a9916 100644 --- a/gamiki/support/custom_commands.py +++ b/gamiki/support/custom_commands.py @@ -13,7 +13,7 @@ def program(program: str) -> str: return __programs__[program] -def cmd(prog: str, p1: PurePath, p2: PurePath) -> (list, dict): +def cmd(prog:str, t:PurePath, lnk:PurePath, pre:PurePath=None) -> (list, dict): cmd = None env = environ.copy() @@ -21,13 +21,15 @@ def cmd(prog: str, p1: PurePath, p2: PurePath) -> (list, dict): if (prog == "dosbox"): if (program("app.sh")): cmd = [ - program("app.sh"),"--wait","dosbox","--link",p1.as_posix() + program("app.sh"),"--wait", "dosbox", "--link", t.as_posix() ] elif (prog == "wine"): if (program("launch.sh")): - cmd = [ program("launch.sh"), "wine", "--dlink", p1.as_posix() ] - env["OPTS"] = ( - "-e WINEPREFIX='" + p2.as_posix().replace("'", "\\'") + "'" + cmd = [ program("launch.sh"), "wine", "--dlink", t.as_posix() ] + lnk_path = lnk.as_posix().replace("'", "\\'") + env["OPTS"] = ( "" + + "-e WINEPREFIX='" + pre.as_posix().replace("'", "\\'") + "'" + + " -v '" + lnk_path + ":" + lnk_path + "'" ) elif (prog == "start_sh"): if (program("launch.sh")): diff --git a/gamiki/support/support_win.py b/gamiki/support/support_win.py index 151ddfb..6446c95 100644 --- a/gamiki/support/support_win.py +++ b/gamiki/support/support_win.py @@ -15,7 +15,7 @@ class SupportWin(Support): raise RuntimeError("Windows game without a wine.prefix") self._running(game) - rep = wine(dir) + rep = wine(dir, game.library.dir.resolve(), opt) if (rep != 0): self._error(game, rep) -- 2.27.0