def generate(self, system, rom, playersControllers):
        # Settings recalbox default config file if no user defined one
        if not system.config['configfile']:
            # Using recalbox config file
            system.config['configfile'] = recalboxFiles.retroarchCustom
            # Create retroarchcustom.cfg if does not exists
            if not os.path.isfile(recalboxFiles.retroarchCustom):
                shutil.copyfile(recalboxFiles.retroarchCustomOrigin,
                                recalboxFiles.retroarchCustom)
            #  Write controllers configuration files
            libretroControllers.writeControllersConfig(system,
                                                       playersControllers)
            # Write configuration to retroarchcustom.cfg
            libretroConfig.writeLibretroConfig(system)

        # Retroarch core on the filesystem
        retroarchCore = recalboxFiles.retroarchCores + system.config[
            'core'] + recalboxFiles.libretroExt

        # the command to run
        commandline = '{} -L "{}" --config "{}" "{}"'.format(
            recalboxFiles.retroarchBin, retroarchCore,
            system.config['configfile'], rom)

        commandArray = [
            recalboxFiles.retroarchBin, "-L", retroarchCore, "--config",
            system.config['configfile'], rom
        ]
        return Command.Command(videomode=system.config['videomode'],
                               array=commandArray)
    def generate(self, system, rom, playersControllers):
        # Settings recalbox default config file if no user defined one
        if not system.config['configfile']:
            # Using recalbox config file
            system.config['configfile'] = recalboxFiles.retroarchCustom
            # Create retroarchcustom.cfg if does not exists
            shutil.copyfile(recalboxFiles.retroarchCustomOrigin, recalboxFiles.retroarchCustom)
            #  Write controllers configuration files
            libretroControllers.writeControllersConfig(system, playersControllers)
            # Write configuration to retroarchcustom.cfg
            libretroConfig.writeLibretroConfig(system)

        # Retroarch core on the filesystem
        retroarchCore = recalboxFiles.retroarchCores + system.config['core'] + recalboxFiles.libretroExt

        # the command to run
        commandline = '{} -L "{}" --config "{}" "{}"'.format(recalboxFiles.retroarchBin, retroarchCore, system.config['configfile'], rom)
        return Command.Command(videomode=system.config['videomode'], commandline=commandline)
    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)

        # 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']
            ]
        elif system.name == 'dos':
            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']
            ]

        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:
            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':
                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 == 'dos':
            rom = 'set ROOT=' + rom

        commandArray.append(rom)
        return Command.Command(array=commandArray)
