def get_resolutions(): try: screen_resolutions = [(resolution, resolution) for resolution in display.get_resolutions()] except OSError: screen_resolutions = [] screen_resolutions.insert(0, ("Desktop resolution", "desktop")) return screen_resolutions
def get_resolutions(): try: screen_resolutions = [(resolution, resolution) for resolution in display.get_resolutions()] except OSError: screen_resolutions = [] screen_resolutions.insert(0, ('Desktop resolution', 'desktop')) return screen_resolutions
class atari800(Runner): """ Runs Atari800 games """ human_name = "Atari800" package = "atari800" executable = "atari800" platform = "Atari 8bit computers" bios_url = ( "http://kent.dl.sourceforge.net/project/atari800/" "ROM/Original%20XL%20ROM/xf25.zip" ) description = "Atari 400,800 and XL emulator." bios_checksums = { "xlxe_rom": "06daac977823773a3eea3422fd26a703", "basic_rom": "0bac0c6a50104045d902df4503a4c30b", "osa_rom": "", "osb_rom": "a3e8d617c95d08031fe1b20d541434b2", "5200_rom": "" } game_options = [ { "option": "main_file", "type": "file", "label": "ROM file", 'help': ("The game data, commonly called a ROM image. \n" "Supported rom formats: ATR, XFD, DCM, ATR.GZ, XFD.GZ " "and PRO.") } ] try: screen_resolutions = [(resolution, resolution) for resolution in get_resolutions()] except OSError: screen_resolutions = [] runner_options = [ { "option": "bios_path", "type": "directory_chooser", "label": "Bios location", 'help': ("A folder containing the Atari 800 bios files.\n" "They are provided by Lutris so you shouldn't have to " "change this.") }, { "option": "machine", "type": "choice", "choices": ( ("Emulate Atari 800", "atari"), ("Emulate Atari 800 XL", "xl"), ("Emulate Atari 320 XE (Compy Shop)", "320xe"), ("Emulate Atari 320 XE (Rambo)", "rambo"), ("Emulate Atari 5200", "5200") ), "label": "Machine" }, { "option": "fullscreen", "type": "bool", "label": "Fullscreen" }, { "option": "resolution", "type": "choice", "choices": screen_resolutions, "label": "Fullscreen resolution" } ] tarballs = { "x64": "atari800-3.1.0-x86_64.tar.gz", } def install(self): success = super(atari800, self).install() if not success: return False config_path = os.path.expanduser("~/.atari800") if not os.path.exists(config_path): os.makedirs(config_path) bios_archive = os.path.join(config_path, 'atari800-bioses.zip') dlg = DownloadDialog(self.bios_url, bios_archive) dlg.run() if not os.path.exists(bios_archive): ErrorDialog("Could not download Atari800 BIOS archive") return extract_archive(bios_archive, config_path) os.remove(bios_archive) runner_config = LutrisConfig(runner='atari800') runner_config.config_type = 'runner' runner_config.runner_config = {'atari800': {'bios_path': config_path}} runner_config.save() def get_executable(self): return os.path.join(settings.RUNNER_DIR, 'atari800/bin/atari800') def find_good_bioses(self, bios_path): """ Check for correct bios files """ good_bios = {} for filename in os.listdir(bios_path): real_hash = get_md5_hash(os.path.join(bios_path, filename)) for bios_file in self.bios_checksums.keys(): if real_hash == self.bios_checksums[bios_file]: logging.debug("%s Checksum : OK", filename) good_bios[bios_file] = filename return good_bios def play(self): arguments = [self.get_executable()] if self.runner_config.get("fullscreen"): arguments.append("-fullscreen") else: arguments.append("-windowed") if self.runner_config.get("resolution"): width, height = self.runner_config["resolution"].split('x') arguments += ["-fs-width", "%s" % width, "-fs-height", "%s" % height] if self.runner_config.get("machine"): arguments.append("-%s" % self.runner_config["machine"]) bios_path = self.runner_config.get("bios_path") if not os.path.exists(bios_path): return {'error': 'NO_BIOS'} good_bios = self.find_good_bioses(bios_path) for bios in good_bios.keys(): arguments.append("-%s" % bios) arguments.append(os.path.join(bios_path, good_bios[bios])) rom = self.game_config.get('main_file') or '' if not os.path.exists(rom): return {'error': 'FILE_NOT_FOUND', 'file': rom} arguments.append(rom) return {"command": arguments}
import os from lutris.util import display, system oss_list = [ ("None (don't use OSS)", "none"), ("padsp (PulseAudio OSS Wrapper)", "padsp"), ("padsp32 (PulseAudio OSS Wrapper for 32bit apps)", "padsp32"), ("pasuspender", "pasuspender"), ("aoss (OSS Wrapper for Alsa)", "aoss"), ] resolutions = display.get_resolutions() resolution_choices = zip(resolutions, resolutions) resolution_choices.insert(0, ("Keep current", 'off')) outputs = display.get_output_names() output_choices = zip(outputs, outputs) output_choices.insert(0, ("Off", 'off')) system_options = [ { 'option': 'game_path', 'type': 'directory_chooser', 'label': 'Main game folder', 'default': os.path.expanduser('~/Games'), 'scope': ['runner', 'system'], 'help': ("The main folder where you install your games.\n" "Lutris uses it to propose you a default path when you \n" "install a new game.") }, {
def get_resolution_choices(): resolutions = display.get_resolutions() resolution_choices = list(zip(resolutions, resolutions)) resolution_choices.insert(0, ("Keep current", 'off')) return resolution_choices
from lutris.util import display oss_list = [ ("None (don't use OSS)", "none"), ("padsp (PulseAudio OSS Wrapper)", "padsp"), ("padsp32 (PulseAudio OSS Wrapper for 32bit apps)", "padsp32"), ("pasuspender", "pasuspender"), ("aoss (OSS Wrapper for Alsa)", "aoss"), ] resolutions = display.get_resolutions() resolution_choices = zip(resolutions, resolutions) resolution_choices.insert(0, ("No change", None)) outputs = display.get_output_names() output_choices = zip(outputs, outputs) output_choices.insert(0, ("No change", None)) system_options = [{ 'option': 'game_path', 'type': 'directory_chooser', 'label': 'Library default folder', 'help': ("The main folder where you install your games.\n" "Lutris uses it to propose you a default path when you \n" "install a new game.") }, { 'option': 'disable_runtime', 'type':
def __init__(self, config=None): super(wine, self).__init__(config) self.context_menu_entries = [ ('winecfg', "Wine configuration", self.run_winecfg), ('wine-regedit', "Wine registry", self.run_regedit), ('winetricks', 'Winetricks', self.run_winetricks), ] wine_versions = ( [('System (%s)' % self.system_wine_version, 'system')] + [('Custom (select executable below)', 'custom')] + [(version, version) for version in get_wine_versions()] ) self.runner_options = [ { 'option': 'version', 'label': "Wine version", 'type': 'choice', 'choices': wine_versions, 'default': DEFAULT_WINE, 'help': ("The version of Wine used to launch the game.\n" "Using the last version is generally recommended, " "but some games work better on older versions.") }, { 'option': 'custom_wine_path', 'label': "Custom Wine executable", 'type': 'file', 'help': ('The Wine executable to be used if you have ' 'selected "Custom" as the Wine version.') }, { 'option': 'Desktop', 'label': 'Windowed (virtual desktop)', 'type': 'choice', 'choices': [('Yes', 'Desktop_res'), ('No', 'off')], 'default': 'off', 'help': ("Run the whole Windows desktop in a window.\n" "Otherwise, run it fullscreen.\n" "This corresponds to Wine's Virtual Desktop option.") }, { 'option': 'Desktop_res', 'label': 'Virtual desktop resolution', 'type': 'choice_with_entry', 'choices': display.get_resolutions(), 'default': '800x600', 'help': ("The size of the virtual desktop in pixels.") }, { 'option': 'MouseWarpOverride', 'label': 'Mouse Warp Override', 'type': 'choice', 'choices': [('Enable', 'enable'), ('Disable', 'disable'), ('Force', 'force')], 'default': 'enable', 'advanced': True, 'help': ( "Override the default mouse pointer warping behavior\n" "<b>Enable</b>: (Wine default) warp the pointer when the " "mouse is exclusively acquired \n" "<b>Disable</b>: never warp the mouse pointer \n" "<b>Force</b>: always warp the pointer" ) }, { 'option': 'OffscreenRenderingMode', 'label': 'Offscreen Rendering Mode', 'type': 'choice', 'choices': [('FBO', 'fbo'), ('BackBuffer', 'backbuffer')], 'default': 'fbo', 'advanced': True, 'help': ("Select the offscreen rendering implementation.\n" "<b>FBO</b>: (Wine default) Use framebuffer objects " "for offscreen rendering \n" "<b>Backbuffer</b>: Render offscreen render targets " "in the backbuffer.") }, { 'option': 'StrictDrawOrdering', 'label': "Strict Draw Ordering", 'type': 'choice', 'choices': [('Enabled', 'enabled'), ('Disabled', 'disabled')], 'default': 'disabled', 'advanced': True, 'help': ("This option ensures any pending drawing operations " "are submitted to the driver, but at a significant " "performance cost.") }, { 'option': 'RenderTargetLockMode', 'label': 'Render Target Lock Mode', 'type': 'choice', 'choices': [('Disabled', 'disabled'), ('ReadTex', 'readtex'), ('ReadDraw', 'readdraw')], 'default': 'readtex', 'advanced': True, 'help': ( "Select which mode is used for onscreen render targets:\n" "<b>Disabled</b>: Disables render target locking \n" "<b>ReadTex</b>: (Wine default) Reads by glReadPixels, " "writes by drawing a textured quad \n" "<b>ReadDraw</b>: Uses glReadPixels for reading and " "writing" ) }, { 'option': 'Audio', 'label': 'Audio driver', 'type': 'choice', 'choices': [('Auto', 'auto'), ('Alsa', 'alsa'), ('OSS', 'oss'), ('Jack', 'jack')], 'default': 'auto', 'help': ("Which audio backend to use.\n" "By default, Wine automatically picks the right one " "for your system. Alsa is the default for modern" "Linux distributions.") } ]