def test_buildCmd_multidisc_psx(self): rcb_launcher = RCBLauncher() config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_imageloading.xml') conf = Config(config_xml_file) conf.readXml() gameid = 12 game = GameView(self.gdb).getObjectById(gameid) filename_rows = File(self.gdb).getRomsByGameId(game[File.COL_ID]) rcb_launcher.romCollection = conf.romCollections[str( game[GameView.COL_romCollectionId])] from xbmcgui import Dialog #select disk 1 Dialog.select_result = 0 cmd, precmd, postcmd, roms = rcb_launcher._buildCmd( RCBMockGui(), filename_rows, game, False) self.assertEquals( cmd, '"/Path/To/PSX/Emulator" "./testdata/roms/PSX\\Silent Hill (Disc 1 of 2).bin"' ) #select disk 2 Dialog.select_result = 1 cmd, precmd, postcmd, roms = rcb_launcher._buildCmd( RCBMockGui(), filename_rows, game, False) self.assertEquals( cmd, '"/Path/To/PSX/Emulator" "./testdata/roms/PSX\\Silent Hill (Disc 2 of 2).bin"' )
def launchEmu(self): Logutil.log("Begin launchEmu UIGameInfoView", util.LOG_LEVEL_INFO) launcher = RCBLauncher() launcher.launchEmu(self.gdb, self, self.selectedGameId, self.config, self.selectedGame) self.saveViewState(False) self.close() Logutil.log("End launchEmu UIGameInfoView", util.LOG_LEVEL_INFO)
def test_buildcmd_placeholders(self): rcb_launcher = RCBLauncher() config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_launchertests.xml') conf = Config(config_xml_file) conf.readXml() #%ROM% gameid = 7 game = GameView(self.gdb).getObjectById(gameid) filename_rows = File(self.gdb).getRomsByGameId(game[File.COL_ID]) rcb_launcher.romCollection = conf.romCollections[str( game[GameView.COL_romCollectionId])] cmd, precmd, postcmd, roms = rcb_launcher._buildCmd( RCBMockGui(), filename_rows, game, False) self.assertEquals( cmd, '"/Path/To/Atari2600/Emulator" "./testdata/roms/Atari 2600\\Adventure (1980) (Atari).a26"' ) # %ROMFILE% gameid = 11 game = GameView(self.gdb).getObjectById(gameid) filename_rows = File(self.gdb).getRomsByGameId(game[File.COL_ID]) rcb_launcher.romCollection = conf.romCollections[str( game[GameView.COL_romCollectionId])] cmd, precmd, postcmd, roms = rcb_launcher._buildCmd( RCBMockGui(), filename_rows, game, False) self.assertEquals(cmd, '"/Path/To/PSX/Emulator" "Bushido Blade.img"')
def test_buildCmd_foldername_as_gamename(self): rcb_launcher = RCBLauncher() config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_imageloading.xml') conf = Config(config_xml_file) conf.readXml() gameid = 1 game = GameView(self.gdb).getObjectById(gameid) filename_rows = File(self.gdb).getRomsByGameId(game[File.COL_ID]) rcb_launcher.romCollection = conf.romCollections[str( game[GameView.COL_romCollectionId])] cmd, precmd, postcmd, roms = rcb_launcher._buildCmd( RCBMockGui(), filename_rows, game, False) self.assertEquals( cmd, '"/Path/To/SNES/Emulator" -v -L /Applications/RetroArch.app/Contents/Resources/cores/bnes_libretro.dylib "./testdata/roms/SNES\Chrono Trigger\game.sfc"' )
def test_buildcmd_amiga_multidisk(self): rcb_launcher = RCBLauncher() config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_launchertests.xml') conf = Config(config_xml_file) conf.readXml() gameid = 6 game = GameView(self.gdb).getObjectById(gameid) filename_rows = File(self.gdb).getRomsByGameId(game[File.COL_ID]) rcb_launcher.romCollection = conf.romCollections[str( game[GameView.COL_romCollectionId])] cmd, precmd, postcmd, roms = rcb_launcher._buildCmd( RCBMockGui(), filename_rows, game, False) self.assertEquals( cmd, '"/Path/To/Amiga/Emulator" -0 "./testdata/roms/Amiga\MicroProse Formula One Grand Prix_Disk 1.adf" -1 "./testdata/roms/Amiga\MicroProse Formula One Grand Prix_Disk 2.adf" -2 "./testdata/roms/Amiga\MicroProse Formula One Grand Prix_Disk 3.adf" -3 "./testdata/roms/Amiga\MicroProse Formula One Grand Prix_Disk 4.adf"' )
def test_buildCmd_multidisc(self): rcb_launcher = RCBLauncher() config_xml_file = os.path.join(os.path.dirname(__file__), 'testdata', 'config', 'romcollections_imageloading.xml') conf = Config(config_xml_file) conf.readXml() gameid = 6 game = GameView(self.gdb).getObjectById(gameid) filename_rows = File(self.gdb).getRomsByGameId(game[File.COL_ID]) rcb_launcher.romCollection = conf.romCollections[str( game[GameView.COL_romCollectionId])] from xbmcgui import Dialog #select disk 1 Dialog.select_result = 0 cmd, precmd, postcmd, roms = rcb_launcher._buildCmd( RCBMockGui(), filename_rows, game, False) self.assertEquals( cmd, '"/Path/To/Amiga/Emulator" "./testdata/roms/Amiga\MicroProse Formula One Grand Prix_Disk 1.adf"' ) #select disk 2 Dialog.select_result = 1 cmd, precmd, postcmd, roms = rcb_launcher._buildCmd( RCBMockGui(), filename_rows, game, False) self.assertEquals( cmd, '"/Path/To/Amiga/Emulator" "./testdata/roms/Amiga\MicroProse Formula One Grand Prix_Disk 2.adf"' ) #select disk 3 Dialog.select_result = 2 cmd, precmd, postcmd, roms = rcb_launcher._buildCmd( RCBMockGui(), filename_rows, game, False) self.assertEquals( cmd, '"/Path/To/Amiga/Emulator" "./testdata/roms/Amiga\MicroProse Formula One Grand Prix_Disk 3.adf"' ) #select disk 4 Dialog.select_result = 3 cmd, precmd, postcmd, roms = rcb_launcher._buildCmd( RCBMockGui(), filename_rows, game, False) self.assertEquals( cmd, '"/Path/To/Amiga/Emulator" "./testdata/roms/Amiga\MicroProse Formula One Grand Prix_Disk 4.adf"' )
def launchGame(self, param): import util from launcher import RCBLauncher from gamedatabase import GameDataBase from config import Config gdb = GameDataBase(util.getAddonDataPath()) gdb.connect() #HACK if invoked from widget addon there is an additional ? in param param = param.replace('?', '') gameId = int(param.replace('launchid=', '')) config = Config(None) config.readXml() gui = dummyGUI() RCBLauncher().launchEmu(gdb, gui, gameId, config, None)