def test_on_hat(self):
     val = libretroControllers.getConfigValue(
         controllersConfig.Input("down", "hat", "2", "1"))
     self.assertEquals("h2up", val)
     val = libretroControllers.getConfigValue(
         controllersConfig.Input("down", "hat", "3", "8"))
     self.assertEquals("h3left", val)
 def test_on_key(self):
     val = libretroControllers.getConfigValue(
         controllersConfig.Input("down", "key", "2", "1"))
     self.assertEquals("2", val)
     val = libretroControllers.getConfigValue(
         controllersConfig.Input("down", "key", "3", "8"))
     self.assertEquals("3", val)
 def test_on_axis(self):
     val = libretroControllers.getConfigValue(
         controllersConfig.Input("down", "axis", "10", "1"))
     self.assertEquals("+10", val)
     val = libretroControllers.getConfigValue(
         controllersConfig.Input("down", "axis", "10", "-1"))
     self.assertEquals("-10", val)
Exemple #4
0
    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
Exemple #5
0
# Injecting test recalbox.conf
libretroControllers.settingsRoot = os.path.abspath(
    os.path.join(os.path.dirname(__file__), "tmp"))
# Injecting test es_input
controllersConfig.esInputs = os.path.abspath(
    os.path.join(os.path.dirname(__file__), "tmp/es_input.cfg"))

# Injecting test retroarch.conf
libretroSettingsFile = os.path.abspath(
    os.path.join(os.path.dirname(__file__), "tmp/retroarchcustom.cfg"))
libretroSettings = unixSettings.UnixSettings(libretroSettingsFile, ' ')
libretroControllers.libretroSettings = libretroSettings

# Test objects
basicInputs1 = {
    'a': controllersConfig.Input("a", "button", "10", "1"),
    'start': controllersConfig.Input("start", "button", "11", "1")
}
basicController1 = controllersConfig.Controller("contr1", "joypad", "GUID1",
                                                '1', 0, "Joypad1RealName",
                                                basicInputs1)
basicController2 = controllersConfig.Controller("contr2", "joypad", "GUID2",
                                                '2', 1, "Joypad2RealName",
                                                basicInputs1)
basicController3 = controllersConfig.Controller("contr3", "joypad", "GUID3",
                                                '3', 2, "Joypad3RealName",
                                                basicInputs1)
basicController4 = controllersConfig.Controller("contr4", "joypad", "GUID4",
                                                '4', 3, "Joypad4RealName",
                                                basicInputs1)
controllers4 = {
Exemple #6
0
sys.path.append(
    os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")))

import configgen.generators.libretro.libretroControllers as libretroControllers
import configgen.controllersConfig as controllersConfig
from configgen.Emulator import Emulator
# Cloning config files
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(
 def test_on_button(self):
     val = libretroControllers.getConfigValue(
         controllersConfig.Input("a", "button", "10", "1"))
     self.assertEquals("10", val)
                     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",
                                                "0", "Joypad1RealName",
                                                basicInputs1)

rom = "MyRom.zip"

# Injecting test files
fba2xGenerator.rhgamestationFiles.fbaCustom = FBA2X_CUSTOM_CFG_FILE
fba2xGenerator.rhgamestationFiles.fbaCustomOrigin = FBA2X_ORIGIN_CFG_FILE
fba2xGenerator.fba2xConfig.fbaSettings = unixSettings.UnixSettings(
    FBA2X_CUSTOM_CFG_FILE)
fba2xGenerator.fba2xControllers.fbaSettings = unixSettings.UnixSettings(
    FBA2X_CUSTOM_CFG_FILE)
import shutil

sys.path.append(
    os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")))

import configgen.generators.fba2x.fba2xControllers as fba2xControllers
import configgen.settings.unixSettings as unixSettings
import configgen.controllersConfig as controllersConfig

fba2xCustom = os.path.abspath(os.path.join(os.path.dirname(__file__), 'tmp/fba2x.cfg'))

# Injecting test rhgamestation.conf
controllersConfig.esInputs = os.path.abspath(os.path.join(os.path.dirname(__file__), "tmp/es_input.cfg"))

# Test objects
basicInputs1 = {'a': controllersConfig.Input("a", "button", "10", "1", "0"),'hotkey': controllersConfig.Input("hotkey", "button", "10", "1", "0")}
basicController1 = controllersConfig.Controller("contr1", "joypad", "GUID1", '1', "2", "Joypad1RealName", basicInputs1)
PS3UUID = "060000004c0500006802000000010000"
GPIOUUID = "15000000010000000100000000010000"
MICROSOFT = "030000005e0400008e02000014010000"


class TestFba2xController(unittest.TestCase):
    def setUp(self):
        # Cloning config files
        shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../resources/es_input.cfg.origin")), \
                        os.path.abspath(os.path.join(os.path.dirname(__file__), "tmp/es_input.cfg")))
        shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/fba2x.cfg.origin')), \
                        fba2xCustom)
        # Injecting test file
# 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.recalboxFiles.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()


class TestMupenControllers(unittest.TestCase):
    def test_write_hotkey(self):
        mupenControllers.writeControllersConfig(basicControllers)
        self.assertEquals(mupenControllers.mupenSettings.load("Joy Mapping Stop"), 'J0B10')

    def test_commandline_core_n64(self):
        command = mupenGen.generate(n64, "rom.n64", basicControllers)
        self.assertEquals(command.array,
                          ['mupen64plus', '--corelib', '/usr/lib/libmupen64plus.so.2.0.0', '--gfx',
Exemple #11
0
    os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")))

import configgen.generators.fba2x.fba2xControllers as fba2xControllers
import configgen.settings.unixSettings as unixSettings
import configgen.controllersConfig as controllersConfig

fba2xCustom = os.path.abspath(
    os.path.join(os.path.dirname(__file__), 'tmp/fba2x.cfg'))

# Injecting test recalbox.conf
controllersConfig.esInputs = os.path.abspath(
    os.path.join(os.path.dirname(__file__), "tmp/es_input.cfg"))

# Test objects
basicInputs1 = {
    'a': controllersConfig.Input("a", "button", "10", "1"),
    'hotkey': controllersConfig.Input("hotkey", "button", "10", "1")
}
basicController1 = controllersConfig.Controller("contr1", "joypad", "GUID1",
                                                '1', "2", "Joypad1RealName",
                                                basicInputs1)
PS3UUID = "060000004c0500006802000000010000"
GPIOUUID = "15000000010000000100000000010000"
MICROSOFT = "030000005e0400008e02000014010000"


class TestFba2xController(unittest.TestCase):
    def setUp(self):
        # Cloning config files
        shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../resources/es_input.cfg.origin")), \
                        os.path.abspath(os.path.join(os.path.dirname(__file__), "tmp/es_input.cfg")))