Beispiel #4
0
    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):
                shutil.copyfile(batoceraFiles.retroarchCustomOrigin,
                                batoceraFiles.retroarchCustom)
            #  Write controllers configuration files
            retroconfig = UnixSettings(batoceraFiles.retroarchCustom,
                                       separator=' ')
            libretroControllers.writeControllersConfig(retroconfig, system,
                                                       playersControllers)
            # 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)

        # 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-fba) it is necessary to add the parameter: --subsystem neocd
        if system.name == 'neogeocd' and system.config['core'] == "fba":
            commandArray = [
                batoceraFiles.batoceraBins[system.config['emulator']], "-L",
                retroarchCore, "--subsystem", "neocd", "--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)

        # Generate the append
        if configToAppend:
            commandArray.extend(["--appendconfig", "|".join(configToAppend)])

        # Netplay mode
        if 'netplaymode' in system.config:
            if system.config['netplaymode'] == 'host':
                commandArray.append("--host")
            elif system.config['netplaymode'] == 'client':
                commandArray.extend(
                    ["--connect", system.config['netplay.server.address']])

        commandArray.append(rom)
        return Command.Command(array=commandArray)
    def generate(self, system, rom, playersControllers):
        # Settings recalbox default config file if no user defined one
        if not system.config['configfile']:
            # Using recalbox config file
            system.config['configfile'] = recalboxFiles.retroarchCustom
            # Create retroarchcustom.cfg if does not exists
            if not os.path.isfile(recalboxFiles.retroarchCustom):
                shutil.copyfile(recalboxFiles.retroarchCustomOrigin,
                                recalboxFiles.retroarchCustom)
            #  Write controllers configuration files
            libretroControllers.writeControllersConfig(system,
                                                       playersControllers)
            # Write configuration to retroarchcustom.cfg
            libretroConfig.writeLibretroConfig(system, playersControllers)

        # Retroarch core on the filesystem
        retroarchCore = recalboxFiles.retroarchCores + system.config[
            'core'] + recalboxFiles.libretroExt
        romName = os.path.basename(rom)

        # the command to run
        commandArray = [
            recalboxFiles.recalboxBins[system.config['emulator']], "-L",
            retroarchCore, "--config", system.config['configfile']
        ]
        configToAppend = []

        # Custom configs - per core
        customCfg = "{}/{}.cfg".format(recalboxFiles.retroarchRoot,
                                       system.name)
        if os.path.isfile(customCfg):
            configToAppend.append(customCfg)

        # Custom configs - per game
        customGameCfg = "{}/{}/{}.cfg".format(recalboxFiles.retroarchRoot,
                                              system.name, romName)
        if os.path.isfile(customGameCfg):
            configToAppend.append(customGameCfg)

        # Overlay management
        overlayFile = "{}/{}/{}.cfg".format(recalboxFiles.OVERLAYS,
                                            system.name, romName)
        if os.path.isfile(overlayFile):
            configToAppend.append(overlayFile)

        # Generate the append
        if configToAppend:
            commandArray.extend(["--appendconfig", "|".join(configToAppend)])

        # Netplay mode
        if 'netplaymode' in system.config:
            if system.config['netplaymode'] == 'host':
                commandArray.append("--host")
            elif system.config['netplaymode'] == 'client':
                commandArray.extend(
                    ["--connect", system.config['netplay.server.address']])

        # Optionnal arguments
        if 'args' in system.config and system.config['args'] is not None:
            commandArray.extend(system.config['args'])

        commandArray.append(rom)
        return Command.Command(videomode=system.config['videomode'],
                               array=commandArray)
Beispiel #6
0
    def generate(self, system, rom, playersControllers, gameResolution):
        # Settings gamestation default config file if no user defined one
        if not 'configfile' in system.config:
            # Using gamestation config file
            system.config['configfile'] = gamestationFiles.retroarchCustom
            # Create retroarchcustom.cfg if does not exists
            if not os.path.isfile(gamestationFiles.retroarchCustom):
                shutil.copyfile(gamestationFiles.retroarchCustomOrigin,
                                gamestationFiles.retroarchCustom)
            #  Write controllers configuration files
            retroconfig = UnixSettings(gamestationFiles.retroarchCustom,
                                       separator=' ')
            libretroControllers.writeControllersConfig(retroconfig, system,
                                                       playersControllers)
            # Write configuration to retroarchcustom.cfg
            if 'bezel' not in system.config or system.config['bezel'] == '':
                bezel = None
            else:
                bezel = system.config['bezel']
            libretroConfig.writeLibretroConfig(retroconfig, system,
                                               playersControllers, rom, bezel,
                                               gameResolution)

        # Retroarch core on the filesystem
        retroarchCore = gamestationFiles.retroarchCores + system.config[
            'core'] + gamestationFiles.libretroExt
        romName = os.path.basename(rom)

        # the command to run
        commandArray = [
            gamestationFiles.gamestationBins[system.config['emulator']], "-L",
            retroarchCore, "--config", system.config['configfile']
        ]
        configToAppend = []

        # Custom configs - per core
        customCfg = "{}/{}.cfg".format(gamestationFiles.retroarchRoot,
                                       system.name)
        if os.path.isfile(customCfg):
            configToAppend.append(customCfg)

        # Custom configs - per game
        customGameCfg = "{}/{}/{}.cfg".format(gamestationFiles.retroarchRoot,
                                              system.name, romName)
        if os.path.isfile(customGameCfg):
            configToAppend.append(customGameCfg)

        # Overlay management
        overlayFile = "{}/{}/{}.cfg".format(gamestationFiles.OVERLAYS,
                                            system.name, romName)
        if os.path.isfile(overlayFile):
            configToAppend.append(overlayFile)

        # Generate the append
        if configToAppend:
            commandArray.extend(["--appendconfig", "|".join(configToAppend)])

        # Netplay mode
        if 'netplaymode' in system.config:
            if system.config['netplaymode'] == 'host':
                commandArray.append("--host")
            elif system.config['netplaymode'] == 'client':
                commandArray.extend(
                    ["--connect", system.config['netplay.server.address']])

        commandArray.append(rom)
        return Command.Command(array=commandArray)
    def generate(self, system, rom, playersControllers):
        # Settings rhgamestation default config file if no user defined one
        if not system.config['configfile']:
            # Using rhgamestation config file
            system.config['configfile'] = rhgamestationFiles.retroarchCustom
            # Create retroarchcustom.cfg if does not exists
            if not os.path.isfile(rhgamestationFiles.retroarchCustom):
                shutil.copyfile(rhgamestationFiles.retroarchCustomOrigin, rhgamestationFiles.retroarchCustom)
            #  Write controllers configuration files
            libretroControllers.writeControllersConfig(system, playersControllers)
            # Write configuration to retroarchcustom.cfg
            libretroConfig.writeLibretroConfig(system, playersControllers)

        # Retroarch core on the filesystem
        retroarchCore = rhgamestationFiles.retroarchCores + system.config['core'] + rhgamestationFiles.libretroExt
        romName = os.path.basename(rom)

        # the command to run
        commandArray = [rhgamestationFiles.rhgamestationBins[system.config['emulator']], "-L", retroarchCore, "--config", system.config['configfile']]
        configToAppend = []
        
        # Custom configs - per core
        customCfg = "{}/{}.cfg".format(rhgamestationFiles.retroarchRoot, system.name)
        if os.path.isfile(customCfg):
            configToAppend.append(customCfg)
        
        # Custom configs - per game
        customGameCfg = "{}/{}/{}.cfg".format(rhgamestationFiles.retroarchRoot, system.name, romName)
        if os.path.isfile(customGameCfg):
            configToAppend.append(customGameCfg)
        
        # Overlay management
        overlayFile = "{}/{}/{}.cfg".format(rhgamestationFiles.OVERLAYS, system.name, romName)
        if os.path.isfile(overlayFile):
            configToAppend.append(overlayFile)
        
        # Generate the append
        if configToAppend:
            commandArray.extend(["--appendconfig", "|".join(configToAppend)])
            
         # Netplay mode
        if 'netplaymode' in system.config and system.config['netplaymode'] is not None and system.config['netplaymode'] in ('host', 'client'):
            if system.config['netplaymode'] == 'host':
                commandArray.append("--host")
		if system.config['hash']:
		    commandArray.extend(["--hash", system.config['hash']])
	    elif system.config['netplaymode'] == 'client':
                if system.config['netplay_ip'] is not None:
                    commandArray.extend(["--connect", system.config['netplay_ip']])
		else:
		    raise ValueError("You must specify n IP in client mode")
	    else:
		raise ValueError("Netplay mode should be host or client")
	    port = system.config.get('netplay_port', "55435")
	    commandArray.extend(["--port", port])
	    nick = system.config['netplay_nickname'] if system.config['netplay_nickname'] else "Anonymous"
	    commandArray.extend(["--nick", nick])

        # Optionnal arguments
        if 'args' in system.config and system.config['args'] is not None:
             commandArray.extend(system.config['args'])
             
        commandArray.append(rom)
        return Command.Command(videomode=system.config['videomode'], array=commandArray)