1
0
forked from Clones/Controlify

Merge remote-tracking branch 'origin/feature/drivers' into 1.19.x/dev

# Conflicts:
#	src/main/java/dev/isxander/controlify/controller/gamepad/GamepadController.java
This commit is contained in:
isXander
2023-04-14 21:57:39 +01:00
16 changed files with 511 additions and 125 deletions

View File

@ -15,6 +15,7 @@ import dev.isxander.controlify.utils.DebugLog;
import net.minecraft.CrashReport;
import net.minecraft.CrashReportCategory;
import net.minecraft.ReportedException;
import org.hid4java.HidDevice;
import org.lwjgl.glfw.GLFW;
import java.util.HashMap;
@ -42,7 +43,6 @@ public interface Controller<S extends ControllerState, C extends ControllerConfi
void updateState();
void clearState();
default void open() {}
default void close() {}
RumbleManager rumbleManager();
@ -78,12 +78,13 @@ public interface Controller<S extends ControllerState, C extends ControllerConfi
CrashReportCategory category = crashReport.addCategory("Controller Info");
category.setDetail("Joystick ID", joystickId);
category.setDetail("Controller identification", hidInfo.type());
category.setDetail("HID path", hidInfo.path().orElse("N/A"));
category.setDetail("HID path", hidInfo.hidDevice().map(HidDevice::getPath).orElse("N/A"));
throw new ReportedException(crashReport);
}
}
static void remove(Controller<?, ?> controller) {
controller.close();
CONTROLLERS.remove(controller.uid(), controller);
}