ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.09k stars 1.28k forks source link

OpenVR can't initialize when running in a Windows Store App #238

Open LibreVR opened 8 years ago

LibreVR commented 8 years ago

When trying to use OpenVR in a Windows Store App calling VR_Init() results in several errors due to the UWP sandbox.

The first error is VRInitError_Init_PathRegistryNotFound, which is caused by the fact that OpenVR looks for the openvr\openvrpaths.vrpath file in the data directory of the Windows App package at AppData\Local\Packages\<package>\AC\openvr\openvrpaths.vrpath while it's actually located at AppData\Local\openvr\openvrpaths.vrpath. Simply copying this file to the right location works around this error.

The second error is VRInitError_IPC_ServerInitFailed, which seems to be caused by an IPC failure to detect whether the server is running. And the sandbox doesn't allow OpenVR to simply create the server process. I haven't found a workaround for this error yet.

AndyAdshead commented 8 years ago

As a workaround to the second issue couldn't you just make a wrapper support application through App Services or LaunchUriForResultsAsync? I don't have the time at present to download the code and have a look myself however I used a similar workaround for another, unfortunately, NDA'ed project I have done recently so I could get access to an existing service. In our case we just ported the code to an App Service if memory serves me right (I lucked out and worked on more interesting stuff) as it gave better results but hopefully it's a pointer in the right direction. Man UWP coding is a pain.

LibreVR commented 8 years ago

@AndyAdshead I've considered using a support application, but things like submitting rendered frames would become quite difficult. It would also be redundant, because OpenVR already communicates to a support application, namely the VR server.

It would be a lot more convenient if OpenVR could simply communicate with the VR server from within the UWP sandbox. This is something the Oculus Runtime can already do, though it's not officially supported yet.

AndyAdshead commented 8 years ago

Any update on that downvote @LibreVR? Is there a reason it's not working?

LibreVR commented 8 years ago

@AndyAdshead It seemed like @jimx78 was giving an upvote for the issue by adding a comment instead of just using an upvote reaction.

LibreVR commented 8 years ago

@JoeLudwig It seems the latest Oculus SDK adds a missing sample called OculusRoomTiny (UWP+DX11). So while it's not officially supported yet, it does seem that they have internally developed support for it.

TheModdersDen commented 7 years ago

Any news?

Mayhem50 commented 6 years ago

I'm porting our old 3D engine opengl 3.0 features to DirectX12. We also make some VR based on openvr for Vive and Rift. I develop an UWP app arround this engine and I need to port the VR part too. But as I can see so far, this is impossible. I haven't found any solution.

Have you found any solution ?

NuShrike commented 2 years ago

Tried calling the API in a C++/WinRT UWP app. Same problem. May have to resort to app-services, or drop back to WPF.

Works fine in c++/winrt console app.