Seat first person in the cockpit and animate the vehicle's own wheel

first_person_seat = "cockpit" (the new default) places the head at the
driver's own eyes, measured once from the character's head bone while the
kart drives straight and undamaged, kept behind the steering wheel, at a
life-size scale (cockpit_units_per_meter, grown with the character's
height and the player's size). "yaw" takes the kart's driving direction
from a level seat frame that follows the simulation's position and
direction, so damage spins and tricks do not turn the seat.
first_person_seat = "custom" keeps the previous offset placement.

At the race draw boundary the vehicle's steering wheel disc (karts) or
handle part (bikes, re-seated level while the bike banks) is decoded from
its MDL0, turned on a copy, and posted to the GX thread for Aurora to
substitute into the player's own draws; the copies are dropped after the
frame's draws. The anchor carries the wheel or handlebar geometry in the
seated frame and the frame's exact scale, which reaches the policy and
aurora_set_stereo_scene_anchor_scaled. If no draw takes the copies for 30
frames the vehicle falls back to the VR wheel, and the log says so.

The wheel copy is matched against RaceCamera::GetViewMtx with no dolly
offset, since the scene camera is only set once the draws run; the log
reports its distance from the scene camera once a second.

Nothing turns the wheel yet: the angle comes from the XR side's driving
snapshot, which the next change publishes.

Guest offsets ported from heurazy's mario-kart-wii-VR-port, each
re-checked against the generated leaf getters and the decompilation.
This commit is contained in:
iChris4 committed 2026-09-22 03:56:04 +02:00
1 parent 50dc354123
commit 3463813a65
5 files changed
+898 -7

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
// The VR cockpit's native steering wheel, on the GX side: the game thread
// hands Aurora a rotated copy of one of the player's vehicle position arrays,
// and Aurora substitutes it for draws that bind that array with the player's
// own model-view matrix (aurora_set_native_wheel_vertices). The copies must
// reach Aurora in order with the frame's draws, so these post to the GX thread
// when it runs and call through directly when it does not.
#include <cstdint>
namespace GxNativeWheel {
// Game thread. Drops every replacement, after the draws posted before it.
void PostClear();
// Game thread. `guestArray` is the guest address of the original array, as the
// vehicle's MDL0 holds it; `bytes` (size bytes, big-endian like the original)
// is copied now. The replacement is registered under every host pointer the
// game can bind that array through (the SDK's GXSetArray address and the
// display lists' physical CP address), so it matches whichever reaches Aurora.
// Returns false when the array does not resolve to host memory.
bool PostVertices(uint32_t guestArray, const uint8_t* bytes, uint32_t size, const float modelView[12]);
// Any thread. How many draws the most recent cleared set of replacements was
// substituted into.
uint32_t LastDrawCount();
} // namespace GxNativeWheel