Files
daniel-lynch--ovrplugin-ope…/ghidra_scripts/DumpOvrp.java
T
Daniel LynchandClaude Opus 4.8 a72a79ad29 Initial public release: OVRPlugin→OpenXR interoperability shim
An independent reimplementation of Meta's libOVRPlugin ABI on top of OpenXR, so
VrApi-era Meta Quest VR titles can run on non-Meta OpenXR runtimes (Monado,
Steam Frame) instead of being locked to Meta hardware. Original code only — no
Meta/Epic/Capcom binaries, headers, or assets. Includes a desktop harness that
drives the shim against Monado headless.

Scope/legal: interoperability; entitlement handling is out of scope. See README
for the legal/scope section and docs/ for the research trail and design notes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D6sFYGXZPsq3v7xtcDES6g
2026-06-29 00:48:48 -04:00

65 lines
2.9 KiB
Java

// Ghidra headless post-script: dump decompiled ovrp_* functions.
// Signatures for all ovrp_*, full bodies for a core set ->
// ~/dev/re4vr-port/analysis/ovrp_decomp.txt
// @category RE4VR
import ghidra.app.script.GhidraScript;
import ghidra.app.decompiler.DecompInterface;
import ghidra.app.decompiler.DecompileResults;
import ghidra.app.decompiler.DecompiledFunction;
import ghidra.program.model.listing.Function;
import ghidra.program.model.listing.FunctionManager;
import java.io.PrintWriter;
import java.util.*;
public class DumpOvrp extends GhidraScript {
public void run() throws Exception {
Set<String> CORE = new HashSet<>(Arrays.asList(
"ovrp_PreInitialize3","ovrp_Initialize5","ovrp_Shutdown2","ovrp_Update3",
"ovrp_BeginFrame4","ovrp_EndFrame4","ovrp_WaitToBeginFrame","ovrp_GetPredictedDisplayTime",
"ovrp_GetNodePoseState3","ovrp_GetNodePoseStateRaw","ovrp_GetControllerState4",
"ovrp_SetupLayer","ovrp_CalculateEyeLayerDesc2","ovrp_GetLayerTexture2",
"ovrp_GetHmdToEyeOffset2","ovrp_GetSystemHeadsetType2","ovrp_SetupDistortionWindow3"
));
String out = System.getProperty("user.home") + "/dev/re4vr-port/analysis/ovrp_decomp.txt";
DecompInterface dec = new DecompInterface();
dec.openProgram(currentProgram);
FunctionManager fm = currentProgram.getFunctionManager();
List<String> sigs = new ArrayList<>();
List<String> bodies = new ArrayList<>();
int count = 0;
for (Function f : fm.getFunctions(true)) {
String name = f.getName();
if (!name.startsWith("ovrp_")) continue;
count++;
try {
DecompileResults res = dec.decompileFunction(f, 60, monitor);
DecompiledFunction df = res.getDecompiledFunction();
if (df != null) {
sigs.add(df.getSignature());
if (CORE.contains(name)) {
bodies.add("/* ===== " + name + " @ " + f.getEntryPoint()
+ " ===== */\n" + df.getC());
}
continue;
}
} catch (Exception e) { /* fall through */ }
sigs.add("/* (decomp failed) */ " + name + " @ " + f.getEntryPoint());
}
Collections.sort(sigs);
PrintWriter w = new PrintWriter(out);
w.println("# ovrp_ functions decompiled from libOVRPlugin.so (v1.51 / pkg 19.0.0)");
w.println("# total ovrp_ functions: " + count + "\n");
w.println("## ===== SIGNATURES =====");
for (String s : sigs) w.println(s);
w.println("\n## ===== CORE FUNCTION BODIES =====\n");
for (String b : bodies) { w.println(b); w.println(); }
w.close();
println("DumpOvrp: wrote " + count + " signatures (" + bodies.size()
+ " core bodies) to " + out);
}
}