forked from Clones/Controlify
➕ Configurable mixed input mode
This commit is contained in:
@ -326,11 +326,7 @@ public class Controlify implements ControlifyApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state.hasAnyInput()) {
|
if (state.hasAnyInput()) {
|
||||||
// use MIXED input mode to support Steam Input for things like gyro mouse and touchpads
|
this.setInputMode(controller.config().mixedInput ? InputMode.MIXED : InputMode.CONTROLLER);
|
||||||
// this is only temporary until the Steam Deck driver is finished
|
|
||||||
boolean isSteamDeck = controller.hidInfo().map(info -> info.hidDevice().map(device -> SteamDeckDriver.isSteamDeck(device.getVendorId(), device.getProductId())).orElse(false)).orElse(false);
|
|
||||||
|
|
||||||
this.setInputMode(isSteamDeck ? InputMode.MIXED : InputMode.CONTROLLER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (consecutiveInputSwitches > 100) {
|
if (consecutiveInputSwitches > 100) {
|
||||||
@ -362,9 +358,9 @@ public class Controlify implements ControlifyApi {
|
|||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
CrashReport crashReport = CrashReport.forThrowable(e, errorTitle);
|
CrashReport crashReport = CrashReport.forThrowable(e, errorTitle);
|
||||||
CrashReportCategory category = crashReport.addCategory("Affected controller");
|
CrashReportCategory category = crashReport.addCategory("Affected controller");
|
||||||
category.setDetail("Controller name", controller::name);
|
category.setDetail("Controller name", controller.name());
|
||||||
category.setDetail("Controller identification", () -> controller.type().toString());
|
category.setDetail("Controller identification", controller.type().toString());
|
||||||
category.setDetail("Controller type", () -> controller.getClass().getCanonicalName());
|
category.setDetail("Controller type", controller.getClass().getCanonicalName());
|
||||||
throw new ReportedException(crashReport);
|
throw new ReportedException(crashReport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,8 @@ public abstract class ControllerConfig {
|
|||||||
public boolean deadzonesCalibrated = false;
|
public boolean deadzonesCalibrated = false;
|
||||||
public boolean delayedCalibration = false;
|
public boolean delayedCalibration = false;
|
||||||
|
|
||||||
|
public boolean mixedInput = false;
|
||||||
|
|
||||||
public abstract void setDeadzone(int axis, float deadzone);
|
public abstract void setDeadzone(int axis, float deadzone);
|
||||||
public abstract float getDeadzone(int axis);
|
public abstract float getDeadzone(int axis);
|
||||||
|
|
||||||
|
@ -44,6 +44,10 @@ public class GamepadController extends AbstractController<GamepadState, GamepadC
|
|||||||
|
|
||||||
this.defaultConfig = new GamepadConfig();
|
this.defaultConfig = new GamepadConfig();
|
||||||
this.config = new GamepadConfig();
|
this.config = new GamepadConfig();
|
||||||
|
if (hidInfo.hidDevice().map(hid -> SteamDeckDriver.isSteamDeck(hid.getVendorId(), hid.getProductId())).orElse(false)) {
|
||||||
|
this.defaultConfig.mixedInput = true;
|
||||||
|
this.config.mixedInput = true;
|
||||||
|
}
|
||||||
|
|
||||||
this.bindings = new ControllerBindings<>(this);
|
this.bindings = new ControllerBindings<>(this);
|
||||||
}
|
}
|
||||||
|
@ -294,6 +294,12 @@ public class ControllerConfigScreenFactory {
|
|||||||
private static ConfigCategory createAdvancedCategory(Controller<?, ?> controller) {
|
private static ConfigCategory createAdvancedCategory(Controller<?, ?> controller) {
|
||||||
return ConfigCategory.createBuilder()
|
return ConfigCategory.createBuilder()
|
||||||
.name(Component.translatable("controlify.config.category.advanced"))
|
.name(Component.translatable("controlify.config.category.advanced"))
|
||||||
|
.option(Option.<Boolean>createBuilder()
|
||||||
|
.name(Component.translatable("controlify.gui.mixed_input"))
|
||||||
|
.description(OptionDescription.of(Component.translatable("controlify.gui.mixed_input.tooltip")))
|
||||||
|
.binding(controller.defaultConfig().mixedInput, () -> controller.config().mixedInput, v -> controller.config().mixedInput = v)
|
||||||
|
.controller(TickBoxControllerBuilder::create)
|
||||||
|
.build())
|
||||||
.group(makeVibrationGroup(controller))
|
.group(makeVibrationGroup(controller))
|
||||||
.group(makeGyroGroup(controller))
|
.group(makeGyroGroup(controller))
|
||||||
.build();
|
.build();
|
||||||
|
@ -75,6 +75,8 @@
|
|||||||
"controlify.gui.button_activation_threshold": "Button Activation Threshold",
|
"controlify.gui.button_activation_threshold": "Button Activation Threshold",
|
||||||
"controlify.gui.button_activation_threshold.tooltip": "How far a button needs to be pushed before registering as pressed.",
|
"controlify.gui.button_activation_threshold.tooltip": "How far a button needs to be pushed before registering as pressed.",
|
||||||
"controlify.config.category.advanced": "Advanced",
|
"controlify.config.category.advanced": "Advanced",
|
||||||
|
"controlify.gui.mixed_input": "Mixed Input",
|
||||||
|
"controlify.gui.mixed_input.tooltip": "If enabled, Controlify will allow you to use both this controller and keyboard/mouse at the same time. This should be used when pairing with Steam Input, where certain advanced controller actions needs to be mapped to these inputs, rather than a gamepad. Be aware, this prevents you from entering normal keyboard/mouse mode whilst this controller is in use.",
|
||||||
"controlify.gui.group.vibration": "Vibration",
|
"controlify.gui.group.vibration": "Vibration",
|
||||||
"controlify.gui.group.vibration.tooltip": "Adjust how your controller vibrates.",
|
"controlify.gui.group.vibration.tooltip": "Adjust how your controller vibrates.",
|
||||||
"controlify.gui.allow_vibrations": "Allow Vibration",
|
"controlify.gui.allow_vibrations": "Allow Vibration",
|
||||||
|
Reference in New Issue
Block a user