def setUp(self): self.snes = Emulator(name='snes', videomode='4', core='pocketsnes', shaders='', ratio='16/9', smooth='2', rewind='false', emulator='libretro') self.wswan = Emulator(name='wswan', videomode='4', core='wswan', shaders='defaultshaders', ratio='16/9', smooth='2', rewind='false', emulator='libretro') generators.configManager.recalboxFiles.shaderPresetRoot = os.path.abspath(os.path.join(os.path.dirname(__file__), "tmp/")) generators.configManager.recalboxFiles.recalboxConf = recalboxConf self.manager = ConfigManager()
def setUp(self): self.snes = Emulator(name='snes', videomode='4', core='pocketsnes', shaders='', ratio='auto', smooth='2', rewind='false', emulator='libretro') self.snes2 = Emulator(name='snes', videomode='4', core='pocketsnes', shaders='', ratio='auto', smooth='2', rewind='false', emulator='libretro') self.nes = Emulator(name='nes', videomode='6', core='catsfc', shaders='', ratio='16/9', smooth='1', rewind='false', configfile='/myconfigfile.cfg', emulator='libretro') # test inputs self.basicInputs1 = { 'hotkey': controllersConfig.Input("hotkey", "button", "10", "1", "") } self.basicController1 = controllersConfig.Controller( "contr1", "joypad", "GUID1", 1, 0, "Joypad1RealName", self.basicInputs1) self.sdl2controler = controllersConfig.Controller( "contr1", "joypad", "030000003512000012ab000010010000", 2, 1, "Bluetooth Wireless Controller ", self.basicInputs1) self.controllers = dict() self.controllers['1'] = self.basicController1 self.sdl2controllers = dict() self.sdl2controllers['1'] = self.basicController1 self.sdl2controllers['2'] = self.sdl2controler
"3": basicController3, "4": basicController4 } controllers2 = {"1": basicController1, "2": basicController2} controllers2weird = {"3": basicController4, "2": basicController3} controllers4reversed = { "1": basicController4, "2": basicController3, "3": basicController2, "4": basicController1 } snes = Emulator(name='snes', videomode='4', core='pocketsnes', shaders='', ratio='auto', smooth='2', rewind='false', emulator='libretro') class TestLibretro4ControllerIndex(unittest.TestCase): def test_4_controller(self): val = libretroControllers.writeControllersConfig(snes, controllers4) self.assertEquals(libretroSettings.load("input_player1_joypad_index"), "0") self.assertEquals(libretroSettings.load("input_player2_joypad_index"), "1") self.assertEquals(libretroSettings.load("input_player3_joypad_index"), "2") self.assertEquals(libretroSettings.load("input_player4_joypad_index"),
shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../resources/retroarchcustom.cfg.origin")), \ os.path.abspath(os.path.join(os.path.dirname(__file__), "tmp/retroarchcustom.cfg"))) # Injecting test retroarchroot libretroControllers.settingsRoot = os.path.abspath( os.path.join(os.path.dirname(__file__), "tmp")) onlyBtnsInputs = {'up': controllersConfig.Input("up", "button", "1", "1", "0")} onlyHatsInputs = {'up': controllersConfig.Input("up", "hat", "1", "1", "0")} onlyAxisInputs = {'up': controllersConfig.Input("up", "axis", "1", "1", "0")} axisAndBtnsInputs = { 'up': controllersConfig.Input("up", "button", "1", "1", "0"), 'joystickup': controllersConfig.Input("up", "axis", "1", "1", "0") } snes = Emulator('snes', 'snes', 'libretro') psx = Emulator('psx', 'psx', 'libretro') # Test the padtype settings class TestLibretroAnalogMode(unittest.TestCase): def test_padtype_only_btn(self): basicControllerBTN = controllersConfig.Controller( "contr1", "joypad", "GUID1", '1', "0", "Joypad1RealName", onlyBtnsInputs) padtype = libretroControllers.getAnalogMode(basicControllerBTN, snes) self.assertEqual("1", padtype) def test_padtype_only_joystick(self): basicController = controllersConfig.Controller("contr1", "joypad", "GUID1", '1', "0",
os.path.join(os.path.dirname(__file__), "tmp/es_input.cfg")) # Injecting retroarch configuration libretroControllers.coreSettings = UnixSettings(RETROARCH_CORE_CONFIG, separator=' ') # Test objects basicInputs1 = { 'a': controllersConfig.Input("a", "button", "10", "1"), 'hotkey': controllersConfig.Input("hotkey", "button", "10", "1"), 'start': controllersConfig.Input("start", "button", "11", "1") } basicController1 = Controller("contr1", "joypad", "GUID1", '1', "0", "Joypad1RealName", basicInputs1) PS3UUID = "060000004c0500006802000000010000" GPIOUUID = "15000000010000000100000000010000" snes = Emulator('snes', 'snes', 'libretro') class TestLibretroController(unittest.TestCase): def test_generate_simple_controller(self): config = libretroControllers.generateControllerConfig(basicController1) self.assertEquals(config['input_player1_a_btn'], '10') def test_generate_ps3_controller_buttons(self): controllers = controllersConfig.loadControllerConfig( 0, PS3UUID, "p1controller", "", -1, 0, "p2controller", "", -1, 0, "p3controller", "", -1, 0, "p4controller", "") config = libretroControllers.generateControllerConfig(controllers["1"]) self.assertEquals(config['input_player1_select_btn'], '0') self.assertEquals(config['input_player1_a_btn'], '13') self.assertEquals(config['input_player1_start_btn'], '3')
FBA2X_ORIGIN_CFG_FILE = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/fba2x.cfg.origin')) FBA2X_CUSTOM_CFG_FILE = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/fba2x.cfg')) RHGAMESTATION_CFG_FILE = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/rhgamestation.conf')) # Cloning config files shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/fba2x.cfg.origin')), \ FBA2X_ORIGIN_CFG_FILE) # test Systems fbaSystem = Emulator(name='fba', videomode='4', shaders='', ratio='auto', smooth='2', emulator='fba2x') fbaSystemCustom = Emulator(name='fba', videomode='6', shaders='', ratio='auto', smooth='2', emulator='fba2x', configfile='lol') # test inputs basicInputs1 = { 'hotkey': controllersConfig.Input("hotkey", "button", "10", "1", "0") } basicController1 = controllersConfig.Controller("contr1", "joypad", "GUID1",
recalboxConfFile = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/recalbox.conf')) # Cloning config files shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/retroarchcustom.cfg.origin')), \ retroarchcustomFile) shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/recalbox.conf.origin')), \ recalboxConfFile) libretroSettings = unixSettings.UnixSettings(retroarchcustomFile, ' ') # test Systems snes = Emulator(name='snes', videomode='4', core='pocketsnes', shaders='', ratio='auto', smooth='2', rewind='false', emulator='libretro') nes = Emulator(name='nes', videomode='4', core='pocketsnes', shaders='', ratio='16/9', smooth='1', rewind='false', emulator='libretro') nes43 = Emulator(name='nes', videomode='4', core='pocketsnes', shaders='myshaders.gpslp',
# Cloning config files shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/mupen64plus.cfg')), \ MUPEN_CUSTOM_CFG_FILE) # Injecting test files mupenControllers.rhgamestationFiles.mupenCustom = MUPEN_CUSTOM_CFG_FILE mupenControllers.mupenSettings = unixSettings.UnixSettings( MUPEN_CUSTOM_CFG_FILE, separator=' ') # test Systems n64 = Emulator(name='n64', videomode='4', core='n64', shaders='', ratio='auto', smooth='2', rewind='false', emulator='mupen64plus') # test inputs basicInputs1 = { 'hotkey': controllersConfig.Input("hotkey", "button", "10", "1") } basicController1 = controllersConfig.Controller("contr1", "joypad", "GUID1", '1', "0", "Joypad1RealName", basicInputs1) basicControllers = dict() basicControllers['1'] = basicController1 mupenGen = MupenGenerator()
import configgen.generators.fba2x.fba2xConfig as fba2xConfig import configgen.settings.unixSettings as unixSettings fba2xCustom = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/fba2x.cfg')) # Cloning config files shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/fba2x.cfg.origin')), \ fba2xCustom) fbaSettings = unixSettings.UnixSettings(fba2xCustom) # test Systems fba2xNormal = Emulator(name='fba', videomode='4', ratio='auto', smooth='1', emulator='fba2x') fba2x43 = Emulator(name='fba', videomode='4', ratio='4/3', smooth='0', shaders='scanlines', emulator='fba2x') fba2x169 = Emulator(name='fba', videomode='4', ratio='16/9', emulator='fba2x') class TestFBAConfig(unittest.TestCase): def setUp(self): # Injecting test file fba2xConfig.fbaSettings = fbaSettings