From 3c87e7117707e45f7f8c892a9f02c17ae7e9a83d Mon Sep 17 00:00:00 2001 From: Lubos Date: Mon, 31 Oct 2022 13:19:06 +0100 Subject: [PATCH] OpenXR - Let users set the movement length --- Common/VR/PPSSPPVR.cpp | 2 +- Core/Config.cpp | 1 + Core/Config.h | 1 + UI/GameSettingsScreen.cpp | 9 ++++++--- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Common/VR/PPSSPPVR.cpp b/Common/VR/PPSSPPVR.cpp index 4c85590107..a3b2506f88 100644 --- a/Common/VR/PPSSPPVR.cpp +++ b/Common/VR/PPSSPPVR.cpp @@ -208,7 +208,7 @@ void UpdateVRInput(bool(*NativeKey)(const KeyInput &key), bool(*NativeTouch)(con if (g_Config.bEnableMotions) { for (int j = 0; j < 2; j++) { bool activate; - float limit = 0.5f; //length of needed movement in meters + float limit = g_Config.fMotionLength; //length of needed movement in meters XrVector3f axis = {0, 1, 0}; float center = ToRadians((float)VR_GetConfig(VR_CONFIG_MENU_YAW)); XrQuaternionf orientation = XrQuaternionf_CreateFromVectorAngle(axis, center); diff --git a/Core/Config.cpp b/Core/Config.cpp index 94f96d15ad..e3aa3a5707 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1214,6 +1214,7 @@ static ConfigSetting vrSettings[] = { ConfigSetting("VRCameraSide", &g_Config.fCameraSide, 0.0f), ConfigSetting("VRCanvasDistance", &g_Config.fCanvasDistance, 6.0f), ConfigSetting("VRFieldOfView", &g_Config.fFieldOfViewPercentage, 100.0f), + ConfigSetting("VRMotionLength", &g_Config.fMotionLength, 0.5f), ConfigSetting(false), }; diff --git a/Core/Config.h b/Core/Config.h index 3415cc55e0..4f212646d3 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -469,6 +469,7 @@ public: float fCameraSide; float fCanvasDistance; float fFieldOfViewPercentage; + float fMotionLength; // Debugger int iDisasmWindowX; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index a7044d946f..7fed6c3c18 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1163,15 +1163,18 @@ void GameSettingsScreen::CreateViews() { vr6DoF->SetEnabledPtr(&g_Config.bEnableVR); CheckBox *vrStereo = vrSettings->Add(new CheckBox(&g_Config.bEnableStereo, vr->T("Stereoscopic vision (Experimental)"))); vrStereo->SetEnabledPtr(&g_Config.bEnableVR); - CheckBox *vrMotions = vrSettings->Add(new CheckBox(&g_Config.bEnableMotions, vr->T("Map controller movements to keys"))); - vrMotions->SetEnabledPtr(&g_Config.bEnableVR); vrSettings->Add(new ItemHeader(vr->T("VR camera"))); vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fCameraDistance, -10.0f, 10.0f, vr->T("Camera distance adjust", "Camera distance adjust"), 1.0f, screenManager(), "")); vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fCameraHeight, -10.0f, 10.0f, vr->T("Camera height adjust", "Camera height adjust"), 1.0f, screenManager(), "")); vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fCameraSide, -10.0f, 10.0f, vr->T("Camera side adjust", "Camera side adjust"), 1.0f, screenManager(), "")); vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fCanvasDistance, 1.0f, 10.0f, vr->T("Distance to 2D menus and scenes", "Distance to 2D menus and scenes"), 1.0f, screenManager(), "")); - vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fFieldOfViewPercentage, 100.0f, 200.0f, vr->T("Field of view scale", "Headset's field of view scale"), 10.0f, screenManager(), vr->T("% of native FoV"))); + vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fFieldOfViewPercentage, 100.0f, 200.0f, vr->T("Field of view scale", "Field of view scale"), 10.0f, screenManager(), vr->T("% of native FoV"))); + + vrSettings->Add(new ItemHeader(vr->T("VR controllers"))); + vrSettings->Add(new CheckBox(&g_Config.bEnableMotions, vr->T("Map controller movements to keys"))); + PopupSliderChoiceFloat *vrMotions = vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fMotionLength, 0.3f, 1.0f, vr->T("Motion needed to generate action", "Motion needed to generate action"), 0.1f, screenManager(), vr->T("m"))); + vrMotions->SetEnabledPtr(&g_Config.bEnableMotions); } }