@covas-labs/electron-vr 0.7.0 → 0.8.1

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 CHANGED
@@ -103,6 +103,15 @@ export interface NativeImageLike {
103
103
  export interface AttachWindowOptions {
104
104
  frameRate?: number;
105
105
  }
106
+ export interface NativeOpenXRApiLayerStatus {
107
+ installed: boolean;
108
+ enabled: boolean;
109
+ registered: boolean;
110
+ requiresUpdate: boolean;
111
+ manifestPath: string;
112
+ scope: string;
113
+ }
114
+ export declare function runNativeOpenXRApiLayerCommand(command: "status" | "install" | "enable" | "disable" | "uninstall", sourceDirectory: string): NativeOpenXRApiLayerStatus;
106
115
  export declare class VrBridge {
107
116
  private readonly addon;
108
117
  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,
@@ -25,6 +25,7 @@ export interface VRCompatibilityIssue {
25
25
  export interface VRLaunchAssessment {
26
26
  verdict: VRLaunchVerdict;
27
27
  wouldWorkNow: boolean;
28
+ canStartNow: boolean;
28
29
  fundamentalIncompatibility: boolean;
29
30
  message: string;
30
31
  requiredActions: VRSetupAction[];
@@ -138,6 +138,7 @@ export function analyzeVRCompatibility(runtime, context = {}) {
138
138
  launch = {
139
139
  verdict: "works-now",
140
140
  wouldWorkNow: true,
141
+ canStartNow: true,
141
142
  fundamentalIncompatibility: false,
142
143
  message: "Launching the browser overlay now is expected to produce real VR output.",
143
144
  requiredActions: []
@@ -150,6 +151,7 @@ export function analyzeVRCompatibility(runtime, context = {}) {
150
151
  launch = {
151
152
  verdict: "action-required",
152
153
  wouldWorkNow: false,
154
+ canStartNow: false,
153
155
  fundamentalIncompatibility: false,
154
156
  message: "The overlay is compatible, but setup must be completed before launching it.",
155
157
  requiredActions: actions
@@ -159,6 +161,7 @@ export function analyzeVRCompatibility(runtime, context = {}) {
159
161
  launch = {
160
162
  verdict: "action-required",
161
163
  wouldWorkNow: false,
164
+ canStartNow: true,
162
165
  fundamentalIncompatibility: false,
163
166
  message: `The overlay is ready, but real VR output requires a compatible ${compatibleHostGraphicsApis.join(" or ")} OpenXR application to be started or restarted.`,
164
167
  requiredActions: ["start-openxr-app"]
@@ -168,6 +171,7 @@ export function analyzeVRCompatibility(runtime, context = {}) {
168
171
  launch = {
169
172
  verdict: "action-required",
170
173
  wouldWorkNow: false,
174
+ canStartNow: false,
171
175
  fundamentalIncompatibility: false,
172
176
  message: "Launching now would not produce real VR output. Install and configure a supported OpenXR or SteamVR runtime first.",
173
177
  requiredActions: ["install-xr-runtime"]
@@ -177,6 +181,7 @@ export function analyzeVRCompatibility(runtime, context = {}) {
177
181
  launch = {
178
182
  verdict: "incompatible",
179
183
  wouldWorkNow: false,
184
+ canStartNow: false,
180
185
  fundamentalIncompatibility: true,
181
186
  message: "This platform or execution mode cannot provide a production VR overlay with the current implementation.",
182
187
  requiredActions: []
@@ -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));
@@ -52,7 +71,8 @@ function runCommand(command) {
52
71
  ...process.env,
53
72
  ELECTRON_RUN_AS_NODE: "1"
54
73
  },
55
- stdio: ["ignore", "pipe", "pipe"]
74
+ stdio: ["ignore", "pipe", "pipe"],
75
+ windowsHide: true
56
76
  });
57
77
  let stdout = "";
58
78
  let stderr = "";
@@ -90,9 +110,15 @@ export function parseOpenXRApiLayerStatus(output) {
90
110
  };
91
111
  }
92
112
  export async function getOpenXRApiLayerStatus() {
113
+ if (process.platform === "win32") {
114
+ return runNativeOpenXRApiLayerCommand("status", resolveWindowsLayerAssets());
115
+ }
93
116
  return parseOpenXRApiLayerStatus(await runCommand("status"));
94
117
  }
95
118
  async function runLifecycleCommand(command) {
119
+ if (process.platform === "win32") {
120
+ return runNativeOpenXRApiLayerCommand(command, resolveWindowsLayerAssets());
121
+ }
96
122
  await runCommand(command);
97
123
  return getOpenXRApiLayerStatus();
98
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@covas-labs/electron-vr",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
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.7.0",
26
- "@covas-labs/electron-vr-prebuilt-win32-x64": "0.7.0"
25
+ "@covas-labs/electron-vr-prebuilt-linux-x64": "0.8.1",
26
+ "@covas-labs/electron-vr-prebuilt-win32-x64": "0.8.1"
27
27
  },
28
28
  "publishConfig": {
29
29
  "registry": "https://registry.npmjs.org",