from .support_gog import SupportGog
from .support_ext import SupportExt
from .support_win import SupportWin
+from .support_qemu import SupportQemu
Support.all = [ SupportGog() , # gaminfo
SupportWin() , # wine.bat
SupportWin31(), # start.conf + C/WINDOWS
SupportDos() , # start.conf + no C/WINDOWS
+ SupportQemu() , # qemu.config + disk
SupportExt() # start.sh
]
return run(cmd, cwd=dir, env=env).returncode
+def qemu(dir: PurePath, link: PurePath, opt: str = None) -> int:
+
+ cmd, env = custom.cmd("qemu", link, None)
+ if (not cmd):
+ prog = custom.program("qemu")
+ if (prog):
+ cmd = [ prog ]
+ else:
+ raise RuntimeError("qemu not found")
+
+ if (opt):
+ start = dir.joinpath(f"qemu-{opt}.config")
+ else:
+ start = dir.joinpath("qemu.config")
+
+ if (not start.exists()):
+ return 404;
+
+ # TODO: port qemu.sh in python and use it here
+ cmd = [ "qemu.sh" ];
+ cmd.append(start.as_posix())
+
+ return run(cmd, cwd=dir, env=env).returncode
+
def start_sh(start: PurePath) -> int:
cmd, env = custom.cmd("start_sh", start, None)
+ "-e WINEPREFIX='" + pre.as_posix().replace("'", "\\'") + "'"
+ " -v '" + lnk_path + ":" + lnk_path + "'"
)
+ elif (prog == "qemu"):
+ if (program("app.sh")):
+ cmd = [
+ program("app.sh"),"--wait", "qemu"
+ ]
elif (prog == "start_sh"):
if (program("launch.sh")):
cmd = [
def _running(self, game: Game, opt: str = None):
if (opt):
- print("Running", game.name, "(option: " + opt + ")")
+ print("Running", game.name, "(" + game.opts.get(opt) +")")
else:
print("Running", game.name)
--- /dev/null
+from gamiki import Game
+from gamiki.support import Support
+from gamiki.support.commands import qemu
+
+class SupportQemu(Support):
+ """Supports games run under VMs in qEmu."""
+
+ def supports(self, game: Game):
+ return (
+ game.dir.joinpath("qemu.config").exists()
+ and game.dir.joinpath("disk").exists()
+ )
+
+ def _start(self, game: Game, opt: str = None):
+ self._running(game, opt)
+ rep = qemu(game.dir.resolve(), game.library.dir.resolve(), opt)
+ if (rep != 0):
+ self._error(game, rep)
+