README.md
1OpenVR SDK
2---
3
4OpenVR is an API and runtime that allows access to VR hardware from multiple
5vendors without requiring that applications have specific knowledge of the
6hardware they are targeting. This repository is an SDK that contains the API
7and samples. The runtime is under SteamVR in Tools on Steam.
8
9### Documentation
10
11Documentation for the API is available on the [Github Wiki](https://github.com/ValveSoftware/openvr/wiki/API-Documentation)
12
13More information on OpenVR and SteamVR can be found on http://steamvr.com
14
README.mozilla
1This directory contains files from the OpenVR SDK, version 1.11.11.
2
3This SDK contains the OpenVR API interface headers and functions to load the
4OpenVR runtime libraries which actually implement the functionality. The
5loading functions parse a .json file in a pre-defined location on the
6end-user's machine to get details used to bind the correct runtime library.
7The OpenVR implementation ensures forward and backwards compatibility as of
8the current version.
9
10Updated versions of the OpenVR SDK are available on Github:
11
12https://github.com/ValveSoftware/openvr
13
14
15We only use some files from the SDK:
16
17- We strip out files such as C# headers, plain C API versions, and files
18 needed only when implementing OpenVR drivers.
19
20- CMake related files, such as CMakeLists.txt are skipped as we use moz.build
21 files to configure the library.
22
23- The "src/jsoncpp.cpp" file and the "src/json" directory can be skipped. OpenVR
24 uses the jsoncpp library, which we have already imported elsewhere. If
25 warnings about using deprecated jsoncpp classes show up during compilation
26 you might need to reapply the patch in bug 1598288. It replaces uses of the
27 `Json::Reader` and `Json::StyledWriter` classes with the more modern
28 `Json::CharReaderBuilder` and `Json::StreamWriterBuilder`.
29
30
31Steps to update the library:
32
33- Copy "README.md" from the root of the openvr repo to the "gfx/vr/service/openvr"
34 directory.
35
36- Copy "headers/openvr.h" to "gfx/vr/service/openvr/headers" directory. The other files
37 in this directory can be ignored.
38
39- The rest of the files in the "src" directory and the "src/vrcommon" are copied
40 to the "gfx/vr/service/openvr/src" directory.
41
42- Update "gfx/vr/service/openvr/moz.build" when files are added or removed.
43
44- Update the "strtools_public.h" and "strtools_public.cpp" files, commenting out
45 the "Uint64ToString", "wcsncpy_s", and "strncpy_s" functions.
46 The "Uint64ToString" function name conflicts with another used in Gecko and
47 the "errno_t" return type returned by the other functions is not defined in
48 Mozilla's macOS continuous integration build environments. Fortunately, the
49 OpenVR SDK does not use these functions.
50
51- Replace the #define VR_INTERFACE in openvr.h to avoid extern'ing the functions.
52 Unlike the usual OpenVR API builds, we are not building a separate dll.
53
54- Add explicit in CVRSettingHelper constructor.
55
56- In strtools_public.cpp/.h, ensure that UTF16to8 and UTF8to16 are only
57 compiled under
58 #if defined( _WIN32 )
59 and redefine those functions to use ::WideCharToMultiByte and
60 MultiByteToWideChar, respectively. These are modified because the original
61 implementations contain unsupported try-catch.
62
63- In strtools_public.cpp, remove the definition of convert_type.
64
65- In strtools_public.cpp, remove the include of <codecvt>, as this causes
66 problems in compiling on Linux.
67
68- In pathtools_public.cpp/.h, comment out Path_UrlToFilePath and
69 Path_FilePathToUrl to avoid a compile error because 'alloca' isn't defined.
70
71- In vrpathregistry_public.cpp, CVRPathRegistry_Public::BLoadFromFile contains
72 a try-catch, which is not permitted. This code is simply commented out, but
73 Bug 1640068 - OpenVR code can fail JSON parsing and raise exceptions
74 is filed to address a safe fallback in the error condition.
75
76- Update this README.mozilla file with the new OpenVR SDK version and any
77 additional steps needed for newer versions.
78
79- Ensure that any changes made within the OpenVR files have comments including
80 the string "Mozilla" and reference this file for easy identification.
81