OpenXR - Force PSP menu aspect ratio

This commit is contained in:
Lubos 2022-11-17 17:30:29 +01:00
parent f92990a002
commit db8b159d9e
5 changed files with 7 additions and 9 deletions

View File

@ -319,7 +319,7 @@ void UpdateVRInput(bool(*NativeAxis)(const AxisInput &axis), bool(*NativeKey)(co
float cy = height / 2;
float speed = (cx + cy) / 2;
float x = cx - tan(ToRadians(angles.y - VR_GetConfigFloat(VR_CONFIG_MENU_YAW))) * speed;
float y = cy - tan(ToRadians(angles.x)) * speed;
float y = cy - tan(ToRadians(angles.x)) * speed * VR_GetConfigFloat(VR_CONFIG_CANVAS_ASPECT);
//set renderer
VR_SetConfig(VR_CONFIG_MOUSE_X, (int)x);
@ -330,7 +330,7 @@ void UpdateVRInput(bool(*NativeAxis)(const AxisInput &axis), bool(*NativeKey)(co
TouchInput touch;
touch.id = mouseController;
touch.x = x * dp_xscale;
touch.y = (height - y - 1) * dp_yscale;
touch.y = (height - y - 1) * dp_yscale / VR_GetConfigFloat(VR_CONFIG_CANVAS_ASPECT);
bool pressed = IN_VRGetButtonState(mouseController) & ovrButton_Trigger;
if (mousePressed != pressed) {
if (pressed) {
@ -608,6 +608,7 @@ bool StartVRRender() {
}
// Decide if the scene is 3D or not
VR_SetConfigFloat(VR_CONFIG_CANVAS_ASPECT, 480.0f / 272.0f);
if ((appMode == VR_DIALOG_MODE) || (appMode == VR_MENU_MODE)) {
VR_SetConfig(VR_CONFIG_MODE, VR_MODE_MONO_SCREEN);
} else if (g_Config.bEnableVR && !pspKeys[CTRL_SCREEN] && (vr3DGeometryCount > 15)) {

View File

@ -394,7 +394,7 @@ void VR_FinishFrame( engine_t* engine ) {
cylinder_layer.pose.position = pos;
cylinder_layer.radius = 12.0f;
cylinder_layer.centralAngle = (float)(M_PI * 0.5);
cylinder_layer.aspectRatio = 1;
cylinder_layer.aspectRatio = VR_GetConfigFloat(VR_CONFIG_CANVAS_ASPECT);
// Build the cylinder layer
if (vrMode == VR_MODE_MONO_SCREEN) {

View File

@ -20,6 +20,7 @@ enum VRConfig {
enum VRConfigFloat {
// 2D canvas positioning
VR_CONFIG_CANVAS_DISTANCE, VR_CONFIG_MENU_PITCH, VR_CONFIG_MENU_YAW, VR_CONFIG_RECENTER_YAW,
VR_CONFIG_CANVAS_ASPECT,
VR_CONFIG_FLOAT_MAX
};

View File

@ -78,11 +78,7 @@ void CenterDisplayOutputRect(FRect *rc, float origW, float origH, const FRect &f
SmallDisplayZoom zoomType = (SmallDisplayZoom)g_Config.iSmallDisplayZoomType;
if (IsVREnabled()) {
if (IsFlatVRScene()) {
zoomType = SmallDisplayZoom::AUTO;
} else {
zoomType = SmallDisplayZoom::STRETCH;
}
zoomType = SmallDisplayZoom::STRETCH;
}
if (zoomType == SmallDisplayZoom::STRETCH) {

View File

@ -1305,7 +1305,7 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_setDisplayParameters(JN
int width, height;
GetVRResolutionPerEye(&width, &height);
xres = width;
yres = height;
yres = height * 272 / 480;
dpi = 320;
}