'File' HMD driver for integration with homebrew setups #359
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This driver aims to allow a user to very quickly homebrew a 3DOF or 6DOF driver for a 'pure HMD' arrangement.
In addition, even without a custom driver per-se, it can also serve as something of a "configurable dummy driver" without being marked as a dummy driver (important for use with Monado).
In particular, I have found a use for this with Moonlight/Sunshine to stream to a "Cardboard-ish" headset, and an Android application ( https://gitlab.com/20kdc/gridlock-utopia/-/tree/master/mobile?ref_type=heads ) to stream back data to be written ( https://gitlab.com/20kdc/gridlock-utopia/-/blob/master/station3.py?ref_type=heads ).
Implementing support for the network protocol used above was considered, but ultimately I decided it wasn't likely to be even vaguely upstreamable - unexpected WinSock initialization could cause trouble for the parent application, and the protocol I used streams Android-specific data over OSC (changing the sensors was useful while trying to find a working setup).
This approach works for Monado and Neverball. (However, Sunshine limitations require the monitor to be occupied as the VR view. Therefore, for Monado, it is in practice required to use an input that 'bypasses' mouse focus, such as a gamepad. For Neverball, however, everything works.)
The driver can be activated by pointing
OPENHMD_FILEDEV_0
(...)OPENHMD_FILEDEV_31
at a valid file. This mechanism, while crude, is well-supported on all target operating systems and easy to work with. The file format is essentially a machine-dependent C struct, but there are no alignment issues, so it is easily written by various languages (ByteBuffer
in Java,struct
in Python,string.pack
in Lua).The driver stores rotations as Euler angles, in radians. This was also chosen to be easy to work with.