ObjFW  All files named "src/hid/platform/Linux/OFGameController.m"

History for src/hid/platform/Linux/OFGameController.m

2024-05-15
22:50
Renamed to src/hid/OFEvdevGameController.m. OFGameController: Use different subclasses check-in: [4ecdef7491] user: js, branch: gamecontroller, size: 0
21:34
OFGameController: Add mapping for DualShock 4 file: [9e75f36cc8] check-in: [13c7749eed] user: js, branch: gamecontroller, size: 16609 [annotate] [blame] [check-ins using] [diff]
20:21
Add insane workarounds for Stadia controller file: [8fba4596f9] check-in: [ae7664ae48] user: js, branch: gamecontroller, size: 16477 [annotate] [blame] [check-ins using] [diff]
19:34
OFGameController: Undo the last commit

It seems that just checking for the Xbox 360 controller VID/PID is not
sufficient, as there are a lot of controllers that are compatible with
it, but have a different VID/PID. However, they all use the xpad driver,
which returns BTN_X and BTN_Y, which in the Linux headers are equal to
BTN_NORTH and BTN_WEST - which is incorrect for an Xbox 360 controller.
It seems the Linux kernel is a huge mess where some drivers return what
is written on the button (such as Xbox 360 via the xpad driver, which
returns BTN_X/BTN_Y) and others where they are located (Sony, Nintendo,
which return BTN_NORTH/BTN_WEST). However, since Linux also maps
BTN_X/BTN_NORTH and BTN_Y/BTN_WEST to the same code, it's impossible to
figure out what the driver meant to do.

As grepping the kernel code for BTN_NORTH has revealed that not a lot of
drivers use it and given that most controllers these days are XInput
controllers (which are handled by the xpad driver), it makes more sense
to assume that a controller is an XInput controller and map the Xbox 360
buttons to their locations. It's much easier to keep a list of
controllers with drivers that actually return BTN_NORTH/BTN_WEST instead
of what's written on the button (so far it seems to be only Nintendo and
Sony) than to keep a list of all XInput controllers. file: [3b09a9b74f] check-in: [5fdf28dd29] user: js, branch: gamecontroller, size: 15216 [annotate] [blame] [check-ins using] [diff]

2024-05-14
22:14
OFGameController: Fix Xbox 360 controller mapping

It turns out the quirk for all other controllers to swap north/west was
wrong, and the Xbox 360 controller is actually the one that has
north/west swapped.

The reason for this seems to be that Linux has BTN_NORTH and BTN_X
mapped to the same code, as well as BTN_WEST to BTN_Y. However, on the
Xbox 360 controller, Y is north and X is west. It seems that the Xbox
360 driver decided to return BTN_X and BTN_Y (so that the labels are
correct) while other drivers return BTN_NORTH and BTN_SOUTH (so that the
position is correct). file: [a14fd08793] check-in: [a4fa1b26f2] user: js, branch: gamecontroller, size: 15062 [annotate] [blame] [check-ins using] [diff]

21:39
OFGameController: Fix mapping for Sony DualSense file: [f983d21e94] check-in: [4c804d8fa7] user: js, branch: gamecontroller, size: 14763 [annotate] [blame] [check-ins using] [diff]
21:27
OFGameController: Correctly handle unknown buttons file: [0e451122ed] check-in: [dd18e20cea] user: js, branch: gamecontroller, size: 14406 [annotate] [blame] [check-ins using] [diff]
20:41
OFGameController: Use more generic button names file: [91b0510999] check-in: [2c2412d3df] user: js, branch: gamecontroller, size: 14380 [annotate] [blame] [check-ins using] [diff]
2024-05-13
20:57
Renamed src/platform/Linux/OFGameController.m → src/hid/platform/Linux/OFGameController.m. Move OFGameController into subframework ObjFWHID file: [cec84b63cd] check-in: [f5f12143ce] user: js, branch: gamecontroller, size: 15502 [annotate] [blame] [check-ins using] [diff]