1
0
forked from Clones/Controlify

remove reliance on usagePage and usage to detect controllers and run controller creation on main thread

This commit is contained in:
isXander
2023-02-23 18:35:40 +00:00
parent c7b01f194f
commit c2f1670d27
9 changed files with 72 additions and 117 deletions

View File

@ -3,11 +3,10 @@ package dev.isxander.controlify.controller.joystick;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import dev.isxander.controlify.controller.AbstractController;
import dev.isxander.controlify.controller.hid.ControllerHIDService;
import dev.isxander.controlify.controller.joystick.mapping.RPJoystickMapping;
import dev.isxander.controlify.controller.joystick.mapping.JoystickMapping;
import dev.isxander.controlify.controller.joystick.mapping.UnmappedJoystickMapping;
import org.hid4java.HidDevice;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
import java.util.Objects;
@ -17,8 +16,8 @@ public class JoystickController extends AbstractController<JoystickState, Joysti
private final int axisCount, buttonCount, hatCount;
private final JoystickMapping mapping;
public JoystickController(int joystickId, @Nullable HidDevice hidDevice) {
super(joystickId, hidDevice);
public JoystickController(int joystickId, ControllerHIDService.ControllerHIDInfo hidInfo) {
super(joystickId, hidInfo);
this.axisCount = GLFW.glfwGetJoystickAxes(joystickId).capacity();
this.buttonCount = GLFW.glfwGetJoystickButtons(joystickId).capacity();