def configureGFX(config_directory, system): configFileName = "{}/{}".format(config_directory + "/inis", "GSdx.ini") if not os.path.exists(config_directory): os.makedirs(config_directory + "/inis") #create the config file if it doesn't exist if not os.path.exists(configFileName): f = open(configFileName, "w") f.write("osd_fontname = /usr/share/fonts/dejavu/DejaVuSans.ttf\n") f.close() # Update settings pcsx2GFXSettings = UnixSettings(configFileName, separator=' ') pcsx2GFXSettings.save("osd_fontname", "/usr/share/fonts/dejavu/DejaVuSans.ttf") pcsx2GFXSettings.save("osd_indicator_enabled", 1) pcsx2GFXSettings.save("UserHacks", 1) #showFPS if system.isOptSet('showFPS') and system.getOptBoolean('showFPS'): pcsx2GFXSettings.save("osd_monitor_enabled", 1) else: pcsx2GFXSettings.save("osd_monitor_enabled", 0) #internal resolution if system.isOptSet('internalresolution'): pcsx2GFXSettings.save("upscale_multiplier", system.config["internalresolution"]) else: pcsx2GFXSettings.save("upscale_multiplier", "1") #skipdraw if system.isOptSet('skipdraw'): pcsx2GFXSettings.save('UserHacks_SkipDraw', system.config['skipdraw']) else: pcsx2GFXSettings.save('UserHacks_SkipDraw', '0') #align sprite if system.isOptSet('align_sprite'): pcsx2GFXSettings.save('UserHacks_align_sprite_X', system.config['align_sprite']) else: pcsx2GFXSettings.save('UserHacks_align_sprite_X', '0') if system.isOptSet('vsync'): pcsx2GFXSettings.save("vsync", system.config["vsync"]) else: pcsx2GFXSettings.save("vsync", "1") if system.isOptSet('anisotropic_filtering'): pcsx2GFXSettings.save("MaxAnisotropy", system.config["anisotropic_filtering"]) else: pcsx2GFXSettings.save("MaxAnisotropy", "0") pcsx2GFXSettings.write()
def generate(self, system, rom, playersControllers, gameResolution): configDir = batoceraFiles.CONF + '/openbor' if not os.path.exists(configDir): os.makedirs(configDir) savesDir = batoceraFiles.SAVES + '/openbor' if not os.path.exists(savesDir): os.makedirs(savesDir) # guess the version to run core = system.config['core'] if system.config["core-forced"] == False: core = OpenborGenerator.guessCore(rom) eslog.log("core taken is {}".format(core)) # config file configfilename = "config6510.ini" if core == "openbor4432": configfilename = "config4432.ini" elif core == "openbor6330": configfilename = "config6330.ini" elif core == "openbor6412": configfilename = "config6412.ini" elif core == "openbor6510": configfilename = "config6510.ini" config = UnixSettings(configDir + "/" + configfilename, separator='') # general config.save("fullscreen", "1") config.save("vsync", "1") config.save("usegl", "1") config.save("usejoy", "1") # options if system.isOptSet("ratio"): config.save("stretch", system.config["ratio"]) else: config.remove("stretch") if system.isOptSet("filter"): config.save("swfilter", system.config["filter"]) else: config.remove("swfilter") # controllers openborControllers.generateControllerConfig(config, playersControllers, core) config.write() return OpenborGenerator.executeCore(core, rom)
def configureGFX(config_directory, system): configFileName = "{}/{}".format(config_directory + "/inis", "GS.ini") if not os.path.exists(config_directory): os.makedirs(config_directory + "/inis") # Create the config file if it doesn't exist if not os.path.exists(configFileName): f = open(configFileName, "w") f.close() # Update settings pcsx2GFXSettings = UnixSettings(configFileName, separator=' ') # Internal resolution if system.isOptSet('internal_resolution'): pcsx2GFXSettings.save("upscale_multiplier", system.config["internal_resolution"]) else: pcsx2GFXSettings.save("upscale_multiplier", "1") pcsx2GFXSettings.write()
def generate(self, system, rom, playersControllers, gameResolution): # Settings batocera default config file if no user defined one if not 'configfile' in system.config: # Using batocera config file system.config['configfile'] = batoceraFiles.retroarchCustom # Create retroarchcustom.cfg if does not exists if not os.path.isfile(batoceraFiles.retroarchCustom): libretroRetroarchCustom.generateRetroarchCustom() # Write controllers configuration files retroconfig = UnixSettings(batoceraFiles.retroarchCustom, separator=' ') if system.isOptSet('lightgun_map'): lightgun = system.getOptBoolean('lightgun_map') else: # Lightgun button mapping breaks lr-mame's inputs, disable if left on auto if system.config['core'] in ['mame', 'mess', 'mamevirtual']: lightgun = False else: lightgun = True libretroControllers.writeControllersConfig(retroconfig, system, playersControllers, lightgun) # force pathes libretroRetroarchCustom.generateRetroarchCustomPathes(retroconfig) # Write configuration to retroarchcustom.cfg if 'bezel' not in system.config or system.config['bezel'] == '': bezel = None else: bezel = system.config['bezel'] # some systems (ie gw) won't bezels if system.isOptSet('forceNoBezel') and system.getOptBoolean( 'forceNoBezel'): bezel = None # Get the graphics backend prior to writing the config gfxBackend = getGFXBackend(system) libretroConfig.writeLibretroConfig(retroconfig, system, playersControllers, rom, bezel, gameResolution, gfxBackend) retroconfig.write() # duplicate config to mapping files while ra now split in 2 parts remapconfigDir = batoceraFiles.retroarchRoot + "/config/remaps/common" if not os.path.exists(remapconfigDir): os.makedirs(remapconfigDir) shutil.copyfile(batoceraFiles.retroarchCustom, remapconfigDir + "/common.rmp") # Retroarch core on the filesystem retroarchCore = batoceraFiles.retroarchCores + system.config[ 'core'] + "_libretro.so" # for each core, a file /usr/lib/<core>.info must exit, otherwise, info such as rewinding/netplay will not work # to do a global check : cd /usr/lib/libretro && for i in *.so; do INF=$(echo $i | sed -e s+/usr/lib/libretro+/usr/share/libretro/info+ -e s+\.so+.info+); test -e "$INF" || echo $i; done #infoFile = batoceraFiles.retroarchCores + system.config['core'] + "_libretro.info" #if not os.path.exists(infoFile): # raise Exception("missing file " + infoFile) romName = os.path.basename(rom) # The command to run dontAppendROM = False # For the NeoGeo CD (lr-fbneo) it is necessary to add the parameter: --subsystem neocd if system.name == 'neogeocd' and system.config['core'] == "fbneo": commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--subsystem", "neocd", "--config", system.config['configfile'] ] # Set up GB/GBC Link games to use 2 different ROMs if needed if system.name == 'gb2players' or system.name == 'gbc2players': GBMultiROM = list() GBMultiFN = list() GBMultiSys = list() romGBName, romExtension = os.path.splitext(romName) # If ROM file is a .gb2 text, retrieve the filenames if romExtension.lower() in ['.gb2', '.gbc2']: with open(rom) as fp: for line in fp: GBMultiText = line.strip() if GBMultiText.lower().startswith("gb:"): GBMultiROM.append("/userdata/roms/gb/" + GBMultiText.split(":")[1]) GBMultiFN.append(GBMultiText.split(":")[1]) GBMultiSys.append("gb") elif GBMultiText.lower().startswith("gbc:"): GBMultiROM.append("/userdata/roms/gbc/" + GBMultiText.split(":")[1]) GBMultiFN.append(GBMultiText.split(":")[1]) GBMultiSys.append("gbc") else: GBMultiROM.append("/userdata/roms/" + system.name + "/" + GBMultiText) GBMultiFN.append(GBMultiText.split(":")[1]) if system.name == "gb2players": GBMultiSys.append("gb") else: GBMultiSys.append("gbc") else: # Otherwise fill in the list with the single game GBMultiROM.append(rom) GBMultiFN.append(romName) if system.name == "gb2players": GBMultiSys.append("gb") else: GBMultiSys.append("gbc") # If there are at least 2 games in the list, use the alternate command line if len(GBMultiROM) >= 2: commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, GBMultiROM[0], "--subsystem", "gb_link_2p", GBMultiROM[1], "--config", system.config['configfile'] ] dontAppendROM = True else: commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'] ] # Handling for the save copy if (system.isOptSet('sync_saves') and system.config["sync_saves"] == '1'): if len(GBMultiROM) >= 2: GBMultiSave = [ os.path.splitext(GBMultiFN[0])[0] + ".srm", os.path.splitext(GBMultiFN[1])[0] + ".srm" ] else: GBMultiSave = [os.path.splitext(GBMultiFN[0])[0] + ".srm"] # Verifies all the save paths exist # Prevents copy errors if they don't if not os.path.exists("/userdata/saves/gb"): os.mkdir("/userdata/saves/gb") if not os.path.exists("/userdata/saves/gbc"): os.mkdir("/userdata/saves/gbc") if not os.path.exists("/userdata/saves/gb2players"): os.mkdir("/userdata/saves/gb2players") if not os.path.exists("/userdata/saves/gbc2players"): os.mkdir("/userdata/saves/gbc2players") # Copies the saves if they exist for x in range(len(GBMultiSave)): saveFile = "/userdata/saves/" + GBMultiSys[ x] + "/" + GBMultiSave[x] newSaveFile = "/userdata/saves/" + system.name + "/" + GBMultiSave[ x] if os.path.exists(saveFile): shutil.copy(saveFile, newSaveFile) # Generates a script to copy the saves back on exit # Starts by making sure script paths exist if not os.path.exists("/userdata/system/scripts/"): os.mkdir("/userdata/system/scripts") if not os.path.exists("/userdata/system/scripts/gb2savesync/"): os.mkdir("/userdata/system/scripts/gb2savesync") scriptFile = "/userdata/system/scripts/gb2savesync/exitsync.sh" if os.path.exists(scriptFile): os.remove(scriptFile) GBMultiScript = open(scriptFile, "w") GBMultiScript.write("#!/bin/bash\n") GBMultiScript.write( "#This script is created by the Game Boy link cable system to sync save files.\n" ) GBMultiScript.write("#\n") GBMultiScript.write("\n") GBMultiScript.write("case $1 in\n") GBMultiScript.write(" gameStop)\n") # The only event is gameStop, checks to make sure it was called by the right system GBMultiScript.write( " if [ $2 = 'gb2players' ] || [ $2 = 'gbc2players' ]\n" ) GBMultiScript.write(" then\n") for x in range(len(GBMultiSave)): saveFile = "/userdata/saves/" + GBMultiSys[ x] + "/" + GBMultiSave[x] newSaveFile = "/userdata/saves/" + system.name + "/" + GBMultiSave[ x] GBMultiScript.write(' cp "' + newSaveFile + '" "' + saveFile + '"\n') GBMultiScript.write(" fi\n") # Deletes itself after running GBMultiScript.write(" rm " + scriptFile + "\n") GBMultiScript.write(" ;;\n") GBMultiScript.write("esac\n") GBMultiScript.close() # Make it executable fileStat = os.stat(scriptFile) os.chmod(scriptFile, fileStat.st_mode | 0o111) # PURE zip games uses the same commandarray of all cores. .pc and .rom uses owns elif system.name == 'dos': romDOSName = os.path.splitext(romName)[0] romDOSName, romExtension = os.path.splitext(romName) if romExtension == '.dos' or romExtension == '.pc': commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'], os.path.join(rom, romDOSName + ".bat") ] else: commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'] ] # Pico-8 multi-carts (might work only with official Lexaloffe engine right now) elif system.name == 'pico8': romext = os.path.splitext(romName)[1] if (romext.lower() == ".m3u"): with open(rom, "r") as fpin: lines = fpin.readlines() rom = os.path.dirname( os.path.abspath(rom)) + '/' + lines[0].strip() commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'] ] else: commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'] ] configToAppend = [] # Custom configs - per core customCfg = "{}/{}.cfg".format(batoceraFiles.retroarchRoot, system.name) if os.path.isfile(customCfg): configToAppend.append(customCfg) # Custom configs - per game customGameCfg = "{}/{}/{}.cfg".format(batoceraFiles.retroarchRoot, system.name, romName) if os.path.isfile(customGameCfg): configToAppend.append(customGameCfg) # Overlay management overlayFile = "{}/{}/{}.cfg".format(batoceraFiles.OVERLAYS, system.name, romName) if os.path.isfile(overlayFile): configToAppend.append(overlayFile) # RetroArch 1.7.8 (Batocera 5.24) now requires the shaders to be passed as command line argument renderConfig = system.renderconfig gameSpecial = videoMode.getGameSpecial(system.name, rom, True) gameShader = None if gameSpecial == "0": if 'shader' in renderConfig: gameShader = renderConfig['shader'] else: if ('shader-' + str(gameSpecial)) in renderConfig: gameShader = renderConfig['shader-' + str(gameSpecial)] else: gameShader = renderConfig['shader'] if 'shader' in renderConfig and gameShader != None: if (gfxBackend == 'glcore' or gfxBackend == 'vulkan') or (system.config['core'] in libretroConfig.coreForceSlangShaders): shaderFilename = gameShader + ".slangp" else: shaderFilename = gameShader + ".glslp" eslog.debug("searching shader {}".format(shaderFilename)) if os.path.exists("/userdata/shaders/" + shaderFilename): video_shader_dir = "/userdata/shaders" eslog.debug("shader {} found in /userdata/shaders".format( shaderFilename)) else: video_shader_dir = "/usr/share/batocera/shaders" video_shader = video_shader_dir + "/" + shaderFilename commandArray.extend(["--set-shader", video_shader]) # Generate the append if configToAppend: commandArray.extend(["--appendconfig", "|".join(configToAppend)]) # Netplay mode if 'netplay.mode' in system.config: if system.config['netplay.mode'] == 'host': commandArray.append("--host") elif system.config['netplay.mode'] == 'client' or system.config[ 'netplay.mode'] == 'spectator': commandArray.extend( ["--connect", system.config['netplay.server.ip']]) if 'netplay.server.port' in system.config: commandArray.extend( ["--port", system.config['netplay.server.port']]) if 'netplay.nickname' in system.config: commandArray.extend( ["--nick", system.config['netplay.nickname']]) # Verbose logs commandArray.extend(['--verbose']) # Extension used by hypseus .daphne but lr-daphne starts with .zip if system.name == 'daphne': romName = os.path.splitext(os.path.basename(rom))[0] rom = batoceraFiles.daphneDatadir + '/roms/' + romName + '.zip' if system.name == 'scummvm': rom = os.path.dirname(rom) + '/' + romName[0:-8] # Use command line instead of ROM file for MAME variants if system.config['core'] in ['mame', 'mess', 'mamevirtual']: dontAppendROM = True commandArray.append("/var/run/lr-mame.cmd") if dontAppendROM == False: commandArray.append(rom) return Command.Command(array=commandArray, env={"XDG_CONFIG_HOME": batoceraFiles.CONF})
def generateCoreSettings(retroarchCore, system): # retroarch-core-options.cfg if not os.path.exists(os.path.dirname(retroarchCore)): os.makedirs(os.path.dirname(retroarchCore)) try: coreSettings = UnixSettings(retroarchCore, separator=' ') except UnicodeError: # invalid retroarch-core-options.cfg # remove it and try again os.remove(retroarchCore) coreSettings = UnixSettings(retroarchCore, separator=' ') # Atari 800 and 5200 if (system.config['core'] == 'atari800'): if (system.name == 'atari800'): coreSettings.save('atari800_system', '"130XE (128K)"') coreSettings.save('RAM_SIZE', '"64"') coreSettings.save('STEREO_POKEY', '"1"') coreSettings.save('BUILTIN_BASIC', '"1"') else: coreSettings.save('atari800_system', '"5200"') coreSettings.save('RAM_SIZE', '"16"') coreSettings.save('STEREO_POKEY', '"0"') coreSettings.save('BUILTIN_BASIC', '"0"') # Colecovision and MSX if (system.config['core'] == 'bluemsx'): coreSettings.save('bluemsx_overscan', '"enabled"') if (system.name == 'colecovision'): coreSettings.save('bluemsx_msxtype', '"ColecoVision"') elif (system.name == 'msx1'): coreSettings.save('bluemsx_msxtype', '"MSX"') elif (system.name == 'msx2'): coreSettings.save('bluemsx_msxtype', '"MSX2"') elif (system.name == 'msx2+'): coreSettings.save('bluemsx_msxtype', '"MSX2+"') elif (system.name == 'msxturbor'): coreSettings.save('bluemsx_msxtype', '"MSXturboR"') if (system.config['core'] == 'citra'): if not os.path.exists(batoceraFiles.CONF + "/retroarch/3ds.cfg"): f = open(batoceraFiles.CONF + "/retroarch/3ds.cfg", "w") f.write("video_driver = \"glcore\"\n") f.close() if (system.config['core'] == 'tgbdual'): coreSettings.save('tgbdual_audio_output', '"Game Boy #1"') coreSettings.save('tgbdual_gblink_enable', '"enabled"') coreSettings.save('tgbdual_screen_placement', '"left-right"') coreSettings.save('tgbdual_single_screen_mp', '"both players"') coreSettings.save('tgbdual_switch_screens', '"normal"') if (system.config['core'] == 'gambatte'): if 'colorization' in system.renderconfig and system.renderconfig['colorization'] != None: coreSettings.save('gambatte_gb_colorization', '"internal"') coreSettings.save('gambatte_gb_internal_palette', '"' + system.renderconfig['colorization'] + '"') else: coreSettings.save('gambatte_gb_colorization', '"disabled"') if (system.config['core'] == 'desmume'): coreSettings.save('desmume_pointer_device_r', '"emulated"') # multisampling aa if system.isOptSet('multisampling'): coreSettings.save('desmume_gfx_multisampling', system.config['multisampling']) else: coreSettings.save('desmume_gfx_multisampling', '"disabled"') # texture smoothing if system.isOptSet('texture_smoothing'): coreSettings.save('desmume_gfx_texture_smoothing', system.config['texture_smoothing']) else: coreSettings.save('desmume_gfx_texture_smoothing', '"disabled"') # texture scaling (xBrz) if system.isOptSet('texture_scaling'): coreSettings.save('desmume_gfx_texture_scaling', system.config['texture_scaling']) else: coreSettings.save('desmume_gfx_texture_scaling', '"1"') if (system.config['core'] == 'mame078'): coreSettings.save('mame2003_skip_disclaimer', '"enabled"') coreSettings.save('mame2003_skip_warnings', '"enabled"') if (system.config['core'] == 'mame078plus'): coreSettings.save('mame2003-plus_skip_disclaimer', '"enabled"') coreSettings.save('mame2003-plus_skip_warnings', '"enabled"') coreSettings.save('mame2003-plus_analog', '"digital"') if (system.config['core'] == 'puae'): coreSettings.save('puae_video_options_display ', '"enabled"') # video resolution if system.isOptSet('video_resolution'): coreSettings.save('puae_video_resolution', system.config['video_resolution']) else: coreSettings.save('puae_video_resolution', '"auto"') # zoom mode if system.isOptSet('zoom_mode'): coreSettings.save('puae_zoom_mode', system.config['zoom_mode']) else: coreSettings.save('puae_zoom_mode', '"auto"') # standard video if system.isOptSet('video_standard'): coreSettings.save('puae_video_standard', system.config['video_standard']) else: coreSettings.save('puae_video_standard', '"PAL"') # keypad mapping 2p if system.isOptSet('keyrah_mapping'): coreSettings.save('puae_keyrah_keypad_mappings', system.config['keyrah_mapping']) else: coreSettings.save('puae_keyrah_keypad_mappings', '"enabled"') # mouse speed if system.isOptSet('mouse_speed'): coreSettings.save('puae_mouse_speed', system.config['mouse_speed']) else: coreSettings.save('puae_mouse_speed', '"200"') # whdload if system.isOptSet('whdload'): coreSettings.save('puae_use_whdload_prefs', system.config['whdload']) else: coreSettings.save('puae_use_whdload_prefs', '"config"') # retropad options if system.isOptSet('pad_options'): coreSettings.save('puae_retropad_options', system.config['pad_options']) else: coreSettings.save('puae_retropad_options', '"jump"') if (system.config['core'] == 'pce'): coreSettings.save('pce_keepaspect', '"enabled"') coreSettings.save('pce_nospritelimit', '"enabled"') if (system.config['core'] == 'pce_fast'): coreSettings.save('pce_keepaspect', '"enabled"') if (system.config['core'] == 'mupen64plus-next'): # BilinearMode if system.isOptSet('BilinearMode'): coreSettings.save('mupen64plus-BilinearMode', system.config['BilinearMode']) else: coreSettings.save('mupen64plus-BilinearMode', '"standard"') # multisampling aa if system.isOptSet('MultiSampling'): coreSettings.save('mupen64plus-MultiSampling', system.config['MultiSampling']) else: coreSettings.save('mupen64plus-MultiSampling', '"0"') # Texture filter if system.isOptSet('Texture_filter'): coreSettings.save('mupen64plus-txFilterMode', '"' + system.config['Texture_filter'] + '"') else: coreSettings.save('mupen64plus-txFilterMode', '"None"') # Texture Enhancement if system.isOptSet('Texture_Enhancement'): coreSettings.save('mupen64plus-txEnhancementMode', '"' + system.config['Texture_Enhancement'] + '"') else: coreSettings.save('mupen64plus-txEnhancementMode', '"None"') if (system.config['core'] == 'vb'): # 2D color mode if system.isOptSet('2d_color_mode'): coreSettings.save('vb_color_mode', '"' + system.config['2d_color_mode'] + '"') else: coreSettings.save('vb_color_mode', '"black & red"') # 3D color mode if system.isOptSet('3d_color_mode'): coreSettings.save('vb_anaglyph_preset', '"' + system.config['3d_color_mode'] + '"') else: coreSettings.save('vb_anaglyph_preset', '"disabled"') if (system.config['core'] == 'picodrive'): coreSettings.save('picodrive_input1', '"6 button pad"') coreSettings.save('picodrive_input2', '"6 button pad"') coreSettings.save('picodrive_sprlim', '"enabled"') if (system.config['core'] == '81'): coreSettings.save('81_sound', '"Zon X-81"') if (system.config['core'] == 'cap32'): if (system.name == 'gx4000'): coreSettings.save('cap32_model', '"6128+"') else: coreSettings.save('cap32_model', '"6128"') if (system.config['core'] == 'fuse'): coreSettings.save('fuse_machine', '"Spectrum 128K"') if (system.config['core'] == 'opera'): coreSettings.save('opera_dsp_threaded', '"enabled"') if (system.config['core'] == 'virtualjaguar'): coreSettings.save('virtualjaguar_usefastblitter', '"enabled"') if (system.config['core'] == 'vice'): coreSettings.save('vice_Controller', '"joystick"') coreSettings.save('vice_datasette_hotkeys', '"enabled"') coreSettings.save('vice_read_vicerc', '"disabled"') coreSettings.save('vice_retropad_options', '"jump"') coreSettings.save('vice_JoyPort', '"port_1"') # aspect ratio if system.isOptSet('aspect_ratio'): coreSettings.save('vice_aspect_ratio', system.config['aspect_ratio']) else: coreSettings.save('vice_aspect_ratio', '"pal"') # zoom mode if system.isOptSet('zoom_mode'): coreSettings.save('vice_zoom_mode', system.config['zoom_mode']) else: coreSettings.save('vice_zoom_mode', '"medium"') # external palette if system.isOptSet('external_palette'): coreSettings.save('vice_external_palette', system.config['external_palette']) else: coreSettings.save('vice_external_palette', '"colodore"') if (system.config['core'] == 'theodore'): coreSettings.save('theodore_autorun', '"enabled"') if (system.config['core'] == 'genesisplusgx'): coreSettings.save('genesis_plus_gx_no_sprite_limit', '"enabled"') if (system.config['core'] == 'snes9x_next'): coreSettings.save('snes9x_2010_reduce_sprite_flicker', '"enabled"') # reduce slowdown if system.isOptSet('reduce_slowdown'): coreSettings.save('snes9x_2010_overclock_cycles', system.config['reduce_slowdown']) else: coreSettings.save('snes9x_2010_overclock_cycles', '"compatible"') if (system.config['core'] == 'yabasanshiro'): # resolution mode if system.isOptSet('resolution_mode'): coreSettings.save('yabasanshiro_resolution_mode', system.config['resolution_mode']) else: coreSettings.save('yabasanshiro_resolution_mode', '"original"') if (system.config['core'] == 'nestopia'): coreSettings.save('nestopia_nospritelimit', '"enabled"') coreSettings.save('nestopia_overscan_h', '"enabled"') coreSettings.save('nestopia_overscan_v', '"enabled"') # palette if system.isOptSet('palette'): coreSettings.save('nestopia_palette', system.config['palette']) else: coreSettings.save('nestopia_palette', '"consumer"') if (system.config['core'] == 'fceumm'): coreSettings.save('fceumm_nospritelimit', '"enabled"') if (system.config['core'] == 'flycast'): coreSettings.save('reicast_threaded_rendering', '"enabled"') coreSettings.save('reicast_mipmapping', '"disabled"') # widescreen hack if system.isOptSet('widescreen_hack'): coreSettings.save('reicast_widescreen_hack', system.config['widescreen_hack']) else: coreSettings.save('reicast_widescreen_hack', '"disabled"') # anisotropic filtering if system.isOptSet('anisotropic_filtering'): coreSettings.save('reicast_anisotropic_filtering', system.config['anisotropic_filtering']) else: coreSettings.save('reicast_anisotropic_filtering', '"off"') # texture upscaling (xBRZ) if system.isOptSet('texture_upscaling'): coreSettings.save('reicast_texupscale', system.config['texture_upscaling']) else: coreSettings.save('reicast_texupscale', '"off"') # render to texture upscaling if system.isOptSet('render_to_texture_upscaling'): coreSettings.save('reicast_render_to_texture_upscaling', system.config['render_to_texture_upscaling']) else: coreSettings.save('reicast_render_to_texture_upscaling', '"1x"') if (system.config['core'] == 'dosbox'): coreSettings.save('dosbox_svn_pcspeaker', '"true"') if (system.config['core'] == 'px68k'): coreSettings.save('px68k_disk_path', '"disabled"') if (system.config['core'] == 'mednafen_psx'): coreSettings.save('beetle_psx_hw_cpu_freq_scale', '"110%"') # internal resolution if system.isOptSet('internal_resolution'): coreSettings.save('beetle_psx_hw_internal_resolution', system.config['internal_resolution']) else: coreSettings.save('beetle_psx_hw_internal_resolution', '"1x(native)"') # texture filtering if system.isOptSet('texture_filtering'): coreSettings.save('beetle_psx_hw_filter', system.config['texture_filtering']) else: coreSettings.save('beetle_psx_hw_filter', '"nearest"') # widescreen hack if system.isOptSet('widescreen_hack'): coreSettings.save('beetle_psx_hw_widescreen_hack', system.config['widescreen_hack']) else: coreSettings.save('beetle_psx_hw_widescreen_hack', '"disabled"') if (system.config['core'] == 'duckstation'): # resolution scale (default 1) if system.isOptSet('resolution_scale'): coreSettings.save('duckstation_GPU.ResolutionScale', system.config['resolution_scale']) else: coreSettings.save('duckstation_GPU.ResolutionScale', '"1"') # multisampling antialiasing (default 1x) if system.isOptSet('antialiasing'): coreSettings.save('duckstation_GPU.MSAA', system.config['antialiasing']) else: coreSettings.save('duckstation_GPU.MSAA', '"1"') # texture filtering (default nearest) if system.isOptSet('texture_filtering'): coreSettings.save('duckstation_GPU.TextureFilter', system.config['texture_filtering']) else: coreSettings.save('duckstation_GPU.TextureFilter', '"Nearest"') # widescreen hack (default off) if system.isOptSet('widescreen_hack'): coreSettings.save('duckstation_GPU.WidescreenHack', system.config['widescreen_hack']) else: coreSettings.save('duckstation_GPU.WidescreenHack', '"false"') if (system.config['core'] == 'pcsx_rearmed'): for n in range(1, 8+1): val = coreSettings.load('pcsx_rearmed_pad{}type'.format(n)) if val == '"none"' or val == "" or val is None: coreSettings.save('pcsx_rearmed_pad{}type'.format(n), '"standard"') # force multitap no value / auto to disable # only let enabled when it is forced while previous values enable it val = coreSettings.load('pcsx_rearmed_multitap1') if val == '"auto"' or val == "" or val is None: coreSettings.save('pcsx_rearmed_multitap1', '"disabled"') val = coreSettings.load('pcsx_rearmed_multitap2') if val == '"auto"' or val == "" or val is None: coreSettings.save('pcsx_rearmed_multitap2', '"disabled"') # custom : allow the user to configure directly retroarchcore.cfg via batocera.conf via lines like : snes.retroarchcore.opt=val for user_config in system.config: if user_config[:14] == "retroarchcore.": coreSettings.save(user_config[14:], system.config[user_config]) coreSettings.write()
def generate(self, system, rom, playersControllers, gameResolution): retroconfig = UnixSettings(batoceraFiles.amiberryRetroarchCustom, separator=' ') if not os.path.exists(dirname(batoceraFiles.amiberryRetroarchCustom)): os.makedirs(dirname(batoceraFiles.amiberryRetroarchCustom)) romType = self.getRomType(rom) eslog.log("romType" + romType) if romType != 'UNKNOWN': commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-G" ] if romType != 'WHDL': commandArray.append("--model") commandArray.append(system.config['core']) if romType == 'WHDL': commandArray.append("--autoload") commandArray.append(rom) elif romType == 'HDF': commandArray.append("-s") commandArray.append("hardfile2=rw,DH0:" + rom + ",32,1,2,512,0,,uae0") commandArray.append("-s") commandArray.append("uaehf0=hdf,rw,DH0:" + rom + ",32,1,2,512,0,,uae0") elif romType == 'CD': commandArray.append("--cdimage") commandArray.append(rom) elif romType == 'DISK': # floppies n = 0 for img in self.floppiesFromRom(rom): if n < 4: commandArray.append("-" + str(n)) commandArray.append(img) n += 1 # floppy path commandArray.append("-s") # Use disk folder as floppy path romPathIndex = rom.rfind('/') commandArray.append("amiberry.floppy_path=" + rom[0:romPathIndex]) # controller libretroControllers.writeControllersConfig(retroconfig, system, playersControllers) retroconfig.write() if not os.path.exists(batoceraFiles.amiberryRetroarchInputsDir): os.makedirs(batoceraFiles.amiberryRetroarchInputsDir) nplayer = 1 for playercontroller, pad in sorted(playersControllers.items()): replacements = {'_player' + str(nplayer) + '_': '_'} # amiberry remove / included in pads names like "USB Downlo01.80 PS3/USB Corded Gamepad" padfilename = pad.realName.replace("/", "") playerInputFilename = batoceraFiles.amiberryRetroarchInputsDir + "/" + padfilename + ".cfg" with open( batoceraFiles.amiberryRetroarchCustom) as infile, open( playerInputFilename, 'w') as outfile: for line in infile: for src, target in replacements.iteritems(): newline = line.replace(src, target) if not newline.isspace(): outfile.write(newline) if nplayer == 1: # 1 = joystick port commandArray.append("-s") commandArray.append("joyport1_friendlyname=" + padfilename) if romType == 'CD': commandArray.append("-s") commandArray.append("joyport1_mode=cd32joy") if nplayer == 2: # 0 = mouse for the player 2 commandArray.append("-s") commandArray.append("joyport0_friendlyname=" + padfilename) nplayer += 1 # fps if system.config['showFPS'] == 'true': commandArray.append("-s") commandArray.append("show_leds=true") # disable port 2 (otherwise, the joystick goes on it) commandArray.append("-s") commandArray.append("joyport2=") # display vertical centering commandArray.append("-s") commandArray.append("gfx_center_vertical=smart") os.chdir("/usr/share/amiberry") return Command.Command(array=commandArray)
def generate(self, system, rom, playersControllers, gameResolution): # Settings batocera default config file if no user defined one if not 'configfile' in system.config: # Using batocera config file system.config['configfile'] = batoceraFiles.retroarchCustom # Create retroarchcustom.cfg if does not exists if not os.path.isfile(batoceraFiles.retroarchCustom): libretroRetroarchCustom.generateRetroarchCustom() # Write controllers configuration files retroconfig = UnixSettings(batoceraFiles.retroarchCustom, separator=' ') libretroControllers.writeControllersConfig(retroconfig, system, playersControllers) # force pathes libretroRetroarchCustom.generateRetroarchCustomPathes(retroconfig) # Write configuration to retroarchcustom.cfg if 'bezel' not in system.config or system.config['bezel'] == '': bezel = None else: bezel = system.config['bezel'] # some systems (ie gw) won't bezels if system.isOptSet('forceNoBezel') and system.getOptBoolean( 'forceNoBezel'): bezel = None libretroConfig.writeLibretroConfig(retroconfig, system, playersControllers, rom, bezel, gameResolution) retroconfig.write() # Retroarch core on the filesystem retroarchCore = batoceraFiles.retroarchCores + system.config[ 'core'] + batoceraFiles.libretroExt romName = os.path.basename(rom) # The command to run dontAppendROM = False # For the NeoGeo CD (lr-fbneo) it is necessary to add the parameter: --subsystem neocd if system.name == 'neogeocd' and system.config['core'] == "fbneo": commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--subsystem", "neocd", "--config", system.config['configfile'] ] # Set up GB/GBC Link games to use 2 different ROMs if needed if system.name == 'gb2players' or system.name == 'gbc2players': GBMultiROM = list() GBMultiFN = list() GBMultiSys = list() romGBName, romExtension = os.path.splitext(romName) # If ROM file is a .gb2 text, retrieve the filenames if romExtension.lower() in ['.gb2', '.gbc2']: with open(rom) as fp: for line in fp: GBMultiText = line.strip() if GBMultiText.lower().startswith("gb:"): GBMultiROM.append("/userdata/roms/gb/" + GBMultiText.split(":")[1]) GBMultiFN.append(GBMultiText.split(":")[1]) GBMultiSys.append("gb") elif GBMultiText.lower().startswith("gbc:"): GBMultiROM.append("/userdata/roms/gbc/" + GBMultiText.split(":")[1]) GBMultiFN.append(GBMultiText.split(":")[1]) GBMultiSys.append("gbc") else: GBMultiROM.append("/userdata/roms/" + system.name + "/" + GBMultiText) GBMultiFN.append(GBMultiText.split(":")[1]) if system.name == "gb2players": GBMultiSys.append("gb") else: GBMultiSys.append("gbc") else: # Otherwise fill in the list with the single game GBMultiROM.append(rom) GBMultiFN.append(romName) if system.name == "gb2players": GBMultiSys.append("gb") else: GBMultiSys.append("gbc") # If there are at least 2 games in the list, use the alternate command line if len(GBMultiROM) >= 2: commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, GBMultiROM[0], "--subsystem", "gb_link_2p", GBMultiROM[1], "--config", system.config['configfile'] ] dontAppendROM = True else: commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'] ] # Handling for the save copy if (system.isOptSet('sync_saves') and system.config["sync_saves"] == '1'): if len(GBMultiROM) >= 2: GBMultiSave = [ os.path.splitext(GBMultiFN[0])[0] + ".srm", os.path.splitext(GBMultiFN[1])[0] + ".srm" ] else: GBMultiSave = [os.path.splitext(GBMultiFN[0])[0] + ".srm"] # Verifies all the save paths exist # Prevents copy errors if they don't if not os.path.exists("/userdata/saves/gb"): os.mkdir("/userdata/saves/gb") if not os.path.exists("/userdata/saves/gbc"): os.mkdir("/userdata/saves/gbc") if not os.path.exists("/userdata/saves/gb2players"): os.mkdir("/userdata/saves/gb2players") if not os.path.exists("/userdata/saves/gbc2players"): os.mkdir("/userdata/saves/gbc2players") # Copies the saves if they exist for x in range(len(GBMultiSave)): saveFile = "/userdata/saves/" + GBMultiSys[ x] + "/" + GBMultiSave[x] newSaveFile = "/userdata/saves/" + system.name + "/" + GBMultiSave[ x] if os.path.exists(saveFile): shutil.copy(saveFile, newSaveFile) # Generates a script to copy the saves back on exit # Starts by making sure script paths exist if not os.path.exists("/userdata/system/scripts/"): os.mkdir("/userdata/system/scripts") if not os.path.exists("/userdata/system/scripts/gb2savesync/"): os.mkdir("/userdata/system/scripts/gb2savesync") scriptFile = "/userdata/system/scripts/gb2savesync/exitsync.sh" if os.path.exists(scriptFile): os.remove(scriptFile) GBMultiScript = open(scriptFile, "w") GBMultiScript.write("#!/bin/bash\n") GBMultiScript.write( "#This script is created by the Game Boy link cable system to sync save files.\n" ) GBMultiScript.write("#\n") GBMultiScript.write("\n") GBMultiScript.write("case $1 in\n") GBMultiScript.write(" gameStop)\n") # The only event is gameStop, checks to make sure it was called by the right system GBMultiScript.write( " if [ $2 = 'gb2players' ] || [ $2 = 'gbc2players' ]\n" ) GBMultiScript.write(" then\n") for x in range(len(GBMultiSave)): saveFile = "/userdata/saves/" + GBMultiSys[ x] + "/" + GBMultiSave[x] newSaveFile = "/userdata/saves/" + system.name + "/" + GBMultiSave[ x] GBMultiScript.write(' cp "' + newSaveFile + '" "' + saveFile + '"\n') GBMultiScript.write(" fi\n") # Deletes itself after running GBMultiScript.write(" rm " + scriptFile + "\n") GBMultiScript.write(" ;;\n") GBMultiScript.write("esac\n") GBMultiScript.close() # Make it executable fileStat = os.stat(scriptFile) os.chmod(scriptFile, fileStat.st_mode | 0o111) # PURE zip games uses the same commandarray of all cores. .pc and .rom uses owns elif system.name == 'dos': romDOSName = os.path.splitext(romName)[0] romDOSName, romExtension = os.path.splitext(romName) if romExtension == '.dos' or romExtension == '.pc': commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'], os.path.join(rom, romDOSName + ".bat") ] else: commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'] ] # Pico-8 multi-carts (might work only with official Lexaloffe engine right now) elif system.name == 'pico8': romext = os.path.splitext(romName)[1] if (romext.lower() == ".m3u"): with open(rom, "r") as fpin: lines = fpin.readlines() rom = os.path.dirname( os.path.abspath(rom)) + '/' + lines[0].strip() commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'] ] else: commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'] ] configToAppend = [] # Custom configs - per core customCfg = "{}/{}.cfg".format(batoceraFiles.retroarchRoot, system.name) if os.path.isfile(customCfg): configToAppend.append(customCfg) # Custom configs - per game customGameCfg = "{}/{}/{}.cfg".format(batoceraFiles.retroarchRoot, system.name, romName) if os.path.isfile(customGameCfg): configToAppend.append(customGameCfg) # Overlay management overlayFile = "{}/{}/{}.cfg".format(batoceraFiles.OVERLAYS, system.name, romName) if os.path.isfile(overlayFile): configToAppend.append(overlayFile) # RetroArch 1.7.8 (Batocera 5.24) now requires the shaders to be passed as command line argument renderConfig = system.renderconfig if 'shader' in renderConfig and renderConfig['shader'] != None: if ((system.isOptSet("gfxbackend") and system.config["gfxbackend"] == "vulkan") or (system.config['core'] in libretroConfig.coreForceSlangShaders)): shaderFilename = renderConfig['shader'] + ".slangp" else: shaderFilename = renderConfig['shader'] + ".glslp" eslog.debug("searching shader {}".format(shaderFilename)) if os.path.exists("/userdata/shaders/" + shaderFilename): video_shader_dir = "/userdata/shaders" eslog.debug("shader {} found in /userdata/shaders".format( shaderFilename)) else: video_shader_dir = "/usr/share/batocera/shaders" video_shader = video_shader_dir + "/" + shaderFilename commandArray.extend(["--set-shader", video_shader]) # Generate the append if configToAppend: commandArray.extend(["--appendconfig", "|".join(configToAppend)]) # Netplay mode if 'netplay.mode' in system.config: if system.config['netplay.mode'] == 'host': commandArray.append("--host") elif system.config['netplay.mode'] == 'client' or system.config[ 'netplay.mode'] == 'spectator': commandArray.extend( ["--connect", system.config['netplay.server.ip']]) if 'netplay.server.port' in system.config: commandArray.extend( ["--port", system.config['netplay.server.port']]) if 'netplay.nickname' in system.config: commandArray.extend( ["--nick", system.config['netplay.nickname']]) # Verbose logs commandArray.extend(['--verbose']) # Extension used by hypseus .daphne but lr-daphne starts with .zip if system.name == 'daphne': romName = os.path.splitext(os.path.basename(rom))[0] rom = batoceraFiles.daphneDatadir + '/roms/' + romName + '.zip' # The libretro core for EasyRPG requires to launch the RPG_RT.ldb file inside the .easyrpg folder if system.name == 'easyrpg' and system.config['core'] == "easyrpg": rom = rom + '/RPG_RT.ldb' if system.name == 'scummvm': rom = os.path.dirname(rom) + '/' + romName[0:-8] if dontAppendROM == False: commandArray.append(rom) return Command.Command(array=commandArray)
def generate(self, system, rom, playersControllers, gameResolution): # Settings batocera default config file if no user defined one if not 'configfile' in system.config: # Using batocera config file system.config['configfile'] = batoceraFiles.retroarchCustom # Create retroarchcustom.cfg if does not exists if not os.path.isfile(batoceraFiles.retroarchCustom): libretroRetroarchCustom.generateRetroarchCustom() # Write controllers configuration files retroconfig = UnixSettings(batoceraFiles.retroarchCustom, separator=' ') libretroControllers.writeControllersConfig(retroconfig, system, playersControllers) # force pathes libretroRetroarchCustom.generateRetroarchCustomPathes(retroconfig) # Write configuration to retroarchcustom.cfg if 'bezel' not in system.config or system.config['bezel'] == '': bezel = None else: bezel = system.config['bezel'] # some systems (ie gw) won't bezels if system.isOptSet('forceNoBezel') and system.getOptBoolean( 'forceNoBezel'): bezel = None libretroConfig.writeLibretroConfig(retroconfig, system, playersControllers, rom, bezel, gameResolution) retroconfig.write() # Retroarch core on the filesystem retroarchCore = batoceraFiles.retroarchCores + system.config[ 'core'] + batoceraFiles.libretroExt romName = os.path.basename(rom) # The command to run # For the NeoGeo CD (lr-fbneo) it is necessary to add the parameter: --subsystem neocd if system.name == 'neogeocd' and system.config['core'] == "fbneo": commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--subsystem", "neocd", "--config", system.config['configfile'] ] # PURE zip games uses the same commandarray of all cores. .pc and .rom uses owns elif system.name == 'dos': romDOSName = os.path.splitext(romName)[0] romDOSName, romExtension = os.path.splitext(romName) if romExtension == '.dos' or romExtension == '.pc': if os.path.isfile(os.path.join(rom, romDOSName + ".bat")): commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'], os.path.join(rom, romDOSName + ".bat") ] else: commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'], rom + "/dosbox.bat" ] else: commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'] ] else: commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile'] ] configToAppend = [] # Custom configs - per core customCfg = "{}/{}.cfg".format(batoceraFiles.retroarchRoot, system.name) if os.path.isfile(customCfg): configToAppend.append(customCfg) # Custom configs - per game customGameCfg = "{}/{}/{}.cfg".format(batoceraFiles.retroarchRoot, system.name, romName) if os.path.isfile(customGameCfg): configToAppend.append(customGameCfg) # Overlay management overlayFile = "{}/{}/{}.cfg".format(batoceraFiles.OVERLAYS, system.name, romName) if os.path.isfile(overlayFile): configToAppend.append(overlayFile) # RetroArch 1.7.8 (Batocera 5.24) now requires the shaders to be passed as command line argument renderConfig = system.renderconfig if 'shader' in renderConfig and renderConfig['shader'] != None: if ((system.isOptSet("gfxbackend") and system.config["gfxbackend"] == "vulkan") or (system.config['core'] in libretroConfig.coreForceSlangShaders)): shaderFilename = renderConfig['shader'] + ".slangp" else: shaderFilename = renderConfig['shader'] + ".glslp" eslog.log("searching shader {}".format(shaderFilename)) if os.path.exists("/userdata/shaders/" + shaderFilename): video_shader_dir = "/userdata/shaders" eslog.log("shader {} found in /userdata/shaders".format( shaderFilename)) else: video_shader_dir = "/usr/share/batocera/shaders" video_shader = video_shader_dir + "/" + shaderFilename commandArray.extend(["--set-shader", video_shader]) # Generate the append if configToAppend: commandArray.extend(["--appendconfig", "|".join(configToAppend)]) # Netplay mode if 'netplay.mode' in system.config: if system.config['netplay.mode'] == 'host': commandArray.append("--host") elif system.config['netplay.mode'] == 'client' or system.config[ 'netplay.mode'] == 'spectator': commandArray.extend( ["--connect", system.config['netplay.server.ip']]) if 'netplay.server.port' in system.config: commandArray.extend( ["--port", system.config['netplay.server.port']]) if 'netplay.nickname' in system.config: commandArray.extend( ["--nick", system.config['netplay.nickname']]) # Verbose logs commandArray.extend(['--verbose']) # Extension used by hypseus .daphne but lr-daphne starts with .zip if system.name == 'daphne': romName = os.path.splitext(os.path.basename(rom))[0] rom = batoceraFiles.daphneDatadir + '/roms/' + romName + '.zip' # The libretro core for EasyRPG requires to launch the RPG_RT.ldb file inside the .easyrpg folder if system.name == 'easyrpg' and system.config['core'] == "easyrpg": rom = rom + '/RPG_RT.ldb' if system.name == 'scummvm': rom = os.path.dirname(rom) + '/' + romName[0:-8] commandArray.append(rom) return Command.Command(array=commandArray)
def generateCoreSettings(retroarchCore, system): # retroarch-core-options.cfg if not os.path.exists(os.path.dirname(retroarchCore)): os.makedirs(os.path.dirname(retroarchCore)) try: coreSettings = UnixSettings(retroarchCore, separator=' ') except UnicodeError: # invalid retroarch-core-options.cfg # remove it and try again os.remove(retroarchCore) coreSettings = UnixSettings(retroarchCore, separator=' ') # Atari 800 and 5200 if (system.config['core'] == 'atari800'): if (system.name == 'atari800'): coreSettings.save('atari800_system', '"130XE (128K)"') coreSettings.save('RAM_SIZE', '"64"') coreSettings.save('STEREO_POKEY', '"1"') coreSettings.save('BUILTIN_BASIC', '"1"') else: coreSettings.save('atari800_system', '"5200"') coreSettings.save('RAM_SIZE', '"16"') coreSettings.save('STEREO_POKEY', '"0"') coreSettings.save('BUILTIN_BASIC', '"0"') # Colecovision and MSX if (system.config['core'] == 'bluemsx'): coreSettings.save('bluemsx_overscan', '"enabled"') if (system.name == 'colecovision'): coreSettings.save('bluemsx_msxtype', '"ColecoVision"') elif (system.name == 'msx1'): coreSettings.save('bluemsx_msxtype', '"MSX"') elif (system.name == 'msx2'): coreSettings.save('bluemsx_msxtype', '"MSX2"') elif (system.name == 'msx2+'): coreSettings.save('bluemsx_msxtype', '"MSX2+"') elif (system.name == 'msxturbor'): coreSettings.save('bluemsx_msxtype', '"MSXturboR"') if (system.config['core'] == 'citra'): if not os.path.exists(batoceraFiles.CONF + "/retroarch/3ds.cfg"): f = open(batoceraFiles.CONF + "/retroarch/3ds.cfg", "w") f.write("video_driver = \"glcore\"\n") f.close() if (system.config['core'] == 'tgbdual'): coreSettings.save('tgbdual_audio_output', '"Game Boy #1"') coreSettings.save('tgbdual_gblink_enable', '"enabled"') coreSettings.save('tgbdual_screen_placement', '"left-right"') coreSettings.save('tgbdual_single_screen_mp', '"both players"') coreSettings.save('tgbdual_switch_screens', '"normal"') if (system.config['core'] == 'gambatte'): if 'colorization' in system.renderconfig and system.renderconfig[ 'colorization'] != None: coreSettings.save('gambatte_gb_colorization', '"internal"') coreSettings.save('gambatte_gb_internal_palette', '"' + system.renderconfig['colorization'] + '"') else: coreSettings.save('gambatte_gb_colorization', '"disabled"') if (system.config['core'] == 'desmume'): coreSettings.save('desmume_pointer_device_r', '"emulated"') # multisampling aa if system.isOptSet('multisampling'): coreSettings.save("desmume_gfx_multisampling", system.config["multisampling"]) else: coreSettings.save("desmume_gfx_multisampling", "disabled") # texture smoothing if system.isOptSet('texture_smoothing'): coreSettings.save("desmume_gfx_texture_smoothing", system.config["texture_smoothing"]) else: coreSettings.save("desmume_gfx_texture_smoothing", "disabled") # texture scaling (xBrz) if system.isOptSet('texture_scaling'): coreSettings.save("desmume_gfx_texture_scaling", system.config["texture_scaling"]) else: coreSettings.save("desmume_gfx_texture_scaling", "1") if (system.config['core'] == 'mame078'): coreSettings.save('mame2003_skip_disclaimer', '"enabled"') coreSettings.save('mame2003_skip_warnings', '"enabled"') if (system.config['core'] == 'mame078plus'): coreSettings.save('mame2003-plus_skip_disclaimer', '"enabled"') coreSettings.save('mame2003-plus_skip_warnings', '"enabled"') coreSettings.save('mame2003-plus_analog', '"digital"') if (system.config['core'] == 'pce'): coreSettings.save('pce_keepaspect', '"enabled"') if (system.config['core'] == 'pce_fast'): coreSettings.save('pce_keepaspect', '"enabled"') if (system.config['core'] == 'picodrive'): coreSettings.save('picodrive_input1', '"6 button pad"') coreSettings.save('picodrive_input2', '"6 button pad"') if (system.config['core'] == '81'): coreSettings.save('81_sound', '"Zon X-81"') if (system.config['core'] == 'cap32'): if (system.name == 'gx4000'): coreSettings.save('cap32_model', '"6128+"') else: coreSettings.save('cap32_model', '"6128"') if (system.config['core'] == 'fuse'): coreSettings.save('fuse_machine', '"Spectrum 128K"') if (system.config['core'] == 'opera'): coreSettings.save('opera_dsp_threaded', '"enabled"') if (system.config['core'] == 'virtualjaguar'): coreSettings.save('virtualjaguar_usefastblitter', '"enabled"') if (system.config['core'] == 'vice'): coreSettings.save('vice_Controller', '"joystick"') coreSettings.save('vice_JoyPort', '"port_1"') if (system.config['core'] == 'theodore'): coreSettings.save('theodore_autorun', '"enabled"') if (system.config['core'] == 'flycast'): coreSettings.save('reicast_threaded_rendering', '"enabled"') # widescreen hack if system.isOptSet('widescreen_hack'): coreSettings.save("reicast_widescreen_hack", system.config["widescreen_hack"]) else: coreSettings.save("reicast_widescreen_hack", "disabled") # anisotropic filtering if system.isOptSet('anisotropic_filtering'): coreSettings.save("reicast_anisotropic_filtering", system.config["anisotropic_filtering"]) else: coreSettings.save("reicast_anisotropic_filtering", "off") # texture upscaling (xBRZ) if system.isOptSet('texture_upscaling'): coreSettings.save("reicast_texupscale", system.config["texture_upscaling"]) else: coreSettings.save("reicast_texupscale", "off") # render to texture upscaling if system.isOptSet('render_to_texture_upscaling'): coreSettings.save("reicast_render_to_texture_upscaling", system.config["render_to_texture_upscaling"]) else: coreSettings.save("reicast_render_to_texture_upscaling", "1x") if (system.config['core'] == 'dosbox'): coreSettings.save('dosbox_svn_pcspeaker', '"true"') if (system.config['core'] == 'px68k'): coreSettings.save('px68k_disk_path', '"disabled"') if (system.config['core'] == 'mednafen_psx'): # internal resolution if system.isOptSet('internal_resolution'): coreSettings.save("beetle_psx_hw_internal_resolution", system.config["internal_resolution"]) else: coreSettings.save("beetle_psx_hw_internal_resolution", "1x(native)") # texture filtering if system.isOptSet('texture_filtering'): coreSettings.save("beetle_psx_hw_filter", system.config["texture_filtering"]) else: coreSettings.save("beetle_psx_hw_filter", "nearest") # widescreen hack if system.isOptSet('widescreen_hack'): coreSettings.save("beetle_psx_hw_widescreen_hack", system.config["widescreen_hack"]) else: coreSettings.save("beetle_psx_hw_widescreen_hack", "disabled") if (system.config['core'] == 'pcsx_rearmed'): for n in range(1, 8 + 1): val = coreSettings.load('pcsx_rearmed_pad{}type'.format(n)) if val == '"none"' or val == "" or val is None: coreSettings.save('pcsx_rearmed_pad{}type'.format(n), '"standard"') # force multitap no value / auto to disable # only let enabled when it is forced while previous values enable it val = coreSettings.load('pcsx_rearmed_multitap1') if val == '"auto"' or val == "" or val is None: coreSettings.save('pcsx_rearmed_multitap1', '"disabled"') val = coreSettings.load('pcsx_rearmed_multitap2') if val == '"auto"' or val == "" or val is None: coreSettings.save('pcsx_rearmed_multitap2', '"disabled"') # custom : allow the user to configure directly retroarchcore.cfg via batocera.conf via lines like : snes.retroarchcore.opt=val for user_config in system.config: if user_config[:14] == "retroarchcore.": coreSettings.save(user_config[14:], system.config[user_config]) coreSettings.write()
def generateRetroarchCustom(): # retroarchcustom.cfg if not os.path.exists(os.path.dirname(batoceraFiles.retroarchCustom)): os.makedirs(os.path.dirname(batoceraFiles.retroarchCustom)) try: retroarchSettings = UnixSettings(batoceraFiles.retroarchCustom, separator=' ') except UnicodeError: os.remove(batoceraFiles.retroarchCustom) retroarchSettings = UnixSettings(batoceraFiles.retroarchCustom, separator=' ') # Use Interface retroarchSettings.save('menu_driver', '"ozone"') retroarchSettings.save('content_show_favorites', '"false"') retroarchSettings.save('content_show_images', '"false"') retroarchSettings.save('content_show_music', '"false"') retroarchSettings.save('content_show_video', '"false"') retroarchSettings.save('content_show_history', '"false"') retroarchSettings.save('content_show_playlists', '"false"') retroarchSettings.save('content_show_add', '"false"') retroarchSettings.save('menu_show_load_core', '"false"') retroarchSettings.save('menu_show_load_content', '"false"') retroarchSettings.save('menu_show_online_updater', '"false"') retroarchSettings.save('menu_show_core_updater', '"false"') # Input retroarchSettings.save('input_autodetect_enable', '"false"') retroarchSettings.save('input_joypad_driver', '"sdl2"') retroarchSettings.save('input_player1_analog_dpad_mode', '"1"') retroarchSettings.save('input_player2_analog_dpad_mode', '"1"') retroarchSettings.save('input_player3_analog_dpad_mode', '"1"') retroarchSettings.save('input_player4_analog_dpad_mode', '"1"') retroarchSettings.save('input_enable_hotkey_btn', '"16"') retroarchSettings.save('input_enable_hotkey', '"escape"') retroarchSettings.save('input_exit_emulator', '"escape"') # Video retroarchSettings.save('video_aspect_ratio_auto', '"true"') retroarchSettings.save('video_gpu_screenshot', '"true"') retroarchSettings.save('video_shader_enable', '"false"') # Audio retroarchSettings.save('audio_volume', '"2.0"') # Settings retroarchSettings.save('global_core_options', '"true"') retroarchSettings.save('config_save_on_exit', '"false"') retroarchSettings.save('savestate_auto_save', '"false"') retroarchSettings.save('savestate_auto_load', '"false"') retroarchSettings.save('menu_swap_ok_cancel_buttons', '"true"') # Accentuation retroarchSettings.save('rgui_extended_ascii', '"true"') # Hide the welcome message in Retroarch retroarchSettings.save('rgui_show_start_screen', '"false"') # Enable usage of OSD messages (Text messages not in badge) retroarchSettings.save('video_font_enable', '"false"') # Take a screenshot of the savestate retroarchSettings.save('savestate_thumbnail_enable', '"true"') # Allow any RetroPad to control the menu (Only the player 1) retroarchSettings.save('all_users_control_menu', '"false"') # Show badges in Retroarch cheevos list retroarchSettings.save('cheevos_badges_enable', '"true"') # Disable builtin image viewer (done in ES, and prevents from loading pico-8 .png carts) retroarchSettings.save('builtin_imageviewer_enable', '"false"') retroarchSettings.write()
def generateMoonlightConfig(system): moonlightStagingConfigFile = batoceraFiles.moonlightStagingConfigFile if not os.path.exists(batoceraFiles.moonlightCustom + '/staging'): os.makedirs(batoceraFiles.moonlightCustom + '/staging') # If user made config file exists, copy to staging directory for use if os.path.exists(batoceraFiles.moonlightConfigFile): shutil.copy(batoceraFiles.moonlightConfigFile, batoceraFiles.moonlightStagingConfigFile) else: # truncate existing config and create new one f = open(moonlightStagingConfigFile, "w").close() moonlightConfig = UnixSettings(moonlightStagingConfigFile, separator=' ') # resolution if system.isOptSet('moonlight_resolution'): if system.config["moonlight_resolution"] == "0": moonlightConfig.save('width', '1280') moonlightConfig.save('height', '720') elif system.config["moonlight_resolution"] == "1": moonlightConfig.save('width', '1920') moonlightConfig.save('height', '1080') elif system.config["moonlight_resolution"] == "2": moonlightConfig.save('width', '3840') moonlightConfig.save('height', '2160') else: moonlightConfig.save('width', '1280') moonlightConfig.save('height', '720') else: moonlightConfig.save('width', '1280') moonlightConfig.save('height', '720') # framerate if system.isOptSet('moonlight_framerate'): if system.config["moonlight_framerate"] == "0": moonlightConfig.save('fps', '30') elif system.config["moonlight_framerate"] == "1": moonlightConfig.save('fps', '60') elif system.config["moonlight_framerate"] == "2": moonlightConfig.save('fps', '120') else: moonlightConfig.save('fps', '30') else: moonlightConfig.save('fps', '30') # bitrate if system.isOptSet('moonlight_bitrate'): if system.config["moonlight_bitrate"] == "0": moonlightConfig.save('bitrate', '5000') elif system.config["moonlight_bitrate"] == "1": moonlightConfig.save('bitrate', '10000') elif system.config["moonlight_bitrate"] == "2": moonlightConfig.save('bitrate', '20000') elif system.config["moonlight_bitrate"] == "3": moonlightConfig.save('bitrate', '50000') else: moonlightConfig.save('bitrate', '-1') #-1 sets Moonlight default else: moonlightConfig.save('bitrate', '-1') #-1 sets Moonlight default # codec if system.isOptSet('moonlight_codec'): if system.config["moonlight_codec"] == "0": moonlightConfig.save('codec', 'h264') elif system.config["moonlight_codec"] == "1": moonlightConfig.save('codec', 'h265') else: moonlightConfig.save('codec', 'auto') else: moonlightConfig.save('codec', 'auto') # sops (Streaming Optimal Playable Settings) if system.isOptSet('moonlight_sops'): if system.config["moonlight_sops"] == "0": moonlightConfig.save('sops', 'true') elif system.config["moonlight_sops"] == "1": moonlightConfig.save('sops', 'false') else: moonlightConfig.save('sops', 'true') else: moonlightConfig.save('sops', 'true') # quit remote app on exit if system.isOptSet('moonlight_quitapp'): if system.config["moonlight_quitapp"] == "0": moonlightConfig.save('quitappafter', 'true') else: moonlightConfig.save('quitappafter', 'false') else: moonlightConfig.save('quitappafter', 'false') # av decoder if system.isOptSet('moonlight_avdecoder'): if system.config["moonlight_avdecoder"] == "sdl": moonlightConfig.save('platform', 'sdl') ## Directory to store encryption keys moonlightConfig.save('keydir', batoceraFiles.moonlightCustom + '/keydir') moonlightConfig.write()
def generate(self, system, rom, playersControllers, gameResolution): retroconfig = UnixSettings(batoceraFiles.amiberryRetroarchCustom, separator=' ') if not os.path.exists(dirname(batoceraFiles.amiberryRetroarchCustom)): os.makedirs(dirname(batoceraFiles.amiberryRetroarchCustom)) romType = self.getRomType(rom) eslog.debug("romType: " + romType) if romType != 'UNKNOWN': commandArray = [ batoceraFiles.batoceraBins[system.config['emulator']], "-G" ] if romType != 'WHDL': commandArray.append("--model") commandArray.append(system.config['core']) if romType == 'WHDL': commandArray.append("--autoload") commandArray.append(rom) elif romType == 'HDF': commandArray.append("-s") commandArray.append("hardfile2=rw,DH0:" + rom + ",32,1,2,512,0,,uae0") commandArray.append("-s") commandArray.append("uaehf0=hdf,rw,DH0:" + rom + ",32,1,2,512,0,,uae0") elif romType == 'CD': commandArray.append("--cdimage") commandArray.append(rom) elif romType == 'DISK': # floppies n = 0 for img in self.floppiesFromRom(rom): if n < 4: commandArray.append("-" + str(n)) commandArray.append(img) n += 1 # floppy path commandArray.append("-s") # Use disk folder as floppy path romPathIndex = rom.rfind('/') commandArray.append("amiberry.floppy_path=" + rom[0:romPathIndex]) # controller libretroControllers.writeControllersConfig(retroconfig, system, playersControllers) retroconfig.write() if not os.path.exists(batoceraFiles.amiberryRetroarchInputsDir): os.makedirs(batoceraFiles.amiberryRetroarchInputsDir) nplayer = 1 for playercontroller, pad in sorted(playersControllers.items()): replacements = {'_player' + str(nplayer) + '_': '_'} # amiberry remove / included in pads names like "USB Downlo01.80 PS3/USB Corded Gamepad" padfilename = pad.realName.replace("/", "") playerInputFilename = batoceraFiles.amiberryRetroarchInputsDir + "/" + padfilename + ".cfg" with open( batoceraFiles.amiberryRetroarchCustom) as infile, open( playerInputFilename, 'w') as outfile: for line in infile: for src, target in replacements.items(): newline = line.replace(src, target) if not newline.isspace(): outfile.write(newline) if nplayer == 1: # 1 = joystick port commandArray.append("-s") commandArray.append("joyport1_friendlyname=" + padfilename) if romType == 'CD': commandArray.append("-s") commandArray.append("joyport1_mode=cd32joy") if nplayer == 2: # 0 = mouse for the player 2 commandArray.append("-s") commandArray.append("joyport0_friendlyname=" + padfilename) nplayer += 1 # fps if system.config['showFPS'] == 'true': commandArray.append("-s") commandArray.append("show_leds=true") # disable port 2 (otherwise, the joystick goes on it) commandArray.append("-s") commandArray.append("joyport2=") # remove interlace artifacts if system.isOptSet("amiberry_flickerfixer") and system.config[ 'amiberry_flickerfixer'] == 'true': commandArray.append("-s") commandArray.append("gfx_flickerfixer=true") else: commandArray.append("-s") commandArray.append("gfx_flickerfixer=false") # auto height if system.isOptSet("amiberry_auto_height") and system.config[ 'amiberry_auto_height'] == 'true': commandArray.append("-s") commandArray.append("amiberry.gfx_auto_height=true") else: commandArray.append("-s") commandArray.append("amiberry.gfx_auto_height=false") # line mode if system.isOptSet("amiberry_linemode"): if system.config['amiberry_linemode'] == 'none': commandArray.append("-s") commandArray.append("gfx_linemode=none") elif system.config['amiberry_linemode'] == 'scanlines': commandArray.append("-s") commandArray.append("gfx_linemode=scanlines") elif system.config['amiberry_linemode'] == 'double': commandArray.append("-s") commandArray.append("gfx_linemode=double") else: commandArray.append("-s") commandArray.append("gfx_linemode=double") # video resolution if system.isOptSet("amiberry_resolution"): if system.config['amiberry_resolution'] == 'lores': commandArray.append("-s") commandArray.append("gfx_resolution=lores") elif system.config['amiberry_resolution'] == 'superhires': commandArray.append("-s") commandArray.append("gfx_resolution=superhires") elif system.config['amiberry_resolution'] == 'hires': commandArray.append("-s") commandArray.append("gfx_resolution=hires") else: commandArray.append("-s") commandArray.append("gfx_resolution=hires") # Scaling method if system.isOptSet("amiberry_scalingmethod"): if system.config['amiberry_scalingmethod'] == 'automatic': commandArray.append("-s") commandArray.append("gfx_lores_mode=false") commandArray.append("-s") commandArray.append("amiberry.scaling_method=-1") elif system.config['amiberry_scalingmethod'] == 'smooth': commandArray.append("-s") commandArray.append("gfx_lores_mode=true") commandArray.append("-s") commandArray.append("amiberry.scaling_method=1") elif system.config['amiberry_scalingmethod'] == 'pixelated': commandArray.append("-s") commandArray.append("gfx_lores_mode=true") commandArray.append("-s") commandArray.append("amiberry.scaling_method=0") else: commandArray.append("-s") commandArray.append("gfx_lores_mode=false") commandArray.append("-s") commandArray.append("amiberry.scaling_method=-1") # display vertical centering commandArray.append("-s") commandArray.append("gfx_center_vertical=smart") # fix sound buffer commandArray.append("-s") commandArray.append("sound_max_buff=4096") os.chdir("/usr/share/amiberry") return Command.Command( array=commandArray, env={ "SDL_GAMECONTROLLERCONFIG": controllersConfig.generateSdlGameControllerConfig( playersControllers) }) # otherwise, unknown format return Command.Command(array=[])
def generateLinappleConfig(rom, playersControllers, gameResolution): # conf file try: linappleConfig = UnixSettings(batoceraFiles.linappleConfigFile, separator=' ') except UnicodeError: # remove it and try again os.remove(batoceraFiles.linappleConfigFile) linappleConfig = UnixSettings(batoceraFiles.linappleConfigFile, separator=' ') # Rom linappleConfig.save('Disk Image 1', rom) # Joysticks, those sticks of joy! There may be 2 joysticks at the same time # # "Joystick 0" specifies the types of first first joystick. # # Possible values are: # 0 - joystick disabled # 1 - use PC joystick #1 or #2, for corresponding joystick # 2 - Keyboard standard # 3 - Keyboard centered # 4 - Use mouse as a joystick. Rather interesting thing, try it. Useful in Fantavision(tm)by Broderbund Software # # When joysticks used as a keyboard, they are stuck to Numpad keys (1-9 - axis movement, 0 - button1, . - button2) # When centered used, axis of joystick will be centered after releasing any cursor (Numpad 1..9) key. # Otherwise it assumed to be pressed always. # # Default is 1. # # "Joystick 1" specifies the types of the second joystick. # Possible values are the same as "Joystick 0". # Default is 0. linappleConfig.save('Joystick 0', '0') linappleConfig.save('Joystick 1', '0') # For Joysticks you can define which Joystick index number, axis number, and buttons. # # Default for Joystick 1 is index 0, axis 0 and 1, buttons 0 and 1. # Default for Joystick 2 is index 1, axis 0 and 1, button 0. for indexController in playersControllers: controller = playersControllers[indexController] # Enabling control linappleConfig.save('Joy{}Index'.format(controller.index), controller.index) linappleConfig.save('Joystick {}'.format(controller.index), '1') # Button linappleConfig.save('Joy{}Button1'.format(controller.index), controller.inputs["a"].id) linappleConfig.save('Joy{}Button2'.format(controller.index), controller.inputs["b"].id) # Axis linappleConfig.save('Joy{}Axis0'.format(controller.index), controller.inputs["joystick1left"].id) linappleConfig.save('Joy{}Axis1'.format(controller.index), controller.inputs["joystick1up"].id) # Enable Quitting the program with by pressing two joystick buttons at the same time if (controller.index == 0): linappleConfig.save('JoyExitEnable', '1') linappleConfig.save('JoyExitButton0', controller.inputs["hotkey"].id) linappleConfig.save('JoyExitButton1', controller.inputs["start"].id) # Possible values are: # 0 - old Apple][, right out of the hands of Steve Wozniak and Steve Jobs in far 1977? year. # 1 - Apple][+ - same as Apple][ with somewhat enbettered functionality # 2 - Apple//e - Enhanced Apple][ with 80-column mode and other useful additions # 3 - Apple//e enhanced - currently same as Apple//e? Please, ask Tom Charlesworth about it. # # Default is 3. linappleConfig.save('Computer Emulation', '3') # "Sound Emulation" enables audio. # # Possible values are: # 0 - none # 1 - use SDL Audio for sounds # # Default is 1. linappleConfig.save('Sound Emulation', '1') # "Soundcard Type" specifies the type of sound card to use. # # Possible values are: # 1 - none (disables audio) # 2 - use Mockingboard in Slot 4 (Mockingboard is like SoundBlaster for PC, if you hear about it) # 3 - use Phasor in Slot 4. Phasor is also a sort of ancient sound cards. Ahhh, what sounds they have!!! # # Default is 2. linappleConfig.save('Soundcard Type', '2') # "Serial Port" joins your Apple][ machine to any device through serial ports. # # Possible values are: # 0 - disabled # 1 to 100 - which means device /dev/ttyS0 .. /dev/ttyS99 relatively # # Default is 0. Needs testing. linappleConfig.save('Serial Port', '0') # "Emulation Speed" controls the speed of the emulator. # # Possible values range from 0 to 40 where: # 0 - slowest # 10 - normal (about 1 MHz) # 40 - fastest # # Default is 10. linappleConfig.save('Emulation Speed', '10') # "Enhance Disk Speed" disables disk throttling. # # Possible values are: # 0 - disabled, disk spinning speed is like that of a real Apple][ # 1 - use enhanced disk speed. # # Default is 1. linappleConfig.save('Enhance Disk Speed', '1') # "Parallel Printer Filename" specifies the path to use as for printer output. # Parallel printer allows you to print any DOS3.3 or Applesoft Basic(tm) output # to specified file (after PR#1 at DOS3.3 prompt) # # Possible values are any valid path. # # Default is "Printer.txt". linappleConfig.save('Parallel Printer Filename', 'Printer.txt') # "Slot 6 Autoload" enables automatic insertion of floppy disk images. # This is analogous to inserting floppies into an Apple][ before turning it on. # # Possible values are: # 0 - disabled # 1 - enabled # # Default is 0. linappleConfig.save('Slot 6 Autoload', '1') # Save State Filename - file name for saving/loading state with keys F11 and F12 in emulator. # Default is none. Note: you can choose it at runtime by pressing F11 (for saving) or F12 (for loading) linappleConfig.save('Save State Filename', '') # SaveSate Directory is a directory where current states will be saved by using F11,F12 (or ALT+F11, ALT+F12 keys, or Ctrl+0..9, Ctrl+Shift+0..9) #Default is none, which means your home directory linappleConfig.save('Save State Directory', batoceraFiles.linapplaSaves) # "Save State On Exit" enables automatic saving of the emulator on exit. # # Possible values are: # 0 - disabled # 1 - enabled # # Default value is 0. linappleConfig.save('Save State On Exit', '0') # "Show Leds" enables displaying LEDs indicating disk access. # # Possible values are: # 0 - disabled # 1 - enabled # # Default is 1. linappleConfig.save('Show Leds', '1') # Screen properties # # Note: not all screen sizes can work in full screen mode, so be careful # Also if you are using not default mode, the speed of emulator can fall, # which can be spotted on old machines # # "Screen factor" specifies a multipler for the screen size. # # Any positive value is possible, but the suggested range is 0.3 to 3.0. # The value is a multiplier for "Screen Width" and "Screen Height". # < 1.0 will make the screen smaller # > 1.0 will make the screen larger # = 1.0 will keep the screen at 560x384 # < 0.1 will be ignored. # # Default is 0. linappleConfig.save('Screen factor', '0') # "Screen Width" specifies the horizontal size of the display. # Possible values are any positive integer. # Value is ignored if "Screen factor" is set to anything >= 0.1. # Default is 560. # # "Screen Height" specifies the vertical size of the display. # # Possible values are any positive integer. # Value is ignored if "Screen factor" is set to anything >= 0.1. # # For best results, use a height divisible by 192 to avoid moire artifacts when # using scanline video effects. # # Default is 384. linappleConfig.save('Screen Width', gameResolution["width"]) linappleConfig.save('Screen Height', gameResolution["height"]) linappleConfig.write()
def generate(self, system, rom, playersControllers, gameResolution): if not os.path.exists(CONFIGDIR): os.makedirs(CONFIGDIR) config = UnixSettings(CONFIGFILE, separator=' ') rombase=os.path.basename(rom) romext=os.path.splitext(rombase)[1] if (romext.lower() in ['.dsk', '.do', '.nib']): config.save("s6d1", rom) config.save("s5d1", '') config.save("s7d1", '') config.save("bram1[00]", '00 00 00 01 00 00 0d 06 02 01 01 00 01 00 00 00') config.save("bram1[10]", '00 00 07 06 02 01 01 00 00 00 0f 06 06 00 05 06') config.save("bram1[20]", '01 00 00 00 00 00 00 01 06 00 00 00 03 02 02 02') config.save("bram1[30]", '00 00 00 00 00 00 00 00 00 00 01 02 03 04 05 06') config.save("bram1[40]", '07 00 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d') config.save("bram1[50]", '0e 0f ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[60]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[70]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[80]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[90]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[a0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[b0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[c0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[d0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[e0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[f0]", 'ff ff ff ff ff ff ff ff ff ff ff ff fe 17 54 bd') config.save("bram3[00]", '00 00 00 01 00 00 0d 06 02 01 01 00 01 00 00 00') config.save("bram3[10]", '00 00 07 06 02 01 01 00 00 00 0f 06 00 00 05 06') config.save("bram3[20]", '01 00 00 00 00 00 00 01 00 00 00 00 05 02 02 00') config.save("bram3[30]", '00 00 2d 2d 00 00 00 00 00 00 02 02 02 06 08 00') config.save("bram3[40]", '01 02 03 04 05 06 07 0a 00 01 02 03 04 05 06 07') config.save("bram3[50]", '08 09 0a 0b 0c 0d 0e 0f 00 00 ff ff ff ff ff ff') config.save("bram3[60]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram3[70]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram3[80]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram3[90]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram3[a0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram3[b0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram3[c0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram3[d0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram3[e0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram3[f0]", 'ff ff ff ff ff ff ff ff ff ff ff ff 05 cf af 65') else: # .po and .2mg config.save("s7d1", rom) config.save("s5d1", '') config.save("s6d1", '') config.save("bram1[00]", '00 00 00 01 00 00 0d 06 02 01 01 00 01 00 00 00') config.save("bram1[10]", '00 00 07 06 02 01 01 00 00 00 0f 06 06 00 05 06') config.save("bram1[20]", '01 00 00 00 00 00 00 01 00 00 00 00 03 02 02 02') config.save("bram1[30]", '00 00 00 00 00 00 00 00 08 00 01 02 03 04 05 06') config.save("bram1[40]", '07 0a 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d') config.save("bram1[50]", '0e 0f ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[60]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[70]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[80]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[90]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[a0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[b0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[c0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[d0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[e0]", 'ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff') config.save("bram1[f0]", 'ff ff ff ff ff ff ff ff ff ff ff ff 13 24 b9 8e') config.save("bram3[00]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[10]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[20]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[30]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[40]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[50]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[60]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[70]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[80]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[90]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[a0]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[b0]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[c0]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[d0]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[e0]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("bram3[f0]", '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00') config.save("g_cfg_rom_path", batoceraFiles.BIOS) # config.save("g_limit_speed", "0") config.write() commandArray = ["GSplus", "-fullscreen"] return Command.Command( array=commandArray, env={ 'SDL_GAMECONTROLLERCONFIG': controllersConfig.generateSdlGameControllerConfig(playersControllers) })