Coverage for lutris.runners.wine : 36%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"""Plays with the windows registry
path is something like HKEY_CURRENT_USER\Software\Wine\Direct3D """
logger.debug("Setting wine registry key : %s\\%s to %s", path, key, value) reg_path = os.path.join(CACHE_DIR, 'winekeys.reg') #Make temporary reg file reg_file = open(reg_path, "w") reg_file.write("""REGEDIT4
[%s] "%s"="%s"
""" % (path, key, value)) reg_file.close() wineexec('regedit', args=reg_path, prefix=prefix, arch=arch) os.remove(reg_path)
"""Create a new wineprefix""" wineexec('', prefix=prefix, wine_path='wineboot', arch=arch)
prefix = "" else: prefix = "WINEPREFIX=\"%s\" " % prefix executable = str(executable) if executable else "" if " " in executable: executable = "\"%s\"" % executable if arch not in ('win32', 'win64'): raise ValueError("Invalid WINEARCH %s" % arch) arch, prefix, wine_path, executable, args ) logger.debug("Running wine command: %s", command) subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).communicate()
if str(silent).lower() in ('yes', 'on', 'true'): args = "-q " + app else: args = app
# pylint: disable=C0103 '''Run Windows games with Wine''' { 'option': 'exe', 'type': 'file', 'label': 'Executable' }, { 'option': 'args', 'type': 'string', 'label': 'Arguments' }, { 'option': 'prefix', 'type': 'directory_chooser', 'label': 'Prefix' }, { 'option': 'arch', 'type': 'choice', 'label': 'Architecture', 'choices': [ ('32 bit', 'win32'), ('64 bit', 'win64') ], 'default': 'win32' } ]
('FBO', 'fbo'), ('PBuffer', 'pbuffer')] ('Disabled', 'disabled'), ('ReadDraw', 'readdraw'), ('ReadTex', 'readtex'), ('TexDraw', 'texdraw'), ('TexTex', 'textex')] ('OSS', 'oss'), ('Jack', 'jack')] ('No', 'None')] { 'option': 'wine_path', 'label': "Path to Wine executable", 'type': 'file' }, { 'option': 'cdrom_path', 'label': 'CDRom mount point', 'type': 'directory_chooser' }, { 'option': 'MouseWarpOverride', 'label': 'Mouse Warp Override', 'type': 'one_choice', 'choices': [ ('Disable', 'disable'), ('Enable', 'enable'), ('Force', 'force') ] }, { 'option': 'Multisampling', 'label': 'Multisampling', 'type': 'one_choice', 'choices': [ ('Enabled', 'enabled'), ('Disabled', 'disabled') ] }, { 'option': 'OffscreenRenderingMode', 'label': 'Offscreen Rendering Mode', 'type': 'one_choice', 'choices': orm_choices }, { 'option': 'RenderTargetLockMode', 'label': 'Render Target Lock Mode', 'type': 'one_choice', 'choices': rtlm_choices }, { 'option': 'Audio', 'label': 'Audio driver', 'type': 'one_choice', 'choices': audio_choices }, { 'option': 'Desktop', 'label': 'Virtual desktop', 'type': 'one_choice', 'choices': desktop_choices } ] "RenderTargetLockMode": r"%s\Direct3D" % reg_prefix, "Audio": r"%s\Drivers" % reg_prefix, "MouseWarpOverride": r"%s\DirectInput" % reg_prefix, "Multisampling": r"%s\Direct3D" % reg_prefix, "OffscreenRenderingMode": r"%s\Direct3D" % reg_prefix, "DirectDrawRenderer": r"%s\Direct3D" % reg_prefix, "Version": r"%s" % reg_prefix, "Desktop": r"%s\Explorer" % reg_prefix }
"""Return the installer command, either from an exe or an iso""" if exe: command = "%s %s" % (self.executable, exe) else: return False return command
runner_name = self.__class__.__name__ if self.settings: runner_config = self.settings.config.get(runner_name) if runner_config: return self.executable
msi_args = ["msiexec", "/i", msi_file] if quiet: return wineexec(msi_args, prefix=prefix)
"""Resets regedit keys according to config""" for key in self.reg_keys.keys(): if key in wine_config: set_regedit(self.reg_keys[key], key, wine_config[key])
if self.__class__.__name__ in self.settings.config: wine_config = self.settings.config[self.__class__.__name__] else: wine_config = {} self.check_regedit_keys(wine_config)
game_exe = self.settings['game'].get('exe') arguments = self.settings['game'].get('args', "") self.prepare_launch() arch = self.settings['game'].get('arch', 'win32') command = ['WINEARCH=%s' % arch] prefix = self.settings['game'].get('prefix', "") if os.path.exists(prefix): command.append("WINEPREFIX=\"%s\" " % prefix)
self.game_path = os.path.dirname(game_exe) game_exe = os.path.basename(game_exe) if not os.path.exists(self.game_path): if prefix: self.game_path = os.path.join(prefix, self.game_path) if not os.path.exists(self.game_path): return {"error": "FILE_NOT_FOUND", "file": self.game_path}
command.append(self.get_wine_path()) command.append("\"" + game_exe + "\"") if arguments: for arg in arguments.split(): command.append(arg) return {'command': command}
"""The kill command runs wineserver -k""" wine_path = self.get_wine_path() wine_root = os.path.dirname(wine_path) wineserver = os.path.join(wine_root, wine_root) logger.debug("Killing wineserver") os.popen(wineserver + " -k") |