示例#1
0
文件: wine.py 项目: Ryochan7/lutris
    def setup_x360ce(self, x360ce_path):
        if not os.path.isdir(x360ce_path):
            logger.error("%s is not a valid path for x360ce", x360ce_path)
            return
        mode = 'dumbxinputemu' if self.runner_config.get(
            'dumbxinputemu') else 'x360ce'
        dll_files = ['xinput1_3.dll']
        if self.runner_config.get('x360ce-xinput9'):
            dll_files.append('xinput9_1_0.dll')

        for dll_file in dll_files:
            xinput_dest_path = os.path.join(x360ce_path, dll_file)
            xinput_arch = self.runner_config.get(
                'xinput-arch') or self.wine_arch
            dll_path = os.path.join(
                datapath.get(), 'controllers/{}-{}'.format(mode, xinput_arch))
            if not os.path.exists(xinput_dest_path):
                source_file = dll_file if mode == 'dumbxinputemu' else 'xinput1_3.dll'
                shutil.copyfile(os.path.join(dll_path, source_file),
                                xinput_dest_path)

        if mode == 'x360ce':
            if self.runner_config.get('x360ce-dinput'):
                dinput8_path = os.path.join(dll_path, 'dinput8.dll')
                dinput8_dest_path = os.path.join(x360ce_path, 'dinput8.dll')
                shutil.copyfile(dinput8_path, dinput8_dest_path)

            x360ce_config = X360ce()
            x360ce_config.populate_controllers()
            x360ce_config.write(os.path.join(x360ce_path, 'x360ce.ini'))
示例#2
0
文件: wine.py 项目: notjuliee/lutris
    def setup_x360ce(self, x360ce_path):
        if not os.path.isdir(x360ce_path):
            logger.error("%s is not a valid path for x360ce", x360ce_path)
            return
        xinput_dest_path = os.path.join(x360ce_path, 'xinput1_3.dll')
        dll_path = os.path.join(datapath.get(), 'controllers/x360ce-{}'.format(self.wine_arch))
        if not os.path.exists(xinput_dest_path):
            xinput1_3_path = os.path.join(dll_path, 'xinput1_3.dll')
            shutil.copyfile(xinput1_3_path, xinput_dest_path)
        if self.runner_config.get('x360ce-dinput') and self.wine_arch == 'win32':
            dinput8_path = os.path.join(dll_path, 'dinput8.dll')
            dinput8_dest_path = os.path.join(x360ce_path, 'dinput8.dll')
            shutil.copyfile(dinput8_path, dinput8_dest_path)

        x360ce_config = X360ce()
        x360ce_config.populate_controllers()
        x360ce_config.write(os.path.join(x360ce_path, 'x360ce.ini'))