forked from Clones/Controlify
fix bugs:
fix reconnecting controllers are unidentified fix some mod keybinds failing to register fix crash with unmapped joysticks
This commit is contained in:
@ -16,6 +16,7 @@ import org.libsdl.SDL;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class AbstractController<S extends ControllerState, C extends ControllerConfig> implements Controller<S, C>, RumbleCapable {
|
||||
@ -24,6 +25,7 @@ public abstract class AbstractController<S extends ControllerState, C extends Co
|
||||
private final String uid;
|
||||
private final String guid;
|
||||
private final ControllerType type;
|
||||
private final ControllerHIDService.ControllerHIDInfo hidInfo;
|
||||
|
||||
protected ControllerBindings<S> bindings;
|
||||
protected C config, defaultConfig;
|
||||
@ -34,6 +36,8 @@ public abstract class AbstractController<S extends ControllerState, C extends Co
|
||||
if (!GLFW.glfwJoystickPresent(joystickId))
|
||||
throw new IllegalArgumentException("Joystick " + joystickId + " is not present and cannot be initialised!");
|
||||
|
||||
this.hidInfo = hidInfo;
|
||||
|
||||
this.joystickId = joystickId;
|
||||
this.guid = GLFW.glfwGetJoystickGUID(joystickId);
|
||||
|
||||
@ -121,6 +125,11 @@ public abstract class AbstractController<S extends ControllerState, C extends Co
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ControllerHIDService.ControllerHIDInfo> hidInfo() {
|
||||
return Optional.of(hidInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
Reference in New Issue
Block a user