1
0
forked from Clones/Controlify

Configurable mixed input mode

This commit is contained in:
isXander
2023-07-10 16:55:42 +01:00
parent 1b447b5d74
commit 8a3436d1c1
5 changed files with 18 additions and 8 deletions

View File

@ -326,11 +326,7 @@ public class Controlify implements ControlifyApi {
}
if (state.hasAnyInput()) {
// use MIXED input mode to support Steam Input for things like gyro mouse and touchpads
// 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);
this.setInputMode(controller.config().mixedInput ? InputMode.MIXED : InputMode.CONTROLLER);
}
if (consecutiveInputSwitches > 100) {
@ -362,9 +358,9 @@ public class Controlify implements ControlifyApi {
} catch (Throwable e) {
CrashReport crashReport = CrashReport.forThrowable(e, errorTitle);
CrashReportCategory category = crashReport.addCategory("Affected controller");
category.setDetail("Controller name", controller::name);
category.setDetail("Controller identification", () -> controller.type().toString());
category.setDetail("Controller type", () -> controller.getClass().getCanonicalName());
category.setDetail("Controller name", controller.name());
category.setDetail("Controller identification", controller.type().toString());
category.setDetail("Controller type", controller.getClass().getCanonicalName());
throw new ReportedException(crashReport);
}
}

View File

@ -32,6 +32,8 @@ public abstract class ControllerConfig {
public boolean deadzonesCalibrated = false;
public boolean delayedCalibration = false;
public boolean mixedInput = false;
public abstract void setDeadzone(int axis, float deadzone);
public abstract float getDeadzone(int axis);

View File

@ -44,6 +44,10 @@ public class GamepadController extends AbstractController<GamepadState, GamepadC
this.defaultConfig = 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);
}

View File

@ -294,6 +294,12 @@ public class ControllerConfigScreenFactory {
private static ConfigCategory createAdvancedCategory(Controller<?, ?> controller) {
return ConfigCategory.createBuilder()
.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(makeGyroGroup(controller))
.build();