mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 09:13:39 +01:00
Merge pull request #16930 from lvonasek/feature_openxr_forcevr
OpenXR - Option to disable automatic switch between 2D and VR
This commit is contained in:
4 files changed
+19
-4
No files matched your search
+15
-3
@@ -42,6 +42,7 @@ static std::map<int, bool> pspKeys;
|
||||
|
||||
static int vr3DGeometryCount = 0;
|
||||
static long vrCompat[VR_COMPAT_MAX];
|
||||
static bool vrFlatForced = false;
|
||||
static bool vrFlatGame = false;
|
||||
static float vrMatrix[VR_MATRIX_COUNT][16];
|
||||
static bool vrMirroring[VR_MIRRORING_COUNT];
|
||||
@@ -317,7 +318,7 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) {
|
||||
if (g_Config.iHeadRotation) {
|
||||
float pitch = -VR_GetHMDAngles().x;
|
||||
float yaw = -VR_GetHMDAngles().y;
|
||||
bool disable = pspKeys[CTRL_SCREEN] || appMode == VR_MENU_MODE;
|
||||
bool disable = vrFlatForced || appMode == VR_MENU_MODE;
|
||||
bool isVR = !IsFlatVRScene();
|
||||
|
||||
// calculate delta angles of the rotation
|
||||
@@ -482,6 +483,7 @@ bool UpdateVRAxis(const AxisInput &axis) {
|
||||
bool UpdateVRKeys(const KeyInput &key) {
|
||||
//store key value
|
||||
std::vector<int> nativeKeys;
|
||||
bool wasScreenKeyOn = pspKeys[CTRL_SCREEN];
|
||||
bool wasCameraAdjustOn = pspKeys[VIRTKEY_VR_CAMERA_ADJUST];
|
||||
if (KeyMap::KeyToPspButton(key.deviceId, key.keyCode, &nativeKeys)) {
|
||||
for (int& nativeKey : nativeKeys) {
|
||||
@@ -503,6 +505,15 @@ bool UpdateVRKeys(const KeyInput &key) {
|
||||
}
|
||||
}
|
||||
|
||||
// Update force flat 2D mode
|
||||
if (g_Config.bManualForceVR) {
|
||||
if (!wasScreenKeyOn && pspKeys[CTRL_SCREEN]) {
|
||||
vrFlatForced = !vrFlatForced;
|
||||
}
|
||||
} else {
|
||||
vrFlatForced = pspKeys[CTRL_SCREEN];
|
||||
}
|
||||
|
||||
// Release keys on enabling camera adjust
|
||||
if (!wasCameraAdjustOn && pspKeys[VIRTKEY_VR_CAMERA_ADJUST]) {
|
||||
KeyInput keyUp;
|
||||
@@ -748,9 +759,10 @@ bool StartVRRender() {
|
||||
|
||||
// Decide if the scene is 3D or not
|
||||
bool stereo = hasUnitScale && g_Config.bEnableStereo;
|
||||
bool forceFlat = PSP_CoreParameter().compat.vrCompat().ForceFlatScreen;
|
||||
bool vrIncompatibleGame = PSP_CoreParameter().compat.vrCompat().ForceFlatScreen;
|
||||
bool vrScene = !vrFlatForced && (g_Config.bManualForceVR || (vr3DGeometryCount > 15));
|
||||
VR_SetConfigFloat(VR_CONFIG_CANVAS_ASPECT, 480.0f / 272.0f);
|
||||
if (g_Config.bEnableVR && !pspKeys[CTRL_SCREEN] && !forceFlat && (appMode == VR_GAME_MODE) && (vr3DGeometryCount > 15)) {
|
||||
if (g_Config.bEnableVR && !vrIncompatibleGame && (appMode == VR_GAME_MODE) && vrScene) {
|
||||
VR_SetConfig(VR_CONFIG_MODE, stereo ? VR_MODE_STEREO_6DOF : VR_MODE_MONO_6DOF);
|
||||
vrFlatGame = false;
|
||||
} else {
|
||||
|
||||
+2
-1
@@ -1142,7 +1142,8 @@ static const ConfigSetting vrSettings[] = {
|
||||
ConfigSetting("VREnable6DoF", &g_Config.bEnable6DoF, true),
|
||||
ConfigSetting("VREnableStereo", &g_Config.bEnableStereo, false),
|
||||
ConfigSetting("VREnableMotions", &g_Config.bEnableMotions, true),
|
||||
ConfigSetting("VRbForce72Hz", &g_Config.bForce72Hz, true),
|
||||
ConfigSetting("VRForce72Hz", &g_Config.bForce72Hz, true),
|
||||
ConfigSetting("VRManualForceVR", &g_Config.bManualForceVR, false),
|
||||
ConfigSetting("VRCameraDistance", &g_Config.fCameraDistance, 0.0f),
|
||||
ConfigSetting("VRCameraHeight", &g_Config.fCameraHeight, 0.0f),
|
||||
ConfigSetting("VRCameraSide", &g_Config.fCameraSide, 0.0f),
|
||||
|
||||
@@ -463,6 +463,7 @@ public:
|
||||
bool bEnableStereo;
|
||||
bool bEnableMotions;
|
||||
bool bForce72Hz;
|
||||
bool bManualForceVR;
|
||||
float fCameraDistance;
|
||||
float fCameraHeight;
|
||||
float fCameraSide;
|
||||
|
||||
@@ -1137,6 +1137,7 @@ void GameSettingsScreen::CreateVRSettings(UI::ViewGroup *vrSettings) {
|
||||
vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fHeadUpDisplayScale, 0.0f, 1.5f, vr->T("Heads-up display scale"), 0.1f, screenManager(), ""));
|
||||
|
||||
vrSettings->Add(new ItemHeader(vr->T("Experts only")));
|
||||
vrSettings->Add(new CheckBox(&g_Config.bManualForceVR, vr->T("Manual switching between flat screen and VR using SCREEN key")));
|
||||
static const char *vrHeadRotations[] = { vr->T("Disabled"), vr->T("Horizontal only"), vr->T("Horizontal and vertical") };
|
||||
vrSettings->Add(new PopupMultiChoice(&g_Config.iHeadRotation, vr->T("Map HMD rotations on keys instead of VR camera"), vrHeadRotations, 0, ARRAY_SIZE(vrHeadRotations), vr->GetName(), screenManager()));
|
||||
PopupSliderChoiceFloat *vrHeadRotationScale = vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fHeadRotationScale, 0.1f, 10.0f, vr->T("Game camera rotation step per frame"), 0.1f, screenManager(), "°"));
|
||||
|
||||
Reference in new issue
Block a user