[GestureLock] Fixes for 2023r171

This commit is contained in:
NotAKidoS 2023-07-28 23:13:35 -05:00
parent ffca0b8f3f
commit 3720b1f3c8

View file

@ -11,7 +11,7 @@ internal class CVRInputModule_XRPatches
{ {
// Get input from SteamVR because new input system is nerfed for OpenXR... // Get input from SteamVR because new input system is nerfed for OpenXR...
private static readonly SteamVR_Action_Boolean _gestureToggleButton = SteamVR_Input.GetAction<SteamVR_Action_Boolean>("ControllerToggleGestures", false); private static readonly SteamVR_Action_Boolean _gestureToggleButton = SteamVR_Input.GetAction<SteamVR_Action_Boolean>("ControllerToggleGestures", false);
private static bool _isLocked; private static bool _isLocked;
private static float _oldGestureLeft; private static float _oldGestureLeft;
private static float _oldGestureRight; private static float _oldGestureRight;
@ -20,7 +20,7 @@ internal class CVRInputModule_XRPatches
[HarmonyPatch(typeof(CVRInputModule_XR), nameof(CVRInputModule_XR.Update_Emotes))] [HarmonyPatch(typeof(CVRInputModule_XR), nameof(CVRInputModule_XR.Update_Emotes))]
private static void Postfix_CVRInputModule_XR_Update_Emotes(ref CVRInputModule_XR __instance) private static void Postfix_CVRInputModule_XR_Update_Emotes(ref CVRInputModule_XR __instance)
{ {
if (!MetaPort.Instance.isUsingVr) if (!MetaPort.Instance.isUsingVr)
return; return;
bool leftInput = _gestureToggleButton.GetLastStateDown(SteamVR_Input_Sources.LeftHand); bool leftInput = _gestureToggleButton.GetLastStateDown(SteamVR_Input_Sources.LeftHand);
@ -31,7 +31,7 @@ internal class CVRInputModule_XRPatches
if (rightInput && __instance._rightModule.Type == EXRControllerType.Index || __instance._inputManager.oneHanded) if (rightInput && __instance._rightModule.Type == EXRControllerType.Index || __instance._inputManager.oneHanded)
return; return;
if (leftInput || rightInput) if (leftInput || rightInput)
{ {
_isLocked = !_isLocked; _isLocked = !_isLocked;
@ -42,7 +42,7 @@ internal class CVRInputModule_XRPatches
if (!_isLocked) if (!_isLocked)
return; return;
__instance._inputManager.gestureLeft = _oldGestureLeft; __instance._inputManager.gestureLeft = _oldGestureLeft;
__instance._inputManager.gestureRight = _oldGestureRight; __instance._inputManager.gestureRight = _oldGestureRight;
} }