forked from Clones/Controlify
➕ Add 'PRINT_VID_PID' debug property
This commit is contained in:
@ -10,6 +10,8 @@ public class DebugProperties {
|
||||
private static final List<DebugProperty> properties = new ArrayList<>();
|
||||
|
||||
public static final boolean DEBUG_LOGGING = boolProp("controlify.debug.logging", false, true);
|
||||
/* Print the VID and PID of every controller connected. */
|
||||
public static final boolean PRINT_VID_PID = boolProp("controlify.debug.print_vid_pid", false, true);
|
||||
/* Renders debug overlay for vmouse snapping */
|
||||
public static final boolean DEBUG_SNAPPING = boolProp("controlify.debug.snapping", false, false);
|
||||
/* Forces all gamepads to be treated as a regular joystick */
|
||||
|
@ -4,6 +4,7 @@ import com.mojang.datafixers.util.Pair;
|
||||
import dev.isxander.controlify.Controlify;
|
||||
import dev.isxander.controlify.controller.ControllerType;
|
||||
import dev.isxander.controlify.controller.sdl2.SDL2NativesManager;
|
||||
import dev.isxander.controlify.debug.DebugProperties;
|
||||
import dev.isxander.controlify.utils.Log;
|
||||
import dev.isxander.controlify.utils.ToastUtils;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@ -47,6 +48,17 @@ public class ControllerHIDService {
|
||||
}
|
||||
|
||||
public ControllerHIDInfo fetchType(int jid) {
|
||||
ControllerHIDInfo info = fetchType0(jid);
|
||||
if (DebugProperties.PRINT_VID_PID) {
|
||||
info.hidDevice.ifPresent(hid -> {
|
||||
var hex = HexFormat.of().withPrefix("0x");
|
||||
Log.LOGGER.info("VID: {}, PID: {}", hex.toHexDigits(hid.vendorID()), hex.toHexDigits(hid.productID()));
|
||||
});
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
private ControllerHIDInfo fetchType0(int jid) {
|
||||
if (firstFetch) {
|
||||
firstFetch = false;
|
||||
if (isDisabled() && !SDL2NativesManager.isLoaded()) {
|
||||
|
Reference in New Issue
Block a user