custom wine: also share library
authorNiki Roo <niki@nikiroo.be>
Wed, 23 Apr 2025 16:35:30 +0000 (18:35 +0200)
committerNiki Roo <niki@nikiroo.be>
Wed, 23 Apr 2025 16:35:30 +0000 (18:35 +0200)
gamiki/support/commands.py
gamiki/support/custom_commands.py
gamiki/support/support_win.py

index eb3b600e9dac34f0c501c36be0d967abcdf71dc0..edf0f74816c7437aead5702cef34bc7a6f5833ed 100644 (file)
@@ -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):
index bbfd764dffeef66ae69406c622f182af20ed21da..c4a9916929005b41e9e2f4b68e2050b9bec2aa23 100644 (file)
@@ -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")):
index 151ddfb5137e92045196ca20f057ed5f6edeb4b0..6446c95e712f1f81294f3069af82eef2a6a4b061 100644 (file)
@@ -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)