mirror of
https://github.com/lutris/lutris
synced 2024-09-15 22:09:55 +00:00
Add Flatpak support to most Python based runners
This commit is contained in:
parent
7477c3a2e5
commit
2290d2a427
|
@ -12,6 +12,7 @@ class cemu(Runner):
|
|||
description = _("Wii U emulator")
|
||||
runnable_alone = True
|
||||
runner_executable = "cemu/cemu"
|
||||
flatpak_id = "info.cemu.Cemu"
|
||||
game_options = [
|
||||
{
|
||||
"option": "main_file",
|
||||
|
@ -55,7 +56,7 @@ class cemu(Runner):
|
|||
|
||||
def play(self):
|
||||
"""Run the game."""
|
||||
arguments = [self.get_executable()]
|
||||
arguments = self.get_command()
|
||||
|
||||
fullscreen = self.runner_config.get("fullscreen")
|
||||
if fullscreen:
|
||||
|
|
|
@ -15,6 +15,7 @@ class dolphin(Runner):
|
|||
require_libs = ["libOpenGL.so.0", ]
|
||||
runnable_alone = True
|
||||
runner_executable = "dolphin/dolphin-emu"
|
||||
flatpak_id = "org.DolphinEmu.dolphin-emu"
|
||||
game_options = [
|
||||
{
|
||||
"option": "main_file",
|
||||
|
@ -30,13 +31,6 @@ class dolphin(Runner):
|
|||
},
|
||||
]
|
||||
runner_options = [
|
||||
{
|
||||
"option": "nogui",
|
||||
"type": "bool",
|
||||
"label": _("No GUI"),
|
||||
"default": False,
|
||||
"help": _("Disable the graphical user interface."),
|
||||
},
|
||||
{
|
||||
"option": "batch",
|
||||
"type": "bool",
|
||||
|
@ -60,11 +54,7 @@ class dolphin(Runner):
|
|||
return ""
|
||||
|
||||
def play(self):
|
||||
# Find the executable
|
||||
executable = self.get_executable()
|
||||
if self.runner_config.get("nogui"):
|
||||
executable += "-nogui"
|
||||
command = [executable]
|
||||
command = self.get_command()
|
||||
|
||||
# Batch isn't available in nogui
|
||||
if self.runner_config.get("batch") and not self.runner_config.get("nogui"):
|
||||
|
|
|
@ -16,7 +16,7 @@ class dosbox(Runner):
|
|||
platforms = [_("MS-DOS")]
|
||||
runnable_alone = True
|
||||
runner_executable = "dosbox/dosbox"
|
||||
require_libs = []
|
||||
flatpak_id = "io.github.dosbox-staging"
|
||||
game_options = [
|
||||
{
|
||||
"option": "main_file",
|
||||
|
@ -126,11 +126,6 @@ class dosbox(Runner):
|
|||
path = os.path.join(settings.RUNNER_DIR, "dosbox/lib")
|
||||
return path if system.path_exists(path) else ""
|
||||
|
||||
def get_command(self):
|
||||
return [
|
||||
self.get_executable(),
|
||||
]
|
||||
|
||||
def get_run_data(self):
|
||||
env = self.get_env()
|
||||
env["LD_LIBRARY_PATH"] = os.pathsep.join(filter(None, [
|
||||
|
@ -154,7 +149,7 @@ class dosbox(Runner):
|
|||
return {"error": "FILE_NOT_FOUND", "file": main_file}
|
||||
args = shlex.split(self.game_config.get("args") or "")
|
||||
|
||||
command = [self.get_executable()]
|
||||
command = self.get_command()
|
||||
|
||||
if main_file.endswith(".conf"):
|
||||
command.append("-conf")
|
||||
|
|
|
@ -124,6 +124,7 @@ def scan_dir_for_bios(path):
|
|||
class fsuae(Runner):
|
||||
human_name = _("FS-UAE")
|
||||
description = _("Amiga emulator")
|
||||
flatpak_id = "net.fsuae.FS-UAE"
|
||||
platforms = [
|
||||
AMIGAS["A500"]["name"],
|
||||
AMIGAS["A500+"]["name"],
|
||||
|
@ -497,4 +498,4 @@ class fsuae(Runner):
|
|||
return params
|
||||
|
||||
def play(self):
|
||||
return {"command": [self.get_executable()] + self.get_params() + self.insert_floppies()}
|
||||
return {"command": self.get_command() + self.get_params() + self.insert_floppies()}
|
||||
|
|
|
@ -14,6 +14,7 @@ class hatari(Runner):
|
|||
description = _("Atari ST computers emulator")
|
||||
platforms = [_("Atari ST")]
|
||||
runnable_alone = True
|
||||
flatpak_id = "org.tuxfamily.hatari"
|
||||
runner_executable = "hatari/bin/hatari"
|
||||
entry_point_option = "disk-a"
|
||||
|
||||
|
@ -138,7 +139,7 @@ class hatari(Runner):
|
|||
super().install(install_ui_delegate, version=version, callback=on_runner_installed)
|
||||
|
||||
def play(self): # pylint: disable=too-many-branches
|
||||
params = [self.get_executable()]
|
||||
params = self.get_command()
|
||||
if self.runner_config.get("fullscreen"):
|
||||
params.append("--fullscreen")
|
||||
else:
|
||||
|
|
|
@ -69,6 +69,7 @@ class libretro(Runner):
|
|||
description = _("Multi-system emulator")
|
||||
runnable_alone = True
|
||||
runner_executable = "retroarch/retroarch"
|
||||
flatpak_id = "org.libretro.RetroArch"
|
||||
|
||||
game_options = [
|
||||
{
|
||||
|
@ -133,8 +134,6 @@ class libretro(Runner):
|
|||
def get_version(self, use_default=True):
|
||||
return self.game_config["core"]
|
||||
|
||||
def is_retroarch_installed(self):
|
||||
return system.path_exists(self.get_executable())
|
||||
|
||||
def is_installed(self, core=None):
|
||||
if not core and self.has_explicit_config and self.game_config.get("core"):
|
||||
|
@ -142,7 +141,7 @@ class libretro(Runner):
|
|||
if not core or self.runner_config.get("runner_executable"):
|
||||
return self.is_retroarch_installed()
|
||||
is_core_installed = system.path_exists(self.get_core_path(core))
|
||||
return self.is_retroarch_installed() and is_core_installed
|
||||
return super().is_installer() and is_core_installed
|
||||
|
||||
def install(self, install_ui_delegate, version=None, callback=None):
|
||||
captured_super = super() # super() does not work inside install_core()
|
||||
|
@ -161,7 +160,7 @@ class libretro(Runner):
|
|||
|
||||
def get_run_data(self):
|
||||
return {
|
||||
"command": [self.get_executable()] + self.get_runner_parameters(),
|
||||
"command": self.get_command() + self.get_runner_parameters(),
|
||||
"env": self.get_env(),
|
||||
}
|
||||
|
||||
|
@ -262,9 +261,7 @@ class libretro(Runner):
|
|||
return parameters
|
||||
|
||||
def play(self):
|
||||
command = [self.get_executable()]
|
||||
|
||||
command += self.get_runner_parameters()
|
||||
command = self.get_command() + self.get_runner_parameters()
|
||||
|
||||
# Core
|
||||
core = self.game_config.get("core")
|
||||
|
|
|
@ -65,6 +65,7 @@ class mame(Runner): # pylint: disable=invalid-name
|
|||
human_name = _("MAME")
|
||||
description = _("Arcade game emulator")
|
||||
runner_executable = "mame/mame"
|
||||
flatpak_id = "org.mamedev.MAME"
|
||||
runnable_alone = True
|
||||
config_dir = os.path.expanduser("~/.mame")
|
||||
cache_dir = os.path.join(settings.CACHE_DIR, "mame")
|
||||
|
@ -248,7 +249,7 @@ class mame(Runner): # pylint: disable=invalid-name
|
|||
"""Write the full game list in XML to disk"""
|
||||
os.makedirs(self.cache_dir, exist_ok=True)
|
||||
output = system.execute(
|
||||
[self.get_executable(), "-listxml"],
|
||||
self.get_command() + ["-listxml"],
|
||||
env=runtime.get_env()
|
||||
)
|
||||
if output:
|
||||
|
@ -277,7 +278,7 @@ class mame(Runner): # pylint: disable=invalid-name
|
|||
except OSError:
|
||||
pass
|
||||
system.execute(
|
||||
[self.get_executable(), "-createconfig", "-inipath", self.config_dir],
|
||||
self.get_command() + ["-createconfig", "-inipath", self.config_dir],
|
||||
env=runtime.get_env(),
|
||||
cwd=self.working_dir
|
||||
)
|
||||
|
@ -295,7 +296,7 @@ class mame(Runner): # pylint: disable=invalid-name
|
|||
return params
|
||||
|
||||
def play(self):
|
||||
command = [self.get_executable(), "-skip_gameinfo", "-inipath", self.config_dir]
|
||||
command = self.get_command() + ["-skip_gameinfo", "-inipath", self.config_dir]
|
||||
if self.runner_config.get("video"):
|
||||
command += ["-video", self.runner_config["video"]]
|
||||
if not self.runner_config.get("fullscreen"):
|
||||
|
|
|
@ -13,6 +13,7 @@ class mupen64plus(Runner):
|
|||
description = _("Nintendo 64 emulator")
|
||||
platforms = [_("Nintendo 64")]
|
||||
runner_executable = "mupen64plus/mupen64plus"
|
||||
flatpak_id = "com.github.Rosalie241.RMG"
|
||||
game_options = [
|
||||
{
|
||||
"option": "main_file",
|
||||
|
|
|
@ -10,6 +10,7 @@ class openmsx(Runner):
|
|||
human_name = _("openMSX")
|
||||
description = _("MSX computer emulator")
|
||||
platforms = [_("MSX, MSX2, MSX2+, MSX turboR")]
|
||||
flatpak_id = "org.openmsx.openMSX"
|
||||
game_options = [
|
||||
{
|
||||
"option": "main_file",
|
||||
|
@ -23,4 +24,4 @@ class openmsx(Runner):
|
|||
rom = self.game_config.get("main_file") or ""
|
||||
if not system.path_exists(rom):
|
||||
return {"error": "FILE_NOT_FOUND", "file": rom}
|
||||
return {"command": [self.get_executable(), rom]}
|
||||
return {"command": self.get_command() + [rom]}
|
||||
|
|
|
@ -12,6 +12,7 @@ class pcsx2(Runner):
|
|||
platforms = [_("Sony PlayStation 2")]
|
||||
runnable_alone = True
|
||||
runner_executable = "pcsx2/PCSX2"
|
||||
flatpak_id = "net.pcsx2.PCSX2"
|
||||
game_options = [{
|
||||
"option": "main_file",
|
||||
"type": "file",
|
||||
|
@ -44,7 +45,7 @@ class pcsx2(Runner):
|
|||
system_options_override = [{"option": "disable_runtime", "default": True}]
|
||||
|
||||
def play(self):
|
||||
arguments = [self.get_executable()]
|
||||
arguments = self.get_command()
|
||||
|
||||
if self.runner_config.get("fullscreen"):
|
||||
arguments.append("-fullscreen")
|
||||
|
|
|
@ -18,7 +18,7 @@ class reicast(Runner):
|
|||
platforms = [_("Sega Dreamcast")]
|
||||
runner_executable = "reicast/reicast.elf"
|
||||
entry_point_option = "iso"
|
||||
|
||||
flatpak_id = "org.flycast.Flycast"
|
||||
joypads = None
|
||||
|
||||
game_options = [
|
||||
|
@ -159,5 +159,6 @@ class reicast(Runner):
|
|||
self.write_config(reicast_config)
|
||||
|
||||
iso = self.game_config.get("iso")
|
||||
command = [self.get_executable(), "-config", "config:image={}".format(iso)]
|
||||
return {"command": command}
|
||||
return {
|
||||
"command": self.get_command() + ["-config", f"config:image={iso}"]
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ class rpcs3(Runner):
|
|||
platforms = [_("Sony PlayStation 3")]
|
||||
runnable_alone = True
|
||||
runner_executable = "rpcs3/rpcs3"
|
||||
flatpak_id = "net.rpcs3.RPCS3"
|
||||
game_options = [
|
||||
{
|
||||
"option": "main_file",
|
||||
|
@ -26,7 +27,7 @@ class rpcs3(Runner):
|
|||
system_options_override = [{"option": "disable_runtime", "default": True}]
|
||||
|
||||
def play(self):
|
||||
arguments = [self.get_executable()]
|
||||
arguments = self.get_command()
|
||||
|
||||
if self.runner_config.get("nogui"):
|
||||
arguments.append("--no-gui")
|
||||
|
|
|
@ -14,6 +14,7 @@ class ryujinx(Runner):
|
|||
description = _("Nintendo Switch emulator")
|
||||
runnable_alone = True
|
||||
runner_executable = "ryujinx/publish/Ryujinx"
|
||||
flatpak_id = "org.ryujinx.Ryujinx"
|
||||
download_url = "https://lutris.nyc3.digitaloceanspaces.com/runners/ryujinx/ryujinx-1.0.7074-linux_x64.tar.gz"
|
||||
|
||||
game_options = [
|
||||
|
@ -49,7 +50,7 @@ class ryujinx(Runner):
|
|||
|
||||
def play(self):
|
||||
"""Run the game."""
|
||||
arguments = [self.get_executable()]
|
||||
arguments = self.get_command()
|
||||
rom = self.game_config.get("main_file") or ""
|
||||
if not system.path_exists(rom):
|
||||
return {"error": "FILE_NOT_FOUND", "file": rom}
|
||||
|
|
|
@ -49,6 +49,7 @@ class scummvm(Runner):
|
|||
platforms = [_("Linux")]
|
||||
runnable_alone = True
|
||||
runner_executable = "scummvm/bin/scummvm"
|
||||
# flatpak_id = "org.scummvm.ScummVM" # needs some adjustments + testing
|
||||
game_options = [
|
||||
{
|
||||
"option": "game_id",
|
||||
|
|
|
@ -12,6 +12,7 @@ from lutris.util.log import logger
|
|||
class vice(Runner):
|
||||
description = _("Commodore Emulator")
|
||||
human_name = _("Vice")
|
||||
# flatpak_id = "net.sf.VICE" # needs adjustments
|
||||
platforms = [
|
||||
_("Commodore 64"),
|
||||
_("Commodore 128"),
|
||||
|
|
|
@ -10,6 +10,7 @@ class xemu(Runner):
|
|||
description = _("Xbox emulator")
|
||||
runnable_alone = True
|
||||
runner_executable = "xemu/xemu"
|
||||
flatpak_id = "app.xemu.xemu"
|
||||
game_options = [
|
||||
{
|
||||
"option": "main_file",
|
||||
|
@ -29,7 +30,7 @@ class xemu(Runner):
|
|||
|
||||
def play(self):
|
||||
"""Run the game."""
|
||||
arguments = [self.get_executable()]
|
||||
arguments = self.get_command()
|
||||
|
||||
fullscreen = self.runner_config.get("fullscreen")
|
||||
if fullscreen:
|
||||
|
|
|
@ -14,6 +14,7 @@ class yuzu(Runner):
|
|||
description = _("Nintendo Switch emulator")
|
||||
runnable_alone = True
|
||||
runner_executable = "yuzu/yuzu"
|
||||
flatpak_id = "org.yuzu_emu.yuzu"
|
||||
game_options = [
|
||||
{
|
||||
"option": "main_file",
|
||||
|
@ -52,7 +53,7 @@ class yuzu(Runner):
|
|||
|
||||
def play(self):
|
||||
"""Run the game."""
|
||||
arguments = [self.get_executable()]
|
||||
arguments = self.get_command()
|
||||
|
||||
fullscreen = self.runner_config.get("fullscreen")
|
||||
if fullscreen:
|
||||
|
|
|
@ -13,7 +13,8 @@ class zdoom(Runner):
|
|||
description = _("ZDoom DOOM Game Engine")
|
||||
human_name = _("ZDoom")
|
||||
platforms = [_("Linux")]
|
||||
runner_executable = "zdoom/zdoom"
|
||||
runner_executable = "zdoom/gzdoom"
|
||||
flatpak_id = "org.zdoom.GZDoom"
|
||||
game_options = [
|
||||
{
|
||||
"option": "main_file",
|
||||
|
@ -94,17 +95,6 @@ class zdoom(Runner):
|
|||
},
|
||||
]
|
||||
|
||||
def get_executable(self):
|
||||
executable = super().get_executable()
|
||||
executable_dir = os.path.dirname(executable)
|
||||
if not system.path_exists(executable_dir):
|
||||
return executable
|
||||
if not system.path_exists(executable):
|
||||
gzdoom_executable = os.path.join(executable_dir, "gzdoom")
|
||||
if system.path_exists(gzdoom_executable):
|
||||
return gzdoom_executable
|
||||
return executable
|
||||
|
||||
def prelaunch(self):
|
||||
if not LINUX_SYSTEM.get_soundfonts():
|
||||
logger.warning("FluidSynth is not installed, you might not have any music")
|
||||
|
@ -119,7 +109,7 @@ class zdoom(Runner):
|
|||
return os.path.dirname(os.path.expanduser(wad_files[0]))
|
||||
|
||||
def play(self): # noqa: C901
|
||||
command = [self.get_executable()]
|
||||
command = self.get_command()
|
||||
|
||||
resolution = self.runner_config.get("resolution")
|
||||
if resolution:
|
||||
|
|
Loading…
Reference in a new issue