Skip to content

Commit

Permalink
Fix an issue in the Control Center app reporting. Add option to force…
Browse files Browse the repository at this point in the history
… disable PP.
  • Loading branch information
mbucchia committed Apr 23, 2023
1 parent c6e6655 commit b8f181a
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 10 deletions.
23 changes: 19 additions & 4 deletions companion/ExperimentalSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 32 additions & 4 deletions companion/ExperimentalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ private void LoadSettings()
timingBias.Value = multiplier == 0 ? ((int)key.GetValue("frame_time_override_offset", 0) / 100) : 0;
disableFramePipelining.Checked = (int)key.GetValue("quirk_disable_frame_pipelining", 0) == 1 ? true : false;
alwaysUseFrameIdZero.Checked = (int)key.GetValue("quirk_always_use_frame_id_zero", 0) == 1 ? true : false;
forceDisableParallelProjection.Checked = (int)key.GetValue("force_parallel_projection_state", 1) == 0 ? true : false;
}
catch (Exception)
{
Expand Down Expand Up @@ -198,8 +199,6 @@ private void forceThird_CheckedChanged(object sender, EventArgs e)

private void disableFramePipelining_CheckedChanged(object sender, EventArgs e)
{
RefreshEnabledState();

if (loading)
{
return;
Expand All @@ -210,8 +209,6 @@ private void disableFramePipelining_CheckedChanged(object sender, EventArgs e)

private void alwaysUseFrameIdZero_CheckedChanged(object sender, EventArgs e)
{
RefreshEnabledState();

if (loading)
{
return;
Expand All @@ -220,6 +217,37 @@ private void alwaysUseFrameIdZero_CheckedChanged(object sender, EventArgs e)
MainForm.WriteSetting("quirk_always_use_frame_id_zero", alwaysUseFrameIdZero.Checked ? 1 : 0);
}

private void forceDisableParallelProjection_CheckedChanged(object sender, EventArgs e)
{
if (loading)
{
return;
}

if (forceDisableParallelProjection.Checked)
{
MainForm.WriteSetting("force_parallel_projection_state", 0);
} else
{
Microsoft.Win32.RegistryKey key = null;
try
{
key = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(MainForm.RegPrefix);
key.DeleteValue("force_parallel_projection_state", false);
}
catch (Exception)
{
}
finally
{
if (key != null)
{
key.Close();
}
}
}
}

private void restoreDefaults_Click(object sender, EventArgs e)
{
Microsoft.Win32.RegistryKey key = null;
Expand Down
9 changes: 7 additions & 2 deletions pimax-openxr/companion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "runtime.h"
#include "utils.h"

using namespace pimax_openxr::utils;

struct RuntimeStatus {
bool valid;

Expand Down Expand Up @@ -65,9 +67,10 @@ extern "C" __declspec(dllexport) void WINAPI getRuntimeStatus(RuntimeStatus* sta
const auto fov = PVR::RadToDegree(atan(eyeInfo[xr::StereoView::Left].Fov.LeftTan) +
atan(eyeInfo[xr::StereoView::Right].Fov.RightTan) + cantingAngle * 2.f);
const auto useParallelProjection =
cantingAngle > 0.0001f && !pvr_getIntConfig(pvrSession, "steamvr_use_native_fov", 0);
cantingAngle > 0.0001f &&
RegGetDword(HKEY_LOCAL_MACHINE, "SOFTWARE\\PimaxXR", "force_parallel_projection_state")
.value_or(!pvr_getIntConfig(pvrSession, "steamvr_use_native_fov", 0));

pvrFovPort fovForResolution = eyeInfo[xr::StereoView::Left].Fov;
if (useParallelProjection) {
// Per Pimax, we must set this value for parallel projection to work properly.
CHECK_PVRCMD(pvr_setIntConfig(pvrSession, "view_rotation_fix", 1));
Expand All @@ -77,6 +80,8 @@ extern "C" __declspec(dllexport) void WINAPI getRuntimeStatus(RuntimeStatus* sta
CHECK_PVRCMD(pvr_getEyeRenderInfo(pvrSession, pvrEye_Right, &eyeInfo[xr::StereoView::Right]));
}

const pvrFovPort fovForResolution = eyeInfo[xr::StereoView::Left].Fov;

pvrSizei viewportSize;
CHECK_PVRCMD(pvr_getFovTextureSize(pvrSession, pvrEye_Left, fovForResolution, 1.f, &viewportSize));

Expand Down

0 comments on commit b8f181a

Please sign in to comment.