Fit VR games on the glasses: full view, seated origin at the head, pad hands reach with the d-pad

This commit is contained in:
maxjivi05 committed 2026-10-13 11:24:01 -04:00
1 parent a746d56dc8
commit 7c8fa679bd
6 files changed
+51 -8

No files matched your search

+7 -1
View File
@@ -491,6 +491,10 @@ def execute(args: argparse.Namespace, adb: str, serial: str) -> dict:
request.update(key=args.key, value=args.value)
elif args.glasses_op == "simulate":
request["seconds"] = args.seconds
if args.yaw is not None:
request["yaw"] = args.yaw
if args.pitch is not None:
request["pitch"] = args.pitch
elif args.glasses_op == "mode":
request["mode"] = args.mode
elif args.glasses_op == "imu":
@@ -673,8 +677,10 @@ def build_parser() -> argparse.ArgumentParser:
glasses_set = glasses_ops.add_parser("set", help="refreshHz, sbsHz, brightness, volume, sunblock, 3d, gameOnGlasses, headTracking, auto3d")
glasses_set.add_argument("key")
glasses_set.add_argument("value")
glasses_sim = glasses_ops.add_parser("simulate", help="feed a moving head pose (yaw, pitch and roll sweeps)")
glasses_sim = glasses_ops.add_parser("simulate", help="feed a moving head pose (yaw, pitch and roll sweeps), or hold one")
glasses_sim.add_argument("--seconds", type=int, default=20)
glasses_sim.add_argument("--yaw", type=float, help="hold this yaw (degrees, left positive) instead of sweeping")
glasses_sim.add_argument("--pitch", type=float, help="hold this pitch (degrees, down positive) instead of sweeping")
glasses_ops.add_parser("stop-simulate")
glasses_ops.add_parser("query", help="ask the glasses for their display mode, brightness, volume and IMU state")
glasses_mode = glasses_ops.add_parser("mode", help="send a display mode byte, e.g. 0x31 (1080p60), 0x34 (1080p120), 0x32 (3D)")
@@ -87,6 +87,27 @@ start)
}
JSON
ln -sf "$steamvr/steamxr_linuxarm64.json" "$HOME/.config/openxr/1/active_runtime.json"
chaperone=$HOME/.local/share/Steam/config/chaperone_info.vrchap
[ -s "$chaperone" ] || cat > "$chaperone" <<'JSON'
{
"jsonid" : "chaperone_info",
"universes" : [
{
"collision_bounds" : [
[ [ -1.0, 0.0, -1.0 ], [ -1.0, 2.43, -1.0 ], [ -1.0, 2.43, 1.0 ], [ -1.0, 0.0, 1.0 ] ],
[ [ -1.0, 0.0, 1.0 ], [ -1.0, 2.43, 1.0 ], [ 1.0, 2.43, 1.0 ], [ 1.0, 0.0, 1.0 ] ],
[ [ 1.0, 0.0, 1.0 ], [ 1.0, 2.43, 1.0 ], [ 1.0, 2.43, -1.0 ], [ 1.0, 0.0, -1.0 ] ],
[ [ 1.0, 0.0, -1.0 ], [ 1.0, 2.43, -1.0 ], [ -1.0, 2.43, -1.0 ], [ -1.0, 0.0, -1.0 ] ]
],
"play_area" : [ 2.0, 2.0 ],
"seated" : { "translation" : [ 0.0, -1.6, 0.0 ], "yaw" : 0.0 },
"standing" : { "translation" : [ 0.0, 0.0, 0.0 ], "yaw" : 0.0 },
"universeID" : "2"
}
],
"version" : 5
}
JSON
# vrcompositor asks for VK_KHR_display, which makes Turnip/KGSL report no GPU at all; the layer stands
# in for a display. gamescope's implicit WSI layer stays out of SteamVR's processes.
+8 -1
View File
@@ -417,12 +417,16 @@ public:
// From the driver's pose thread: the head's orientation and the pad.
void Update(const HmdQuaternion_t &head, const PadState *pad) {
if (id_ == k_unTrackedDeviceIndexInvalid) return;
const auto now = std::chrono::steady_clock::now();
const float dt = std::min(std::chrono::duration<float>(now - lastUpdate_).count(), 0.1f);
lastUpdate_ = now;
if (pad && pad->axes[7]) reach_ = std::clamp(reach_ - (pad->axes[7] > 0 ? 1.0f : -1.0f) * kReachSpeed * dt, kReachMin, kReachMax);
DriverPose_t p = {};
p.qWorldFromDriverRotation.w = 1;
p.qDriverFromHeadRotation.w = 1;
p.qRotation = head;
// Low and in front of its side, in head space, then into the room with the head's rotation.
const double off[3] = {right_ ? 0.18 : -0.18, -0.35, -0.30};
const double off[3] = {right_ ? 0.18 : -0.18, -0.35, -0.30 - reach_};
double m[3][3];
const double w = head.w, x = head.x, y = head.y, z = head.z;
m[0][0] = 1 - 2 * (y * y + z * z); m[0][1] = 2 * (x * y - z * w); m[0][2] = 2 * (x * z + y * w);
@@ -452,9 +456,12 @@ public:
}
private:
static constexpr float kReachSpeed = 0.6f, kReachMin = -0.2f, kReachMax = 0.7f;
bool right_;
uint32_t id_ = k_unTrackedDeviceIndexInvalid;
DriverPose_t pose_ = {};
float reach_ = 0.0f;
std::chrono::steady_clock::time_point lastUpdate_ = std::chrono::steady_clock::now();
VRInputComponentHandle_t system_ = 0, menu_ = 0, grip_ = 0, triggerClick_ = 0, trigger_ = 0, padX_ = 0, padY_ = 0,
padClick_ = 0, padTouch_ = 0, haptic_ = 0;
};