1
0
forked from Clones/Controlify

Implement SDL controller identification when hid4java is unavailable (macOS ARM)

This commit is contained in:
isXander
2023-07-10 18:01:55 +01:00
parent 23d65cb89d
commit 45e859bdb1
19 changed files with 141 additions and 43 deletions

View File

@ -3,8 +3,8 @@ package dev.isxander.controlify.driver;
import com.google.common.collect.Sets;
import dev.isxander.controlify.controller.sdl2.SDL2NativesManager;
import dev.isxander.controlify.debug.DebugProperties;
import dev.isxander.controlify.hid.HIDDevice;
import dev.isxander.controlify.utils.Log;
import org.hid4java.HidDevice;
import java.util.*;
@ -28,7 +28,7 @@ public record GamepadDrivers(BasicGamepadInputDriver basicGamepadInputDriver, Gy
}
}
public static GamepadDrivers forController(int jid, Optional<HidDevice> hid) {
public static GamepadDrivers forController(int jid, Optional<HIDDevice> hid) {
GLFWGamepadDriver glfwDriver = new GLFWGamepadDriver(jid);
BasicGamepadInputDriver basicGamepadInputDriver = glfwDriver;
@ -50,7 +50,7 @@ public record GamepadDrivers(BasicGamepadInputDriver basicGamepadInputDriver, Gy
}
// TODO: Fix Steam Deck driver
if (hid.isPresent() && SteamDeckDriver.isSteamDeck(hid.get().getVendorId(), hid.get().getProductId()) && false) {
if (hid.isPresent() && hid.get().supportsCommunication() && SteamDeckDriver.isSteamDeck(hid.get().vendorID(), hid.get().productID()) && false) {
gyroDriver = new SteamDeckDriver(hid.get());
}