- ovrp_GetTimeInSeconds: real export returning double (legacy direct-return ABI); the autogen ovrpResult stub left d0 uninitialized and the game reads it - seqlock writer: fence the odd-mark before the data stores (torn-pose window) - drain the frameState ring on STOPPING/shutdown (stale displayTime + permanent one-frame skew after every session pause) - begin_frame FIFO bail: bound the wait (surface-teardown deadlock) and measure the deadline on CLOCK_MONOTONIC, immune to wall-clock steps - passthru: pthread_once takeover + acquire/release PT_FWD pointer cache (first-use race could run the shim path mid-takeover) - luma/dump/barcode readback disabled for non-4-byte swapchain formats (staging buffers assumed 4 B/texel; wider fallback formats would overflow) - vkWaitForFences: honor timeouts everywhere; never reset a pending cmd buffer - detect_ue_queue: keep the caller's queue family/index when detection fails - xrr_get_node_pose: g_spaceLock vs the sitting/standing appSpace recreate (locate on a freed XrSpace) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
libOVRPlugin.so shim (OVRPlugin v1.51 -> OpenXR)
Drop-in replacement for RE4 VR's libOVRPlugin.so that re-exports the ovrp_* symbols backed by OpenXR (Monado) instead of Meta's libvrapi.so. See ../HOST.md, ../SHIM-SCOPE.md.
Layout
- include/ovrplugin_shim.h — OVRPlugin v1.51 C ABI (types + core protos; self-checking _Static_asserts on binary-verified struct sizes).
- gen_stubs.sh — generates src/stubs.c from ../analysis/shim_surface.txt.
- src/stubs.c (generated) — 224 stubs: 101 Unsupported(-1004), 32 no-op Success(0), 91 NotYetImplemented(-1005).
- src/core.c — the 15 header-prototyped core fns (frame loop/init/poses/ controller/system), currently TODO stubs returning -1005 with outputs zeroed.
Build (host, for validation)
cc -std=c11 -Wall -shared -fPIC -fvisibility=hidden -Iinclude src/stubs.c src/core.c \
-o build/libOVRPlugin.so
Status: builds; exports exactly 239 ovrp_ symbols (1:1 with shim_surface.txt, 0 missing/extra); dlopen+dlsym verified. This is the SKELETON — it loads and resolves, it does not yet drive VR (core fns are TODO).
Real target build (deployable) — TODO
Must be aarch64 / Android (bionic) since it runs inside Lepton. Use the Android NDK:
$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android29-clang \
-std=c11 -shared -fPIC -fvisibility=hidden -Iinclude src/stubs.c src/core.c \
-o build/arm64/libOVRPlugin.so
(host build only proves the C + symbol coverage; NDK build is the artifact that replaces the real lib in the APK.)
Modules (current)
- include/ovrplugin_shim.h — OVRPlugin v1.51 ABI (types, structs, core protos).
- src/stubs.c (generated) — 221 stubs (unsupported/no-op/TODO).
- src/core.c — lifecycle + frame loop + poses (-> xr_runtime).
- src/xr_runtime.{h,c} — OpenXR engine: session, frame loop, swapchains.
- src/vk_session.c — Vulkan-typed: xrCreateSession binding + image enum.
- src/layers.c — ovrp_SetupLayer / GetLayerTexture2 / StageCount.
- tests/harness.c — Path B smoke test (see ../TESTING.md). Build adds: -Ithird_party/openxr -Ithird_party/vulkan, and src/{core,xr_runtime, vk_session,layers,stubs}.c. 20 OpenXR fns used; 239/239 ovrp_ exported.
Done so far
Session lifecycle, frame loop (xrWaitFrame/Begin/EndFrame), poses (xrLocateViews/ Space), swapchains (xrCreateSwapchain from ovrpLayerDesc, acquire/wait/release, XrCompositionLayerProjection submit). Vulkan binding from Initialize5 args [VERIFIED].
Debug: passthru forwarding (author-only diagnostic)
debug.re4vr.passthru=1 makes the shim hand the whole OVRPlugin session to a real,
SONAME-patched libOVRPlugin_real.so if one is present in the APK — an A/B harness for
diffing native runtime behavior against the shim. No such binary is included or
distributed by this repo; you would have to place one from your own device dump, and
without it the flag is inert. All other debug.re4vr.* props are likewise diagnostics.
Next (see ../TESTING.md for the test plan)
- NDK arm64 build (host build is validation only).
- [ANDROID-TODO] JavaVM/activity -> XrInstanceCreateInfoAndroidKHR + xrInitializeLoaderKHR.
- Input action sets (controllers/hands); depth layer; GetVulkan*ExtensionsKHR mapping.
- Repack APK (real entitlement — you own it); test on Quest 2.