@covas-labs/electron-vr 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge.d.ts +13 -0
- package/dist/bridge.js +19 -0
- package/dist/compatibility.js +24 -2
- package/dist/openxrApiLayer.js +25 -0
- package/package.json +3 -3
package/dist/bridge.d.ts
CHANGED
|
@@ -30,6 +30,10 @@ export interface RuntimeInfo {
|
|
|
30
30
|
openxrProtocolVersion: number;
|
|
31
31
|
openxrSubmittedFrameSequence: number;
|
|
32
32
|
openxrConsumedFrameSequence: number;
|
|
33
|
+
libovrHostDetected: boolean;
|
|
34
|
+
libovrHostProcessId: number;
|
|
35
|
+
libovrHostApplicationName: string;
|
|
36
|
+
libovrHostBinaryPath: string;
|
|
33
37
|
openvrAvailable: boolean;
|
|
34
38
|
openvrRuntimeInstalled: boolean;
|
|
35
39
|
openvrRuntimePath: string;
|
|
@@ -103,6 +107,15 @@ export interface NativeImageLike {
|
|
|
103
107
|
export interface AttachWindowOptions {
|
|
104
108
|
frameRate?: number;
|
|
105
109
|
}
|
|
110
|
+
export interface NativeOpenXRApiLayerStatus {
|
|
111
|
+
installed: boolean;
|
|
112
|
+
enabled: boolean;
|
|
113
|
+
registered: boolean;
|
|
114
|
+
requiresUpdate: boolean;
|
|
115
|
+
manifestPath: string;
|
|
116
|
+
scope: string;
|
|
117
|
+
}
|
|
118
|
+
export declare function runNativeOpenXRApiLayerCommand(command: "status" | "install" | "enable" | "disable" | "uninstall", sourceDirectory: string): NativeOpenXRApiLayerStatus;
|
|
106
119
|
export declare class VrBridge {
|
|
107
120
|
private readonly addon;
|
|
108
121
|
private attachedWindow;
|
package/dist/bridge.js
CHANGED
|
@@ -105,6 +105,21 @@ function loadVrBridgeAddon() {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
+
export function runNativeOpenXRApiLayerCommand(command, sourceDirectory) {
|
|
109
|
+
const addon = loadVrBridgeAddon();
|
|
110
|
+
const method = command === "status"
|
|
111
|
+
? addon.getOpenXRApiLayerStatus
|
|
112
|
+
: command === "install"
|
|
113
|
+
? addon.installOpenXRApiLayer
|
|
114
|
+
: command === "enable"
|
|
115
|
+
? addon.enableOpenXRApiLayer
|
|
116
|
+
: command === "disable"
|
|
117
|
+
? addon.disableOpenXRApiLayer
|
|
118
|
+
: addon.uninstallOpenXRApiLayer;
|
|
119
|
+
if (!method)
|
|
120
|
+
throw new Error("The native OpenXR API-layer management API is unavailable.");
|
|
121
|
+
return method.call(addon, sourceDirectory);
|
|
122
|
+
}
|
|
108
123
|
function sanitizeRuntimeInfo(runtimeInfo) {
|
|
109
124
|
return {
|
|
110
125
|
...runtimeInfo,
|
|
@@ -124,6 +139,10 @@ function sanitizeRuntimeInfo(runtimeInfo) {
|
|
|
124
139
|
openxrProtocolVersion: runtimeInfo.openxrProtocolVersion ?? 0,
|
|
125
140
|
openxrSubmittedFrameSequence: runtimeInfo.openxrSubmittedFrameSequence ?? 0,
|
|
126
141
|
openxrConsumedFrameSequence: runtimeInfo.openxrConsumedFrameSequence ?? 0,
|
|
142
|
+
libovrHostDetected: runtimeInfo.libovrHostDetected ?? false,
|
|
143
|
+
libovrHostProcessId: runtimeInfo.libovrHostProcessId ?? 0,
|
|
144
|
+
libovrHostApplicationName: runtimeInfo.libovrHostApplicationName ?? "",
|
|
145
|
+
libovrHostBinaryPath: runtimeInfo.libovrHostBinaryPath ?? "",
|
|
127
146
|
openvrSceneApplicationState: runtimeInfo.openvrSceneApplicationState ?? "",
|
|
128
147
|
openvrSceneProcessId: runtimeInfo.openvrSceneProcessId ?? 0,
|
|
129
148
|
openvrSceneApplicationKey: runtimeInfo.openvrSceneApplicationKey ?? "",
|
package/dist/compatibility.js
CHANGED
|
@@ -45,7 +45,19 @@ export function analyzeVRCompatibility(runtime, context = {}) {
|
|
|
45
45
|
let compatibleHostGraphicsApis = [];
|
|
46
46
|
let requiresApiLayer = false;
|
|
47
47
|
let recommendedAction = "none";
|
|
48
|
-
|
|
48
|
+
const supportedHostDetected = runtime.openxrCompanionConnected || runtime.openxrHostDetected ||
|
|
49
|
+
runtime.openvrSceneProcessId !== 0;
|
|
50
|
+
const unsupportedLibOVRHost = runtime.libovrHostDetected && !supportedHostDetected &&
|
|
51
|
+
runtime.openxrMode !== "overlay-session";
|
|
52
|
+
if (unsupportedLibOVRHost) {
|
|
53
|
+
const applicationName = runtime.libovrHostApplicationName || "A VR application";
|
|
54
|
+
readiness = "unavailable";
|
|
55
|
+
backendLabel = "Unsupported native Oculus application";
|
|
56
|
+
summary = `${applicationName} is using native Oculus/LibOVR, which electron-vr cannot overlay.`;
|
|
57
|
+
recommendedAction = "use-supported-openxr-host";
|
|
58
|
+
issues.push(issue("libovr-host-unsupported", "error", "Native Oculus application detected", "Relaunch the application through OpenXR or a supported OpenVR runtime. Native LibOVR applications do not expose a cross-application overlay API.", "use-supported-openxr-host"));
|
|
59
|
+
}
|
|
60
|
+
else if (runtime.selectedBackend === "openxr" && runtime.openxrMode === "overlay-session") {
|
|
49
61
|
readiness = "ready";
|
|
50
62
|
backendLabel = "OpenXR direct overlay";
|
|
51
63
|
summary = "The active OpenXR runtime supports a direct overlay session.";
|
|
@@ -134,7 +146,17 @@ export function analyzeVRCompatibility(runtime, context = {}) {
|
|
|
134
146
|
const canRenderOverlay = readiness === "ready" || readiness === "waiting-for-host" ||
|
|
135
147
|
(readiness === "fallback-only" && runtime.platform === "linux" && runtime.selectedBackend === "mock");
|
|
136
148
|
let launch;
|
|
137
|
-
if (
|
|
149
|
+
if (unsupportedLibOVRHost) {
|
|
150
|
+
launch = {
|
|
151
|
+
verdict: "incompatible",
|
|
152
|
+
wouldWorkNow: false,
|
|
153
|
+
canStartNow: false,
|
|
154
|
+
fundamentalIncompatibility: true,
|
|
155
|
+
message: "The running VR application uses native Oculus/LibOVR and cannot host an electron-vr overlay.",
|
|
156
|
+
requiredActions: ["use-supported-openxr-host"]
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
else if (readiness === "ready" && (runtime.selectedBackend === "openxr" || runtime.selectedBackend === "openvr")) {
|
|
138
160
|
launch = {
|
|
139
161
|
verdict: "works-now",
|
|
140
162
|
wouldWorkNow: true,
|
package/dist/openxrApiLayer.js
CHANGED
|
@@ -3,6 +3,7 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { dirname, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { runNativeOpenXRApiLayerCommand } from "./bridge.js";
|
|
6
7
|
const PREBUILT_PACKAGES = {
|
|
7
8
|
linux: "@covas-labs/electron-vr-prebuilt-linux-x64",
|
|
8
9
|
win32: "@covas-labs/electron-vr-prebuilt-win32-x64"
|
|
@@ -33,6 +34,24 @@ function resolvePrebuiltCli() {
|
|
|
33
34
|
}
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
37
|
+
function resolveWindowsLayerAssets() {
|
|
38
|
+
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
39
|
+
const repositoryAssets = resolve(currentDir, "..", "..", "native-addon", "build", "Release");
|
|
40
|
+
if (existsSync(resolve(repositoryAssets, "electron_vr_openxr_layer.dll")))
|
|
41
|
+
return repositoryAssets;
|
|
42
|
+
const requires = [createRequire(import.meta.url), createRequire(resolve(process.cwd(), "package.json"))];
|
|
43
|
+
for (const require of requires) {
|
|
44
|
+
try {
|
|
45
|
+
const directory = dirname(require.resolve(PREBUILT_PACKAGES.win32));
|
|
46
|
+
if (existsSync(resolve(directory, "electron_vr_openxr_layer.dll")))
|
|
47
|
+
return directory;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Try the next package resolution context.
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
throw new Error("The Windows OpenXR API-layer assets are unavailable.");
|
|
54
|
+
}
|
|
36
55
|
function resolveCli() {
|
|
37
56
|
assertSupportedPlatform();
|
|
38
57
|
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
@@ -91,9 +110,15 @@ export function parseOpenXRApiLayerStatus(output) {
|
|
|
91
110
|
};
|
|
92
111
|
}
|
|
93
112
|
export async function getOpenXRApiLayerStatus() {
|
|
113
|
+
if (process.platform === "win32") {
|
|
114
|
+
return runNativeOpenXRApiLayerCommand("status", resolveWindowsLayerAssets());
|
|
115
|
+
}
|
|
94
116
|
return parseOpenXRApiLayerStatus(await runCommand("status"));
|
|
95
117
|
}
|
|
96
118
|
async function runLifecycleCommand(command) {
|
|
119
|
+
if (process.platform === "win32") {
|
|
120
|
+
return runNativeOpenXRApiLayerCommand(command, resolveWindowsLayerAssets());
|
|
121
|
+
}
|
|
97
122
|
await runCommand(command);
|
|
98
123
|
return getOpenXRApiLayerStatus();
|
|
99
124
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@covas-labs/electron-vr",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Electron VR overlay bridge with OpenXR, OpenVR, and mock fallback backends.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"electron": ">=37"
|
|
23
23
|
},
|
|
24
24
|
"optionalDependencies": {
|
|
25
|
-
"@covas-labs/electron-vr-prebuilt-linux-x64": "0.8.
|
|
26
|
-
"@covas-labs/electron-vr-prebuilt-win32-x64": "0.8.
|
|
25
|
+
"@covas-labs/electron-vr-prebuilt-linux-x64": "0.8.2",
|
|
26
|
+
"@covas-labs/electron-vr-prebuilt-win32-x64": "0.8.2"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"registry": "https://registry.npmjs.org",
|