Add Flat Screen mode for VR races and update settings accordingly

This commit is contained in:
iChris4 committed 2026-09-23 17:15:53 +02:00
1 parent 2a89fac79d
commit 2a4686191e
16 files changed
+161 -50

No files matched your search

+1 -1
View File
@@ -51,7 +51,7 @@ void TestHandOff() {
CheckNear(hands[0].stick_x, 0.6f, "a held wheel steers through the left stick");
CheckNear(hands[0].stick_y, 0.8f, "the stick keeps aiming items");
CheckNear(hands[0].squeeze, 1.0f, "a free hand's grip still reaches the game");
CheckNear(hands[1].squeeze, 0.0f, "a holding grip does not press C or a shoulder");
CheckNear(hands[1].squeeze, 0.0f, "a holding grip does not press a shoulder");
wheel.held = {true, true};
wheel.steering = 3.0f;
+16
View File
@@ -73,6 +73,22 @@ int main() {
check(MkwVRPolicyGetSnapshot().presentation == VRPresentationMode::VirtualScreen, "race entry needs fresh camera");
MkwVRPolicyPublishRaceCamera(camera);
check(MkwVRPolicyGetSnapshot().presentation == VRPresentationMode::ImmersiveRace, "race resumes with fresh camera");
{
const uint64_t immersive_tag = MkwVRPolicyGetSnapshot().content_tag;
MkwVRPolicySetFirstPersonEngaged(true);
MkwVRPolicySetImmersiveRaces(false);
const auto flat = MkwVRPolicyGetSnapshot();
check(flat.presentation == VRPresentationMode::VirtualScreen, "Flat Screen mode keeps races on the screen");
check(flat.content_tag != immersive_tag, "Flat Screen mode must invalidate immersive packets");
check(!flat.first_person_engaged, "Flat Screen mode never engages first person");
check(MkwVRPolicyRouteDraw(VRDrawClass::PerspectiveWorld, flat) == VRDrawRoute::VirtualScreen,
"Flat Screen mode routes the race world to the screen");
MkwVRPolicySetFirstPersonEngaged(false);
MkwVRPolicySetImmersiveRaces(true);
const auto resumed = MkwVRPolicyGetSnapshot();
check(resumed.presentation == VRPresentationMode::ImmersiveRace, "leaving Flat Screen mode resumes the race");
check(resumed.content_tag != flat.content_tag, "leaving Flat Screen mode must invalidate screen packets");
}
MkwVRPolicySetSessionActive(false);
check(MkwVRPolicyGetSnapshot().presentation == VRPresentationMode::Desktop, "inactive session uses desktop");
return failures == 0 ? 0 : 1;
+9 -6
View File
@@ -240,7 +240,9 @@ void TestButtons() {
right.primary = true;
right.trigger = 0.6f;
Check(RemoteButtons(left, right) == (kButtonA | kButtonB), "right A and trigger are A and B");
right.secondary = true;
Check(RemoteButtons(left, right) == (kButtonA | kButtonB | kButtonC),
"right A, trigger and B are A, B and C");
right = {};
right.stick_y = 0.9f;
@@ -260,16 +262,17 @@ void TestButtons() {
left.menu = true;
Check(RemoteButtons(left, right) == (kButtonMinus | kButtonPlus), "left X and menu are - and +");
left = {};
left.squeeze = 0.8f;
left.trigger = 0.7f;
Check(RemoteButtons(left, right) == (kButtonC | kButtonZ), "left grip and trigger are C and Z");
// Left Y is the settings panel's button, and nothing presses HOME.
Check(RemoteButtons(left, right) == kButtonZ, "left trigger is Z");
// Left Y is the settings panel's button, the grips take hold of the steering
// wheel, and nothing presses HOME.
left = {};
left.secondary = true;
right.secondary = true;
left.squeeze = 0.8f;
right.squeeze = 0.8f;
right.thumbstick_click = true;
left.thumbstick_click = true;
Check(RemoteButtons(left, right) == 0, "left Y, right B and the stick clicks are unbound");
Check(RemoteButtons(left, right) == 0, "left Y, the grips and the stick clicks are unbound");
left = {};
right = {};
left.menu = true;