-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
openvr_interop.cs.py
executable file
·599 lines (530 loc) · 20.4 KB
/
openvr_interop.cs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
import sys
import api_shared
calculateinteropmethodname = api_shared.calculateinteropmethodname
print ("""//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: This file contains C#/managed code bindings for the OpenVR interfaces
// This file is auto-generated, do not edit it.
//
//=============================================================================
#if !OPENVR_XR_API
using System;
using System.Runtime.InteropServices;
using Valve.VR;
#if UNITY_5_3_OR_NEWER
using UnityEngine;
#endif
namespace Valve.VR
{
""")
data = api_shared.loadfile('../headers/openvr_api.json', 'vr')
converttype = api_shared.converttype
structlist = api_shared.structlist
typedeflist = api_shared.typedeflist
enumlist = api_shared.enumlist
lastmethod = ''
############## define Csharp interfaces ######################
api_shared.outputinterfaces('vr', data)
############ define csharp classes
api_shared.outputclasses('vr', data)
print("}\n\n");
# Output the OpenVRInterop class
print('public class OpenVRInterop\n{')
print('[DllImportAttribute("openvr_api", EntryPoint = "VR_InitInternal", CallingConvention = CallingConvention.Cdecl)]')
print('internal static extern uint InitInternal(ref EVRInitError peError, EVRApplicationType eApplicationType);')
print('[DllImportAttribute("openvr_api", EntryPoint = "VR_InitInternal2", CallingConvention = CallingConvention.Cdecl)]')
print('internal static extern uint InitInternal2(ref EVRInitError peError, EVRApplicationType eApplicationType,[In, MarshalAs(UnmanagedType.LPStr)] string pStartupInfo);')
print('[DllImportAttribute("openvr_api", EntryPoint = "VR_ShutdownInternal", CallingConvention = CallingConvention.Cdecl)]')
print('internal static extern void ShutdownInternal();')
print('[DllImportAttribute("openvr_api", EntryPoint = "VR_IsHmdPresent", CallingConvention = CallingConvention.Cdecl)]')
print('internal static extern bool IsHmdPresent();')
print('[DllImportAttribute("openvr_api", EntryPoint = "VR_IsRuntimeInstalled", CallingConvention = CallingConvention.Cdecl)]')
print('internal static extern bool IsRuntimeInstalled();')
print('[DllImportAttribute("openvr_api", EntryPoint = "VR_RuntimePath", CallingConvention = CallingConvention.Cdecl)]')
print('internal static extern string RuntimePath();')
print('[DllImportAttribute("openvr_api", EntryPoint = "VR_GetRuntimePath", CallingConvention = CallingConvention.Cdecl)]')
print('internal static extern bool GetRuntimePath(System.Text.StringBuilder pchPathBuffer, uint unBufferSize, ref uint punRequiredBufferSize);')
print('[DllImportAttribute("openvr_api", EntryPoint = "VR_GetStringForHmdError", CallingConvention = CallingConvention.Cdecl)]')
print('internal static extern IntPtr GetStringForHmdError(EVRInitError error);')
print('[DllImportAttribute("openvr_api", EntryPoint = "VR_GetGenericInterface", CallingConvention = CallingConvention.Cdecl)]')
print('internal static extern IntPtr GetGenericInterface([In, MarshalAs(UnmanagedType.LPStr)] string pchInterfaceVersion, ref EVRInitError peError);')
print('[DllImportAttribute("openvr_api", EntryPoint = "VR_IsInterfaceVersionValid", CallingConvention = CallingConvention.Cdecl)]')
print('internal static extern bool IsInterfaceVersionValid([In, MarshalAs(UnmanagedType.LPStr)] string pchInterfaceVersion);')
print('[DllImportAttribute("openvr_api", EntryPoint = "VR_GetInitToken", CallingConvention = CallingConvention.Cdecl)]')
print('internal static extern uint GetInitToken();')
print("}\n\n");
api_shared.outputenums('vr', data)
print("""
[StructLayout(LayoutKind.Explicit)] public struct VREvent_Data_t
{
[FieldOffset(0)] public VREvent_Reserved_t reserved;
[FieldOffset(0)] public VREvent_Controller_t controller;
[FieldOffset(0)] public VREvent_Mouse_t mouse;
[FieldOffset(0)] public VREvent_Scroll_t scroll;
[FieldOffset(0)] public VREvent_Process_t process;
[FieldOffset(0)] public VREvent_Notification_t notification;
[FieldOffset(0)] public VREvent_Overlay_t overlay;
[FieldOffset(0)] public VREvent_Status_t status;
[FieldOffset(0)] public VREvent_Ipd_t ipd;
[FieldOffset(0)] public VREvent_Chaperone_t chaperone;
[FieldOffset(0)] public VREvent_PerformanceTest_t performanceTest;
[FieldOffset(0)] public VREvent_TouchPadMove_t touchPadMove;
[FieldOffset(0)] public VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset;
[FieldOffset(0)] public VREvent_Screenshot_t screenshot;
[FieldOffset(0)] public VREvent_ScreenshotProgress_t screenshotProgress;
[FieldOffset(0)] public VREvent_ApplicationLaunch_t applicationLaunch;
[FieldOffset(0)] public VREvent_EditingCameraSurface_t cameraSurface;
[FieldOffset(0)] public VREvent_MessageOverlay_t messageOverlay;
[FieldOffset(0)] public VREvent_Property_t property;
[FieldOffset(0)] public VREvent_HapticVibration_t hapticVibration;
[FieldOffset(0)] public VREvent_WebConsole_t webConsole;
[FieldOffset(0)] public VREvent_InputBindingLoad_t inputBinding;
[FieldOffset(0)] public VREvent_SpatialAnchor_t spatialAnchor;
[FieldOffset(0)] public VREvent_InputActionManifestLoad_t actionManifest;
[FieldOffset(0)] public VREvent_ProgressUpdate_t progressUpdate;
[FieldOffset(0)] public VREvent_ShowUI_t showUi;
[FieldOffset(0)] public VREvent_ShowDevTools_t showDevTools;
[FieldOffset(0)] public VREvent_HDCPError_t hdcpError;
[FieldOffset(0)] public VREvent_AudioVolumeControl_t audioVolumeControl;
[FieldOffset(0)] public VREvent_AudioMuteControl_t audioMuteControl;
[FieldOffset(0)] public VREvent_Keyboard_t keyboard; // This has to be at the end due to a mono bug
}
""")
print("""
[StructLayout(LayoutKind.Explicit)] public struct VROverlayIntersectionMaskPrimitive_Data_t
{
[FieldOffset(0)] public IntersectionMaskRectangle_t m_Rectangle;
[FieldOffset(0)] public IntersectionMaskCircle_t m_Circle;
}
""")
api_shared.outputstructs('vr', data)
# Output the OpenVR class
print('\npublic class OpenVR\n{')
print("""
public static uint InitInternal(ref EVRInitError peError, EVRApplicationType eApplicationType)
{
return OpenVRInterop.InitInternal(ref peError, eApplicationType);
}
public static uint InitInternal2(ref EVRInitError peError, EVRApplicationType eApplicationType, string pchStartupInfo)
{
return OpenVRInterop.InitInternal2(ref peError, eApplicationType, pchStartupInfo);
}
public static void ShutdownInternal()
{
OpenVRInterop.ShutdownInternal();
}
public static bool IsHmdPresent()
{
return OpenVRInterop.IsHmdPresent();
}
public static bool IsRuntimeInstalled()
{
return OpenVRInterop.IsRuntimeInstalled();
}
public static string RuntimePath()
{
try
{
uint pathSize = 512;
uint requiredPathSize = 512;
System.Text.StringBuilder path = new System.Text.StringBuilder((int)pathSize);
bool success = OpenVRInterop.GetRuntimePath(path, pathSize, ref requiredPathSize);
if (success == false)
{
return null;
}
return path.ToString();
} catch
{
return OpenVRInterop.RuntimePath(); //this api is deprecated but here to support older unity versions
}
}
public static string GetStringForHmdError(EVRInitError error)
{
return Marshal.PtrToStringAnsi(OpenVRInterop.GetStringForHmdError(error));
}
public static IntPtr GetGenericInterface(string pchInterfaceVersion, ref EVRInitError peError)
{
return OpenVRInterop.GetGenericInterface(pchInterfaceVersion, ref peError);
}
public static bool IsInterfaceVersionValid(string pchInterfaceVersion)
{
return OpenVRInterop.IsInterfaceVersionValid(pchInterfaceVersion);
}
public static uint GetInitToken()
{
return OpenVRInterop.GetInitToken();
}
""")
########
# Output constants into OpenVR class
for const in data['consts']:
if(len(const) > 0):
consttype = converttype(const['consttype'])
constval = const['constval']
if(consttype == 'string'):
constval = '\"' + constval + '\"'
print('public const '+consttype+' '+const['constname']+' = '+constval+';')
########
# Output static constructors into OpenVR class
#lastclass = ''
#lastmethod = ''
#for method in data['methods']:
# if (len(method) > 0):
# returntype = converttype(method['returntype'])
#
# methodname = method['methodname']
# if(methodname == lastmethod):
# methodname = methodname + `count`
# count = count + 1
# else:
# count = 0
# lastmethod = method['methodname']
#
# interfacename = method['classname']
# namespace = api_shared.getnamespace(interfacename)
# if(interfacename.find('::') == -1):
# classname= 'C' + interfacename[1:]
# else:
# interfacename = interfacename[interfacename.find('::') + 2:]
# classname = 'C' + interfacename[1:]
# if(namespace != ''):
# if(interfacename != lastclass):
# shortname = interfacename[1:]
# print('public static '+interfacename+' '+shortname+'()\n{\nreturn new '+classname+'(OpenVRInterop.'+shortname+'());\n}\n')
# lastclass = interfacename
########
# Output interface wrappers into OpenVR class
print("""
static uint VRToken { get; set; }
const string FnTable_Prefix = "FnTable:";
class COpenVRContext
{
public COpenVRContext() { Clear(); }
public void Clear()
{
m_pVRSystem = null;
m_pVRChaperone = null;
m_pVRChaperoneSetup = null;
m_pVRCompositor = null;
m_pVRHeadsetView = null;
m_pVROverlay = null;
m_pVROverlayView = null;
m_pVRRenderModels = null;
m_pVRExtendedDisplay = null;
m_pVRSettings = null;
m_pVRApplications = null;
m_pVRScreenshots = null;
m_pVRTrackedCamera = null;
m_pVRInput = null;
m_pVRIOBuffer = null;
m_pVRSpatialAnchors = null;
m_pVRNotifications = null;
m_pVRDebug = null;
}
void CheckClear()
{
if (VRToken != GetInitToken())
{
Clear();
VRToken = GetInitToken();
}
}
public CVRSystem VRSystem()
{
CheckClear();
if (m_pVRSystem == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRSystem_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRSystem = new CVRSystem(pInterface);
}
return m_pVRSystem;
}
public CVRChaperone VRChaperone()
{
CheckClear();
if (m_pVRChaperone == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRChaperone_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRChaperone = new CVRChaperone(pInterface);
}
return m_pVRChaperone;
}
public CVRChaperoneSetup VRChaperoneSetup()
{
CheckClear();
if (m_pVRChaperoneSetup == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRChaperoneSetup_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRChaperoneSetup = new CVRChaperoneSetup(pInterface);
}
return m_pVRChaperoneSetup;
}
public CVRCompositor VRCompositor()
{
CheckClear();
if (m_pVRCompositor == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRCompositor_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRCompositor = new CVRCompositor(pInterface);
}
return m_pVRCompositor;
}
public CVRHeadsetView VRHeadsetView()
{
CheckClear();
if (m_pVRHeadsetView == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRHeadsetView_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRHeadsetView = new CVRHeadsetView(pInterface);
}
return m_pVRHeadsetView;
}
public CVROverlay VROverlay()
{
CheckClear();
if (m_pVROverlay == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVROverlay_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVROverlay = new CVROverlay(pInterface);
}
return m_pVROverlay;
}
public CVROverlayView VROverlayView()
{
CheckClear();
if (m_pVROverlayView == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVROverlayView_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVROverlayView = new CVROverlayView(pInterface);
}
return m_pVROverlayView;
}
public CVRRenderModels VRRenderModels()
{
CheckClear();
if (m_pVRRenderModels == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRRenderModels_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRRenderModels = new CVRRenderModels(pInterface);
}
return m_pVRRenderModels;
}
public CVRExtendedDisplay VRExtendedDisplay()
{
CheckClear();
if (m_pVRExtendedDisplay == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRExtendedDisplay_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRExtendedDisplay = new CVRExtendedDisplay(pInterface);
}
return m_pVRExtendedDisplay;
}
public CVRSettings VRSettings()
{
CheckClear();
if (m_pVRSettings == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRSettings_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRSettings = new CVRSettings(pInterface);
}
return m_pVRSettings;
}
public CVRApplications VRApplications()
{
CheckClear();
if (m_pVRApplications == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRApplications_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRApplications = new CVRApplications(pInterface);
}
return m_pVRApplications;
}
public CVRScreenshots VRScreenshots()
{
CheckClear();
if (m_pVRScreenshots == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRScreenshots_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRScreenshots = new CVRScreenshots(pInterface);
}
return m_pVRScreenshots;
}
public CVRTrackedCamera VRTrackedCamera()
{
CheckClear();
if (m_pVRTrackedCamera == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRTrackedCamera_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRTrackedCamera = new CVRTrackedCamera(pInterface);
}
return m_pVRTrackedCamera;
}
public CVRInput VRInput()
{
CheckClear();
if (m_pVRInput == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRInput_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRInput = new CVRInput(pInterface);
}
return m_pVRInput;
}
public CVRIOBuffer VRIOBuffer()
{
CheckClear();
if (m_pVRIOBuffer == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRIOBuffer_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRIOBuffer = new CVRIOBuffer(pInterface);
}
return m_pVRIOBuffer;
}
public CVRSpatialAnchors VRSpatialAnchors()
{
CheckClear();
if (m_pVRSpatialAnchors == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRSpatialAnchors_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRSpatialAnchors = new CVRSpatialAnchors(pInterface);
}
return m_pVRSpatialAnchors;
}
public CVRDebug VRDebug()
{
CheckClear();
if (m_pVRDebug == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRDebug_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRDebug = new CVRDebug(pInterface);
}
return m_pVRDebug;
}
public CVRNotifications VRNotifications()
{
CheckClear();
if (m_pVRNotifications == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRNotifications_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRNotifications = new CVRNotifications(pInterface);
}
return m_pVRNotifications;
}
private CVRSystem m_pVRSystem;
private CVRChaperone m_pVRChaperone;
private CVRChaperoneSetup m_pVRChaperoneSetup;
private CVRCompositor m_pVRCompositor;
private CVRHeadsetView m_pVRHeadsetView;
private CVROverlay m_pVROverlay;
private CVROverlayView m_pVROverlayView;
private CVRRenderModels m_pVRRenderModels;
private CVRExtendedDisplay m_pVRExtendedDisplay;
private CVRSettings m_pVRSettings;
private CVRApplications m_pVRApplications;
private CVRScreenshots m_pVRScreenshots;
private CVRTrackedCamera m_pVRTrackedCamera;
private CVRInput m_pVRInput;
private CVRIOBuffer m_pVRIOBuffer;
private CVRSpatialAnchors m_pVRSpatialAnchors;
private CVRNotifications m_pVRNotifications;
private CVRDebug m_pVRDebug;
};
private static COpenVRContext _OpenVRInternal_ModuleContext = null;
static COpenVRContext OpenVRInternal_ModuleContext
{
get
{
if (_OpenVRInternal_ModuleContext == null)
_OpenVRInternal_ModuleContext = new COpenVRContext();
return _OpenVRInternal_ModuleContext;
}
}
public static CVRSystem System { get { return OpenVRInternal_ModuleContext.VRSystem(); } }
public static CVRChaperone Chaperone { get { return OpenVRInternal_ModuleContext.VRChaperone(); } }
public static CVRChaperoneSetup ChaperoneSetup { get { return OpenVRInternal_ModuleContext.VRChaperoneSetup(); } }
public static CVRCompositor Compositor { get { return OpenVRInternal_ModuleContext.VRCompositor(); } }
public static CVRHeadsetView HeadsetView { get { return OpenVRInternal_ModuleContext.VRHeadsetView(); } }
public static CVROverlay Overlay { get { return OpenVRInternal_ModuleContext.VROverlay(); } }
public static CVROverlayView OverlayView { get { return OpenVRInternal_ModuleContext.VROverlayView(); } }
public static CVRRenderModels RenderModels { get { return OpenVRInternal_ModuleContext.VRRenderModels(); } }
public static CVRExtendedDisplay ExtendedDisplay { get { return OpenVRInternal_ModuleContext.VRExtendedDisplay(); } }
public static CVRSettings Settings { get { return OpenVRInternal_ModuleContext.VRSettings(); } }
public static CVRApplications Applications { get { return OpenVRInternal_ModuleContext.VRApplications(); } }
public static CVRScreenshots Screenshots { get { return OpenVRInternal_ModuleContext.VRScreenshots(); } }
public static CVRTrackedCamera TrackedCamera { get { return OpenVRInternal_ModuleContext.VRTrackedCamera(); } }
public static CVRInput Input { get { return OpenVRInternal_ModuleContext.VRInput(); } }
public static CVRIOBuffer IOBuffer { get { return OpenVRInternal_ModuleContext.VRIOBuffer(); } }
public static CVRSpatialAnchors SpatialAnchors { get { return OpenVRInternal_ModuleContext.VRSpatialAnchors(); } }
public static CVRNotifications Notifications { get { return OpenVRInternal_ModuleContext.VRNotifications(); } }
public static CVRDebug Debug { get { return OpenVRInternal_ModuleContext.VRDebug(); } }
/** Finds the active installation of vrclient.dll and initializes it */
public static CVRSystem Init(ref EVRInitError peError, EVRApplicationType eApplicationType = EVRApplicationType.VRApplication_Scene, string pchStartupInfo= "")
{
try
{
VRToken = InitInternal2(ref peError, eApplicationType, pchStartupInfo);
}
catch (EntryPointNotFoundException)
{
VRToken = InitInternal(ref peError, eApplicationType);
}
OpenVRInternal_ModuleContext.Clear();
if (peError != EVRInitError.None)
return null;
bool bInterfaceValid = IsInterfaceVersionValid(IVRSystem_Version);
if (!bInterfaceValid)
{
ShutdownInternal();
peError = EVRInitError.Init_InterfaceNotFound;
return null;
}
return OpenVR.System;
}
/** unloads vrclient.dll. Any interface pointers from the interface are
* invalid after this point */
public static void Shutdown()
{
ShutdownInternal();
}
""")
print("}\n\n");
print ("""
}
#endif
""")