From 994a60c8a4ae455af5d116675fd6b882bcbc8aca Mon Sep 17 00:00:00 2001 From: Acaki Date: Tue, 8 Jul 2025 21:11:36 +0800 Subject: [PATCH] fix: missing right brace and wrong device type for osc gyro --- VoidLink/Input/ControllerSupport.m | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/VoidLink/Input/ControllerSupport.m b/VoidLink/Input/ControllerSupport.m index 0f9c2fe4..e8ca8ade 100644 --- a/VoidLink/Input/ControllerSupport.m +++ b/VoidLink/Input/ControllerSupport.m @@ -769,16 +769,23 @@ static const double MOUSE_SPEED_DIVISOR = 1.25; capabilities |= LI_CCAP_BATTERY_STATE; } } - else { - // This is a virtual controller corresponding to our OSC + } + else { + // This is a virtual controller corresponding to our OSC - // TODO: Support various layouts and button labels on the OSC + if (_streamConfig.gyroMode != GyroModeOff) { + type = LI_CTYPE_PS; + capabilities = LI_CCAP_GYRO | LI_CCAP_ACCEL; + } + else { type = LI_CTYPE_XBOX; capabilities = 0; - supportedButtonFlags = - PLAY_FLAG | BACK_FLAG | UP_FLAG | DOWN_FLAG | LEFT_FLAG | RIGHT_FLAG | - LB_FLAG | RB_FLAG | LS_CLK_FLAG | RS_CLK_FLAG | A_FLAG | B_FLAG | X_FLAG | Y_FLAG; } + + // Set the standard supported buttons for the virtual controller. + supportedButtonFlags = + PLAY_FLAG | BACK_FLAG | UP_FLAG | DOWN_FLAG | LEFT_FLAG | RIGHT_FLAG | + LB_FLAG | RB_FLAG | LS_CLK_FLAG | RS_CLK_FLAG | A_FLAG | B_FLAG | X_FLAG | Y_FLAG; } // Report the new controller to the host