mirror of
https://github.com/daniel-lynch/ovrplugin-openxr-shim.git
synced 2026-10-06 01:00:05 +02:00
Repo hygiene round following a full review. No shim behaviour changes. Leak risk: - .gitignore: ignore CLAUDE.md (personal assistant-lane config, was one `git add -A` away from a public commit) and scratch_obj/. Docs vs. reality: - shim/README.md: rewritten. It described a pre-implementation skeleton with "core fns are TODO stubs returning -1005", three mutually inconsistent stub counts, and four completed milestones listed as open. Now carries the verified breakdown: 438/438 exports = 371 generated stubs + 46 core + 7 layers + 2 Vulkan queries + 12 passthru trampolines. - TESTING.md: dropped the self-contradicting "NOT yet" block (5 of 6 items were done or misstated, and contradicted the same file 45 lines above). Path B now points at tools/desktop-harness, which exists, instead of the orphaned shim/tests/harness.c. Path A prereqs marked as the record they are. - HOST.md: corrected the runtime assumption. The OpenXR runtime inside Lepton is SteamVR (vendor/etc/openxr/1/active_runtime.json -> vrclient.so), not Monado. Favourable: SteamVR emulates Oculus Touch by default and advertises the XR_FB_foveation family, so the existing input and foveation paths should carry over. The old "remaining unknowns" are resolved by Lepton's published source and replaced with the items to check before a first Frame boot. - README.md: same runtime correction. - docs/research/RECON.md: the four passages prescribing an entitlement NOP/stub/bypass are corrected in place rather than merely disclaimed by the top banner, which they contradicted. Build correctness: - shim/build_android.sh: missing patchelf is now fatal. It warned and exited 0, producing a .so that cannot resolve the OpenXR loader at runtime. - scripts/fetch_deps.sh + packaging/build_openxr_loader.sh: pin the OpenXR and Vulkan header versions (were tracking `main`), overridable via OPENXR_TAG / VULKAN_HEADERS_TAG; require cmake for the loader build. - packaging/steamframe_patches.sh: use the apktool.jar that fetch_deps.sh downloads. Its prereq check demanded an `apktool` binary on PATH that the documented setup never provides, so it could not run after a clean setup. - shim/gen_stubs.sh: it reads all_exports.txt, not shim_surface.txt; comment and emitted banner corrected. stubs.c regenerated (banner line only). - shim/src/core.c: split seven `if (out) ...; return ...;` one-liners. Host build now compiles with zero warnings, down from seven. Verified: host build 0 warnings; gen_stubs.sh output identical on regeneration; bash -n clean on all edited scripts; pinned header/tarball URLs return 200 and the tag tarball extracts to the expected directory name. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
69 lines
4.2 KiB
Bash
Executable File
69 lines
4.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Generate shim/src/stubs.c from analysis/all_exports.txt (the FULL 438-export set).
|
|
# Each ovrp_ function gets a stub returning a sensible ovrpResult, classified by
|
|
# name per SHIM-SCOPE.md buckets. Functions prototyped in the header (real sigs)
|
|
# are SKIPPED here and live in core.c instead.
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
# Use the ORIGINAL lib's FULL export set (438) so the shim is a complete drop-in:
|
|
# any dlsym of any ovrp_ resolves, even the 199 RE4 doesn't reference.
|
|
SURF="$ROOT/analysis/all_exports.txt"
|
|
OUT="$ROOT/shim/src/stubs.c"
|
|
mkdir -p "$ROOT/shim/src"
|
|
|
|
# functions with real prototypes in ovrplugin_shim.h -> handled in core.c
|
|
HEADER_FNS=" ovrp_GetNodePoseState3 ovrp_GetNodePoseStateRaw ovrp_GetControllerState4 \
|
|
ovrp_PreInitialize3 ovrp_Initialize5 ovrp_Shutdown2 ovrp_Update3 ovrp_WaitToBeginFrame \
|
|
ovrp_BeginFrame4 ovrp_EndFrame4 ovrp_GetPredictedDisplayTime ovrp_GetSystemHeadsetType2 \
|
|
ovrp_GetTrackingOriginType2 ovrp_SetTrackingOriginType2 ovrp_RecenterTrackingOrigin2 \
|
|
ovrp_SetupLayer ovrp_GetLayerTextureStageCount ovrp_GetLayerTexture2 \
|
|
ovrp_GetInstanceExtensionsVk ovrp_GetDeviceExtensionsVk \
|
|
ovrp_GetInitialized ovrp_GetSystemDisplayFrequency2 ovrp_GetTimeInSeconds \
|
|
ovrp_GetAppHasVrFocus2 ovrp_GetAppShouldQuit2 ovrp_GetUserPresent2 \
|
|
ovrp_GetAppShouldRecenter2 ovrp_GetAppShouldRecreateDistortionWindow2 \
|
|
ovrp_GetSystemMultiViewSupported2 ovrp_GetAppHasInputFocus ovrp_SetupDistortionWindow3 \
|
|
ovrp_CalculateEyeLayerDesc2 ovrp_CalculateEyeViewportRect ovrp_GetMixedRealityInitialized ovrp_CalculateLayerDesc ovrp_GetNodePresent2 ovrp_GetNodeOrientationValid ovrp_GetNodePositionValid ovrp_GetNodeOrientationTracked2 ovrp_GetNodePositionTracked2 ovrp_SetControllerVibration2 \
|
|
ovrp_GetTiledMultiResSupported ovrp_GetTiledMultiResLevel ovrp_SetTiledMultiResLevel \
|
|
ovrp_GetTiledMultiResDynamic ovrp_SetTiledMultiResDynamic ovrp_GetGPUFrameTime \
|
|
ovrp_DestroyLayer ovrp_GetNodeFrustum2 ovrp_SetSystemCpuLevel2 ovrp_SetSystemGpuLevel2 \
|
|
ovrp_IsPerfMetricsSupported ovrp_GetPerfMetricsFloat ovrp_GetPerfMetricsInt \
|
|
ovrp_GetAdaptiveGpuPerformanceScale2 \
|
|
ovrp_DestroyDistortionWindow2 ovrp_SetupDisplayObjects2 ovrp_SetReorientHMDOnControllerRecenter \
|
|
ovrp_SetClientColorDesc ovrp_SetAppEngineInfo2 ovrp_SetAppCPUPriority2 ovrp_InitializeMixedReality \
|
|
ovrp_GetViewportStencil ovrp_GetSystemRecommendedMSAALevel2 ovrp_GetLocalTrackingSpaceRecenterCount \
|
|
ovrp_GetLayerTextureFoveation ovrp_GetControllerHapticsDesc2 "
|
|
# NB: the trailing 12 are game-called () stubs now owned by passthru.c — they keep their
|
|
# original return constant when passthru is off, and tail-call the real lib when it's on.
|
|
|
|
{
|
|
echo '/* AUTO-GENERATED by gen_stubs.sh from analysis/all_exports.txt. Do not edit by hand. */'
|
|
echo '#include "ovrplugin_shim.h"'
|
|
echo '#include "log.h"'
|
|
echo
|
|
echo '/* Stub policy:'
|
|
echo ' * -1004 Unsupported : features we will not implement (MRC/camera/perf/boundary/hands)'
|
|
echo ' * 0 Success (no-op) : config setters we can safely accept-and-ignore for now'
|
|
echo ' * -1005 NotYetImplemented : real work still owed (getters/etc. the game needs)'
|
|
echo ' * Empty () = unspecified args: stub ignores args, returns constant in result reg. */'
|
|
echo
|
|
n_unsup=0; n_noop=0; n_todo=0; n_skip=0
|
|
while read -r fn; do
|
|
[ -z "$fn" ] && continue
|
|
case " $HEADER_FNS " in *" $fn "*) n_skip=$((n_skip+1)); continue;; esac
|
|
if echo "$fn" | grep -qE 'Media_|CameraDevice|ExternalCamera|HandState|Skeleton|GetMesh|HandTracking|HandNode|PerfMetric|GPUUtil|GPUFrameTime|ASW|TiledMultiRes|Boundary'; then
|
|
ret="ovrpFailure_Unsupported"; n_unsup=$((n_unsup+1))
|
|
elif echo "$fn" | grep -qE '^ovrp_Set[A-Z]|^ovrp_Reset|^ovrp_Recenter|^ovrp_SendEvent|^ovrp_Destroy|^ovrp_Override'; then
|
|
ret="ovrpSuccess"; n_noop=$((n_noop+1))
|
|
else
|
|
ret="ovrpFailure_NotYetImplemented"; n_todo=$((n_todo+1))
|
|
fi
|
|
printf 'OVRP_EXPORT ovrpResult %s() { static int o; if(!o){o=1;XRRLOG("stub %s -> %s");} return %s; }\n' "$fn" "$fn" "$ret" "$ret"
|
|
done < "$SURF"
|
|
echo
|
|
echo "/* generated: unsup=$n_unsup noop=$n_noop todo=$n_todo skipped(core)=$n_skip */"
|
|
} > "$OUT"
|
|
|
|
echo "wrote $OUT"
|
|
grep -c '^OVRP_EXPORT' "$OUT" | xargs echo "stub functions:"
|
|
tail -1 "$OUT"
|