mirror of
https://github.com/marcriera/ddgo-converter.git
synced 2025-05-15 03:17:05 +02:00
Remove config, UI improvements
This commit is contained in:
parent
8c875d3b8d
commit
b6a1a9f5bb
7 changed files with 49 additions and 48 deletions
|
@ -1,27 +0,0 @@
|
|||
import json
|
||||
|
||||
class ConfigHandler:
|
||||
def __init__(self, path):
|
||||
super().__init__()
|
||||
|
||||
self._path = path
|
||||
self._config = []
|
||||
self.load()
|
||||
|
||||
def load(self):
|
||||
try:
|
||||
with open(self._path, 'r') as f:
|
||||
self._config = json.load(f)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def save(self):
|
||||
with open(self._path, 'w') as f:
|
||||
json.dump(self._config, f, indent = 4)
|
||||
|
||||
def get_config(self, hash):
|
||||
return None
|
||||
|
||||
def set_config(self, hash, data):
|
||||
return
|
||||
|
|
@ -2,17 +2,6 @@ from enum import Enum
|
|||
from evdev import InputDevice, list_devices, ecodes as e, UInput, AbsInfo
|
||||
from hashlib import sha1
|
||||
|
||||
class GamepadHandler:
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def find_gamepads():
|
||||
gamepads = []
|
||||
devices = [InputDevice(path) for path in list_devices()]
|
||||
for device in devices:
|
||||
gamepads.append(Gamepad(device.info.vendor, device.info.product, device.name))
|
||||
return gamepads
|
||||
|
||||
class Gamepad:
|
||||
|
||||
class GamepadType(Enum):
|
||||
|
@ -40,12 +29,39 @@ class Gamepad:
|
|||
hash = sha1(str(self.id + ":" + self.name).encode('utf-8')).hexdigest()
|
||||
return hash
|
||||
|
||||
def _get_gamepad_type(self):
|
||||
def get_gamepad_type(self):
|
||||
match self.vid, self.pid:
|
||||
case 0x0f0d, 0x00c1:
|
||||
return self.GamepadType.NSWITCH
|
||||
return self.GamepadType.UNKNOWN
|
||||
|
||||
class EmulatedGamepad:
|
||||
|
||||
class GamepadType(Enum):
|
||||
DGOC44U = 0
|
||||
PS1 = 1
|
||||
|
||||
def __init__(self, type):
|
||||
super().__init__()
|
||||
self.type = type
|
||||
|
||||
class GamepadHandler:
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def find_gamepads():
|
||||
gamepads = []
|
||||
devices = [InputDevice(path) for path in list_devices()]
|
||||
for device in devices:
|
||||
gamepads.append(Gamepad(device.info.vendor, device.info.product, device.name))
|
||||
return gamepads
|
||||
|
||||
def start_gamepad_emulator(gamepad: Gamepad, emulated_gamepad: EmulatedGamepad):
|
||||
realtype = gamepad.type
|
||||
emutype = emulated_gamepad.type
|
||||
print(str(realtype)+str(emutype))
|
||||
|
||||
|
||||
""" cap = {
|
||||
e.EV_KEY : [e.BTN_NORTH, e.BTN_SOUTH, e.BTN_EAST, e.BTN_WEST, e.BTN_SELECT, e.BTN_START],
|
||||
e.EV_ABS : [(e.ABS_X, AbsInfo(0, 0, 255, 0, 0, 0)), (e.ABS_Y, AbsInfo(0, 0, 255, 0, 0, 0))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue