Added the hint SDL_HINT_JOYSTICK_ROG_CHAKRAM to control whether ROG Chakram mice show up as joysticks

This hint defaults off, but when it is enabled the mice will have a game controller mapping set up for Profile 3 (set in the Armoury Crate software)
This commit is contained in:
Sam Lantinga 2022-02-15 13:07:51 -08:00
parent 75ffa24e3a
commit 18032979d8
5 changed files with 40 additions and 2 deletions

View file

@ -2443,10 +2443,18 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
MAKE_VIDPID(0x04d9, 0x8009), /* OBINLB USB-HID Keyboard (Anne Pro II) */
MAKE_VIDPID(0x04d9, 0xa292), /* OBINLB USB-HID Keyboard (Anne Pro II) */
MAKE_VIDPID(0x04d9, 0xa293), /* OBINLB USB-HID Keyboard (Anne Pro II) */
MAKE_VIDPID(0x0b05, 0x1958), /* ROG Chakram Mouse */
MAKE_VIDPID(0x26ce, 0x01a2), /* ASRock LED Controller */
};
static Uint32 rog_chakram_list[] = {
MAKE_VIDPID(0x0b05, 0x1958), /* ROG Chakram Core Mouse */
MAKE_VIDPID(0x0b05, 0x18e3), /* ROG Chakram (wired) Mouse */
MAKE_VIDPID(0x0b05, 0x18e5), /* ROG Chakram (wireless) Mouse */
MAKE_VIDPID(0x0b05, 0x1a18), /* ROG Chakram X (wired) Mouse */
MAKE_VIDPID(0x0b05, 0x1a1a), /* ROG Chakram X (wireless) Mouse */
MAKE_VIDPID(0x0b05, 0x1a1c), /* ROG Chakram X (Bluetooth) Mouse */
};
unsigned int i;
Uint32 id;
Uint16 vendor;
@ -2462,6 +2470,13 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
return SDL_TRUE;
}
}
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_ROG_CHAKRAM, SDL_FALSE)) {
for (i = 0; i < SDL_arraysize(rog_chakram_list); ++i) {
if (id == rog_chakram_list[i]) {
return SDL_TRUE;
}
}
}
type = SDL_GetJoystickGameControllerType(name, vendor, product, -1, 0, 0, 0);
if ((type == SDL_CONTROLLER_TYPE_PS4 || type == SDL_CONTROLLER_TYPE_PS5) && SDL_IsPS4RemapperRunning()) {