mirror of
https://github.com/lutris/lutris
synced 2024-11-02 13:31:16 +00:00
Merge branch 'next'
This commit is contained in:
commit
f6dd0e91c3
5 changed files with 127 additions and 35 deletions
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -1,3 +1,7 @@
|
|||
|
||||
* Added ScummVM options: aspect correction, subtitles
|
||||
* Fixed Wine games install failing when there is a space in the setup file path
|
||||
|
||||
lutris (0.3.5) trusty; urgency=medium
|
||||
|
||||
* All runners now use the version hosted on lutris.net (auto-install!)
|
||||
|
|
|
@ -324,6 +324,8 @@ class ScriptInterpreter(object):
|
|||
def _write_config(self):
|
||||
"""Write the game configuration as a Lutris launcher."""
|
||||
runner_name = self.script['runner']
|
||||
|
||||
# Get existing config
|
||||
config_filename = os.path.join(settings.CONFIG_DIR,
|
||||
"games/%s.yml" % self.game_slug)
|
||||
if self.requires and os.path.exists(config_filename):
|
||||
|
@ -336,11 +338,15 @@ class ScriptInterpreter(object):
|
|||
config = {
|
||||
'game': {},
|
||||
}
|
||||
|
||||
# DB update
|
||||
pga.add_or_update(self.script['name'], runner_name,
|
||||
slug=self.game_slug,
|
||||
directory=self.target_path,
|
||||
installed=1,
|
||||
installer_slug=self.script.get('installer_slug'))
|
||||
|
||||
# Config update
|
||||
if 'system' in self.script:
|
||||
config['system'] = self._substitute_config(self.script['system'])
|
||||
if runner_name in self.script:
|
||||
|
@ -349,8 +355,10 @@ class ScriptInterpreter(object):
|
|||
)
|
||||
if 'game' in self.script:
|
||||
config['game'].update(self._substitute_config(self.script['game']))
|
||||
|
||||
is_64bit = platform.machine() == "x86_64"
|
||||
exe = 'exe64' if 'exe64' in self.script and is_64bit else 'exe'
|
||||
|
||||
for launcher in [exe, 'iso', 'rom', 'disk', 'main_file']:
|
||||
if launcher in self.script:
|
||||
if launcher == "exe64":
|
||||
|
@ -550,7 +558,7 @@ class ScriptInterpreter(object):
|
|||
dest_path = self._substitute(data['dst'])
|
||||
else:
|
||||
dest_path = self.target_path
|
||||
msg = "Extracting %s" % filename
|
||||
msg = "Extracting %s" % os.path.basename(filename)
|
||||
logger.debug(msg)
|
||||
self.parent.set_status(msg)
|
||||
merge_single = 'nomerge' not in data
|
||||
|
|
|
@ -6,11 +6,15 @@ from lutris.util.log import logger
|
|||
from lutris.runners.runner import Runner
|
||||
|
||||
|
||||
def dosexec(config_file):
|
||||
def dosexec(config_file=None, executable=None):
|
||||
"""Execute Dosbox with given config_file"""
|
||||
logger.debug("Running dosbox with config %s" % config_file)
|
||||
dbx = dosbox()
|
||||
command = '"%s" -conf "%s"' % (dbx.get_executable(), config_file)
|
||||
command = '"{}"'.format(dbx.get_executable())
|
||||
if config_file:
|
||||
command += ' -conf "{}"'.format(config_file)
|
||||
if executable:
|
||||
command += ' "{}"'.format(executable)
|
||||
subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).communicate()
|
||||
|
||||
|
||||
|
@ -31,23 +35,79 @@ class dosbox(Runner):
|
|||
}
|
||||
]
|
||||
|
||||
scaler_modes = [
|
||||
("none", "none"),
|
||||
("normal2x", "normal2x"),
|
||||
("normal3x", "normal3x"),
|
||||
("hq2x", "hq2x"),
|
||||
("hq3x", "hq3x"),
|
||||
("advmame2x", "advmame2x"),
|
||||
("advmame3x", "advmame3x"),
|
||||
("2xsai", "2xsai"),
|
||||
("super2xsai", "super2xsai"),
|
||||
("supereagle", "supereagle"),
|
||||
("advinterp2x", "advinterp2x"),
|
||||
("advinterp3x", "advinterp3x"),
|
||||
("tv2x", "tv2x"),
|
||||
("tv3x", "tv3x"),
|
||||
("rgb2x", "rgb2x"),
|
||||
("rgb3x", "rgb3x"),
|
||||
("scan2x", "scan2x"),
|
||||
("scan3x", "scan3x")
|
||||
]
|
||||
runner_options = [
|
||||
{
|
||||
"option": "scaler",
|
||||
"label": "Graphic scaler",
|
||||
"type": "choice",
|
||||
"choices": scaler_modes
|
||||
},
|
||||
{
|
||||
"option": "exit",
|
||||
"label": "Exit Dosbox with the game",
|
||||
"type": "bool",
|
||||
"default": True
|
||||
}
|
||||
]
|
||||
|
||||
tarballs = {
|
||||
"x64": "dosbox-0.74-x86_64.tar.gz",
|
||||
}
|
||||
|
||||
@property
|
||||
def browse_dir(self):
|
||||
"""Return the path to open with the Browse Files action."""
|
||||
return self.working_dir # exe path
|
||||
|
||||
@property
|
||||
def working_dir(self):
|
||||
"""Return the working directory to use when running the game."""
|
||||
return os.path.dirname(self.main_file) \
|
||||
or super(dosbox, self).browse_dir
|
||||
|
||||
def get_executable(self):
|
||||
return os.path.join(settings.RUNNER_DIR, "dosbox/bin/dosbox")
|
||||
|
||||
def play(self):
|
||||
self.exe = self.settings["game"]["main_file"]
|
||||
if not os.path.exists(self.exe):
|
||||
return {'error': "FILE_NOT_FOUND", 'file': self.exe}
|
||||
if self.exe.endswith(".conf"):
|
||||
exe = ["-conf", '"%s"' % self.exe]
|
||||
main_file = self.settings["game"]["main_file"]
|
||||
if not os.path.exists(main_file):
|
||||
return {'error': "FILE_NOT_FOUND", 'file': main_file}
|
||||
|
||||
command = [self.get_executable()]
|
||||
|
||||
if main_file.endswith(".conf"):
|
||||
command.append('-conf "%s"' % main_file)
|
||||
else:
|
||||
exe = ['"%s"' % self.exe]
|
||||
command.append('"%s"' % main_file)
|
||||
# Options
|
||||
if "config_file" in self.settings["game"]:
|
||||
params = ["-conf", '"%s"' % self.settings["game"]["config_file"]]
|
||||
else:
|
||||
params = []
|
||||
return {'command': [self.get_executable()] + params + exe}
|
||||
command.append('-conf "%s"' % self.settings["game"]["config_file"])
|
||||
|
||||
if "scaler" in self.runner_config:
|
||||
command.append("-scaler %s" % self.runner_config['scaler'])
|
||||
|
||||
if self.runner_config.get("exit"):
|
||||
command.append("-exit")
|
||||
# /Options
|
||||
|
||||
return {'command': command}
|
||||
|
|
|
@ -21,32 +21,42 @@ class scummvm(Runner):
|
|||
'option': 'path',
|
||||
'type': 'directory_chooser',
|
||||
'label': "Path for the game"
|
||||
},
|
||||
{
|
||||
"option": "subtitles",
|
||||
"label": "Enable subtitles (if the game has voice)",
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
|
||||
scaler_modes = [
|
||||
("normal", "normal"),
|
||||
("2x", "2x"),
|
||||
("3x", "3x"),
|
||||
("2xsai", "2xsai"),
|
||||
("advmame2x", "advmame2x"),
|
||||
("advmame3x", "advmame3x"),
|
||||
("dotmatrix", "dotmatrix"),
|
||||
("hq2x", "hq2x"),
|
||||
("hq3x", "hq3x"),
|
||||
("normal", "normal"),
|
||||
("advmame2x", "advmame2x"),
|
||||
("advmame3x", "advmame3x"),
|
||||
("2xsai", "2xsai"),
|
||||
("super2xsai", "super2xsai"),
|
||||
("supereagle", "supereagle"),
|
||||
("tv2x", "tv2x")
|
||||
("tv2x", "tv2x"),
|
||||
("dotmatrix", "dotmatrix")
|
||||
]
|
||||
runner_options = [
|
||||
{
|
||||
"option": "windowed",
|
||||
"label": "Windowed",
|
||||
"label": "Windowed mode",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"option": "aspect",
|
||||
"label": "Aspect ratio correction",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"option": "gfx-mode",
|
||||
"label": "Graphics scaler",
|
||||
"label": "Graphic scaler",
|
||||
"type": "choice",
|
||||
"choices": scaler_modes
|
||||
}
|
||||
|
@ -73,13 +83,23 @@ class scummvm(Runner):
|
|||
"--extrapath=\"%s\"" % self.get_scummvm_data_dir(),
|
||||
"--themepath=\"%s\"" % self.get_scummvm_data_dir(),
|
||||
]
|
||||
|
||||
# Options
|
||||
if self.runner_config.get("aspect"):
|
||||
command.append("--aspect-ratio")
|
||||
|
||||
if self.settings['game'].get("subtitles"):
|
||||
command.append("--subtitles")
|
||||
|
||||
if self.runner_config.get("windowed"):
|
||||
command.append("--no-fullscreen")
|
||||
else:
|
||||
command.append("--fullscreen")
|
||||
|
||||
mode = self.runner_config.get("gfx-mode") or "normal"
|
||||
command.append("--gfx-mode=%s" % mode)
|
||||
mode = self.runner_config.get("gfx-mode")
|
||||
if mode:
|
||||
command.append("--gfx-mode=%s" % mode)
|
||||
# /Options
|
||||
|
||||
command.append("--path=\"%s\"" % self.game_path)
|
||||
command.append(self.settings["game"]["game_id"])
|
||||
|
|
|
@ -38,26 +38,26 @@ def create_prefix(prefix, wine_path='wineboot', arch='win32'):
|
|||
|
||||
def wineexec(executable, args="", prefix=None, wine_path=None, arch=None,
|
||||
working_dir=None):
|
||||
executable = str(executable) if executable else ''
|
||||
prefix = 'WINEPREFIX="%s" ' % prefix if prefix else ''
|
||||
if arch not in ('win32', 'win64'):
|
||||
arch = detect_prefix_arch(prefix)
|
||||
if not wine_path:
|
||||
wine_runner = wine()
|
||||
wine_path = wine_runner.get_executable()
|
||||
if not prefix:
|
||||
prefix = ""
|
||||
else:
|
||||
prefix = 'WINEPREFIX="%s" ' % prefix
|
||||
|
||||
wine_path = wine().get_executable()
|
||||
if not working_dir:
|
||||
if '/' in executable:
|
||||
if os.path.isfile(executable):
|
||||
working_dir = os.path.dirname(executable)
|
||||
|
||||
executable = str(executable) if executable else ""
|
||||
if " " in executable:
|
||||
if 'winetricks' == wine_path:
|
||||
winetricks_env = 'WINE="%s"' % wine().get_executable()
|
||||
else:
|
||||
winetricks_env = ''
|
||||
|
||||
if executable:
|
||||
executable = '"%s"' % executable
|
||||
|
||||
command = 'WINEARCH=%s %s "%s" %s %s' % (
|
||||
arch, prefix, wine_path, executable, args
|
||||
command = '%s WINEARCH=%s %s "%s" %s %s' % (
|
||||
winetricks_env, arch, prefix, wine_path, executable, args
|
||||
)
|
||||
logger.debug("START wineexec(%s)", command)
|
||||
subprocess.Popen(command, cwd=working_dir, shell=True,
|
||||
|
|
Loading…
Reference in a new issue