mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-20 05:23:12 -07:00
Ignore IMU-only Controllers in GUI (#387)
This commit is contained in:
parent
c8b017c7d5
commit
ea4ff606f0
1 changed files with 76 additions and 0 deletions
|
@ -11,6 +11,64 @@
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static QSet<QString> chiaki_motion_controller_guids({
|
||||||
|
// Sony on Linux
|
||||||
|
"03000000341a00003608000011010000",
|
||||||
|
"030000004c0500006802000010010000",
|
||||||
|
"030000004c0500006802000010810000",
|
||||||
|
"030000004c0500006802000011010000",
|
||||||
|
"030000004c0500006802000011810000",
|
||||||
|
"030000006f0e00001402000011010000",
|
||||||
|
"030000008f0e00000300000010010000",
|
||||||
|
"050000004c0500006802000000010000",
|
||||||
|
"050000004c0500006802000000800000",
|
||||||
|
"050000004c0500006802000000810000",
|
||||||
|
"05000000504c415953544154494f4e00",
|
||||||
|
"060000004c0500006802000000010000",
|
||||||
|
"030000004c050000a00b000011010000",
|
||||||
|
"030000004c050000a00b000011810000",
|
||||||
|
"030000004c050000c405000011010000",
|
||||||
|
"030000004c050000c405000011810000",
|
||||||
|
"030000004c050000cc09000000010000",
|
||||||
|
"030000004c050000cc09000011010000",
|
||||||
|
"030000004c050000cc09000011810000",
|
||||||
|
"03000000c01100000140000011010000",
|
||||||
|
"050000004c050000c405000000010000",
|
||||||
|
"050000004c050000c405000000810000",
|
||||||
|
"050000004c050000c405000001800000",
|
||||||
|
"050000004c050000cc09000000010000",
|
||||||
|
"050000004c050000cc09000000810000",
|
||||||
|
"050000004c050000cc09000001800000",
|
||||||
|
// Sony on iOS
|
||||||
|
"050000004c050000cc090000df070000",
|
||||||
|
// Sony on Android
|
||||||
|
"050000004c05000068020000dfff3f00",
|
||||||
|
"030000004c050000cc09000000006800",
|
||||||
|
"050000004c050000c4050000fffe3f00",
|
||||||
|
"050000004c050000cc090000fffe3f00",
|
||||||
|
"050000004c050000cc090000ffff3f00",
|
||||||
|
"35643031303033326130316330353564",
|
||||||
|
// Sony on Mac OSx
|
||||||
|
"030000004c050000cc09000000000000",
|
||||||
|
"030000004c0500006802000000000000",
|
||||||
|
"030000004c0500006802000000010000",
|
||||||
|
"030000004c050000a00b000000010000",
|
||||||
|
"030000004c050000c405000000000000",
|
||||||
|
"030000004c050000c405000000010000",
|
||||||
|
"030000004c050000cc09000000010000",
|
||||||
|
"03000000c01100000140000000010000",
|
||||||
|
// Sony on Windows
|
||||||
|
"030000004c050000a00b000000000000",
|
||||||
|
"030000004c050000c405000000000000",
|
||||||
|
"030000004c050000cc09000000000000",
|
||||||
|
"03000000250900000500000000000000",
|
||||||
|
"030000004c0500006802000000000000",
|
||||||
|
"03000000632500007505000000000000",
|
||||||
|
"03000000888800000803000000000000",
|
||||||
|
"030000008f0e00001431000000000000",
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
static ControllerManager *instance = nullptr;
|
static ControllerManager *instance = nullptr;
|
||||||
|
|
||||||
#define UPDATE_INTERVAL_MS 4
|
#define UPDATE_INTERVAL_MS 4
|
||||||
|
@ -56,6 +114,24 @@ void ControllerManager::UpdateAvailableControllers()
|
||||||
{
|
{
|
||||||
if(!SDL_IsGameController(i))
|
if(!SDL_IsGameController(i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// We'll try to identify pads with Motion Control
|
||||||
|
SDL_JoystickGUID guid = SDL_JoystickGetGUID(SDL_JoystickOpen(i));
|
||||||
|
char guid_str[256];
|
||||||
|
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||||
|
|
||||||
|
if(chiaki_motion_controller_guids.contains(guid_str))
|
||||||
|
{
|
||||||
|
SDL_Joystick *joy = SDL_JoystickOpen(i);
|
||||||
|
if(joy)
|
||||||
|
{
|
||||||
|
bool no_buttons = SDL_JoystickNumButtons(joy) == 0;
|
||||||
|
SDL_JoystickClose(joy);
|
||||||
|
if(no_buttons)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
current_controllers.insert(SDL_JoystickGetDeviceInstanceID(i));
|
current_controllers.insert(SDL_JoystickGetDeviceInstanceID(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue