Skip to content

Commit

Permalink
Add optional SteamVR 2 backward compatibility offset for dashboard or…
Browse files Browse the repository at this point in the history
…igin & bump version to 2.8.4
  • Loading branch information
elvissteinjr committed Oct 20, 2023
1 parent 20c3945 commit 9f27f56
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 7 deletions.
3 changes: 3 additions & 0 deletions assets/config_default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ PerformanceMonitorShowTrackers=true
PerformanceMonitorShowViveWireless=false
PerformanceMonitorDisableGPUCounters=false

[Misc]
ApplySteamVR2DashboardOffset=true

[CustomActions]
Count=3
Action0Name=Middle Mouse Button
Expand Down
Binary file modified src/DesktopPlus/DesktopPlus.rc
Binary file not shown.
20 changes: 20 additions & 0 deletions src/DesktopPlus/OutputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,7 @@ bool OutputManager::HandleIPCMessage(const MSG& msg)
case configid_bool_overlay_enabled:
case configid_bool_overlay_gazefade_enabled:
case configid_bool_overlay_update_invisible:
case configid_bool_misc_apply_steamvr2_dashboard_offset:
{
ApplySettingTransform();
break;
Expand Down Expand Up @@ -5396,6 +5397,25 @@ Matrix4 OutputManager::DragGetBaseOffsetMatrix()
UpdateDashboardHMD_Y();
}

//Adjust origin if GamepadUI (SteamVR 2 dashboard) exists
if (ConfigManager::Get().GetConfigBool(configid_bool_misc_apply_steamvr2_dashboard_offset))
{
vr::VROverlayHandle_t handle_gamepad_ui = vr::k_ulOverlayHandleInvalid;
vr::VROverlay()->FindOverlay("valve.steam.gamepadui.bar", &handle_gamepad_ui);

if (handle_gamepad_ui != vr::k_ulOverlayHandleInvalid)
{
//Magic number, from taking the difference of both version's dashboard origins at the same HMD position
const Matrix4 matrix_to_old_dash( 1.14634132f, 3.725290300e-09f, -3.725290300e-09f, 0.00000000f,
0.00000000f, 0.878148496f, 0.736854136f, 0.00000000f,
7.45058060e-09f, -0.736854076f, 0.878148496f, 0.00000000f,
-5.96046448e-08f, 2.174717430f, 0.123533726f, 1.00000000f);

//Move origin point roughly back to where it was in the old dashboard
matrix = matrix * matrix_to_old_dash;
}
}

Vector3 pos_offset = matrix.getTranslation();
pos_offset.y = m_DashboardHMD_Y;
matrix.setTranslation(pos_offset);
Expand Down
Binary file modified src/DesktopPlusUI/DesktopPlusUI.rc
Binary file not shown.
16 changes: 15 additions & 1 deletion src/DesktopPlusUI/WindowSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,20 @@ void WindowSettings::UpdateCatOverlayTabGeneral()

ImGui::Columns(1);

if (mode_origin == ovrl_origin_dashboard)
{
ImGui::Columns(2, "ColumnPositionWide", false);
ImGui::SetColumnWidth(0, column_width_0 * 2.0f);

bool& apply_steamvr2_offset = ConfigManager::Get().GetConfigBoolRef(configid_bool_misc_apply_steamvr2_dashboard_offset);
if (ImGui::Checkbox("Apply SteamVR 2 Dashboard Offset", &apply_steamvr2_offset))
{
IPCManager::Get().PostMessageToDashboardApp(ipcmsg_set_config, ConfigManager::GetWParamForConfigID(configid_bool_misc_apply_steamvr2_dashboard_offset), apply_steamvr2_offset);
}
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::FixedHelpMarker("Applies backward compatibility offset to dashboard origin overlays when the SteamVR 2 dashboard is detected.\nThis setting applies to all overlays.");
}

PopupOverlayDetachedPositionChange();
}

Expand Down Expand Up @@ -3091,7 +3105,7 @@ void WindowSettings::UpdateCatMisc()
ImGui::Columns(2, "ColumnVersionInfo", false);
ImGui::SetColumnWidth(0, column_width_0 * 2.0f);

ImGui::Text("Desktop+ Version 2.8.3");
ImGui::Text("Desktop+ Version 2.8.4");

ImGui::Columns(1);
}
Expand Down
8 changes: 4 additions & 4 deletions src/DesktopPlusWinRT/DesktopPlusWinRT.rc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,8,3,0
PRODUCTVERSION 2,8,3,0
FILEVERSION 2,8,4,0
PRODUCTVERSION 2,8,4,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -43,10 +43,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "elvissteinjr"
VALUE "FileDescription", "Desktop+ WinRT Wrapper"
VALUE "FileVersion", "2.8.3.0"
VALUE "FileVersion", "2.8.4.0"
VALUE "LegalCopyright", "Copyright � 2019 - 2023 elvissteinjr"
VALUE "ProductName", "Desktop+ WinRT"
VALUE "ProductVersion", "2.8.3.0"
VALUE "ProductVersion", "2.8.4.0"
END
END
BLOCK "VarFileInfo"
Expand Down
6 changes: 4 additions & 2 deletions src/Shared/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,9 @@ bool ConfigManager::LoadConfigFromFile()
m_ConfigBool[configid_bool_performance_monitor_show_vive_wireless] = config.ReadBool("Performance", "PerformanceMonitorShowViveWireless", false);
m_ConfigBool[configid_bool_performance_monitor_disable_gpu_counters] = config.ReadBool("Performance", "PerformanceMonitorDisableGPUCounters", false);

m_ConfigBool[configid_bool_misc_no_steam] = config.ReadBool("Misc", "NoSteam", false);
m_ConfigBool[configid_bool_misc_uiaccess_was_enabled] = config.ReadBool("Misc", "UIAccessWasEnabled", false);
m_ConfigBool[configid_bool_misc_no_steam] = config.ReadBool("Misc", "NoSteam", false);
m_ConfigBool[configid_bool_misc_uiaccess_was_enabled] = config.ReadBool("Misc", "UIAccessWasEnabled", false);
m_ConfigBool[configid_bool_misc_apply_steamvr2_dashboard_offset] = config.ReadBool("Misc", "ApplySteamVR2DashboardOffset", true);

//Load custom actions (this is where using ini feels dumb, but it still kinda works)
auto& custom_actions = m_ActionManager.GetCustomActions();
Expand Down Expand Up @@ -927,6 +928,7 @@ void ConfigManager::SaveConfigToFile()
config.WriteBool("Performance", "PerformanceMonitorDisableGPUCounters", m_ConfigBool[configid_bool_performance_monitor_disable_gpu_counters]);

config.WriteBool("Misc", "NoSteam", m_ConfigBool[configid_bool_misc_no_steam]);
config.WriteBool("Misc", "ApplySteamVR2DashboardOffset", m_ConfigBool[configid_bool_misc_apply_steamvr2_dashboard_offset]);
config.WriteBool("Misc", "UIAccessWasEnabled", (m_ConfigBool[configid_bool_misc_uiaccess_was_enabled] || m_ConfigBool[configid_bool_state_misc_uiaccess_enabled]));

//Save custom actions
Expand Down
1 change: 1 addition & 0 deletions src/Shared/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ enum ConfigID_Bool
configid_bool_windows_winrt_auto_focus_scene_app,
configid_bool_misc_no_steam, //Restarts without Steam when it detects to have been launched by Steam
configid_bool_misc_uiaccess_was_enabled, //Tracks if UIAccess was enabled to show a warning after it isn't anymore due to updates or modified executable
configid_bool_misc_apply_steamvr2_dashboard_offset, //Applies backward compatibility offset transform when the SteamVR 2 dashboard is detected
configid_bool_state_overlay_dragmode,
configid_bool_state_overlay_selectmode,
configid_bool_state_overlay_dragselectmode_show_hidden, //True if mode is from a popup
Expand Down

0 comments on commit 9f27f56

Please sign in to comment.