GUID identification used to determine gamepad. /JL

This commit is contained in:
2025-05-06 20:47:01 +02:00
parent e99f8f761c
commit e02148c937
20 changed files with 287 additions and 204 deletions

View File

@@ -1,5 +1,5 @@
from pygameControls.controlsbase import ControlsBase
from enums import ConnectionType
from .enums import ConnectionType
from pydualsense import *
BATTERY_STATE = {
@@ -12,12 +12,11 @@ BATTERY_STATE = {
}
class DualSenseController(ControlsBase):
def __init__(self, joy, connection_type):
def __init__(self, joy):
self.device = pydualsense()
self.device.init()
self.name = self.device.device.get_product_string()
self.guid = self.device.get_guid()
self.connection_type = ConnectionType(connection_type.values())
self.powerlevel = self.device.battery.Level
self.batterystate = BATTERY_STATE[str(self.device.battery.State)]
self.set_player_id(PlayerID.PLAYER_1)
@@ -43,7 +42,6 @@ class DualSenseController(ControlsBase):
print(f"{self.name} connected")
print(f"Power level: {self.powerlevel}")
print(f"Battery state: {self.batterystate}")
print(f"Connection type: {connection_type.capitalize()}")
def close(self):
self.device.close()