Enable VR on startup to specific runtime

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

Enable VR on startup to specific runtime

Post by varjo_devops »

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: 2452
Joined: Wed Oct 06, 2010 3:25 pm

Re: Enable VR on startup to specific runtime

Post by Beau Hollis »

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

Post by varjo_devops »

Excellent, thank you!
Post Reply