Enable VR on startup to specific runtime

Any issues, problems or troubleshooting topics related to the Prepar3D client application.
varjo_devops
Posts: 2
Joined: Fri May 10, 2019 10:02 am

Enable VR on startup to specific runtime

Postby varjo_devops » Mon May 13, 2019 12:47 pm

I'm working on automating a test scenario, and using EnableVirtualRealityOnStartup=1 to enable VR on startup. It seems to default to SteamVR, although I'd like to use another runtime. Where/how could I configure this?

User avatar
Beau Hollis
Lockheed Martin
Posts: 1885
Joined: Wed Oct 06, 2010 3:25 pm

Re: Enable VR on startup to specific runtime

Postby Beau Hollis » Mon May 13, 2019 1:51 pm

Unfortunately that setting currently enables VR with the SteamVR interface only. The IVRService in the SDK provides a function for enabling specific interfaces though. Using the SDK you could create a simple add-on dll to enable VR when loading is complete. For example, the add-on source to enable Varjo would look like this:
#include "initpdk.h"
#include "PdkPlugin.h"

class VRStartupPlugin : public P3D::PdkPlugin
{
---virtual void OnLoadComplete(P3D::IParameterListV400* pParams) override
---{
------P3D::PdkServices::GetVRService()->EnableVR(P3D::HMD_INTERFACES::VARJO);
---}
};

static VRStartupPlugin* s_pVRStartupPlugin = nullptr;

void __stdcall DLLStart(__in __notnull P3D::IPdk* pPdk)
{
---P3D::PdkServices::Init(pPdk);
---s_pVRStartupPlugin = new VRStartupPlugin();
}

void __stdcall DLLStop(void)
{
---if (s_pVRStartupPlugin != nullptr)
---{
------delete s_pVRStartupPlugin;
---}
---P3D::PdkServices::Shutdown();
}
Thanks
Beau
Beau Hollis
Prepar3D Software Architect

varjo_devops
Posts: 2
Joined: Fri May 10, 2019 10:02 am

Re: Enable VR on startup to specific runtime

Postby varjo_devops » Mon May 13, 2019 4:57 pm

Excellent, thank you!


Return to “Prepar3D Client Application Questions”

Who is online

Users browsing this forum: Exabot [Bot] and 9 guests