0

Working with ScriptDragon to try and attempt to put some HTC vive functionality in to Skyrim using OpenVR.

What I have working. Able to initialize the Headset, as in no errors return and the pointer to the headset object is not null, and the vive light turns from red to green when I go in to the game.

Working

void InitHMD(vr::IVRSystem* hmd)
{
    vr::EVRInitError eError = vr::VRInitError_None;
    hmd = vr::VR_Init(&eError, vr::VRApplication_Other);

    if (eError != vr::VRInitError_None)
    {
        PrintNote("Error: %s", eError);
    }
    else
    {
        PrintNote("HMD succesfully initialized");
    }
    //extra chech for my own sanity
    if (hmd == nullptr)
    {
        PrintNote("NULL POINTER HMD");
    }
    else
    {
        PrintNote("HMD pointer set");
    }

}

Running the game text props show that the HMD pointer is set and it was successfully initialized. Full source available here. When ever the home Key is pressed it calls the hmd member function and suddenly breaks.

Not Working After Init

bool temp = hmd->IsInputFocusCapturedByAnotherProcess();

What doesn't work is that as soon as I try to access any of the member functions it crashes the game leading me to believe I have not initialized the headset fully or there is a problem with memory allocation.

I have the linker properties and includes set up and all external files where they should be.

ScriptDragon shouldn't be the problem as someone else has done something similar with the razer hydra and in their source, is able to call member functions within there api.

Krzysztof Bociurko
  • 4,575
  • 2
  • 26
  • 44
Zecbmo
  • 71
  • 1
  • 8
  • Is the not-working code in another function? Note that you pass `hmd` by-value to `InitHMD` and change it in the function's body, so the new value of `hmd` will not be available to the calling function. – Karsten Koop May 02 '16 at 11:21
  • vr::IVRSystem* hmd; InitHMD(hmd); I pass it in a s a pointer. It is declared in the main function and hmd->functions are called in the main function – Zecbmo May 02 '16 at 11:30
  • Edit:: You are correct. I changed the function to return a pointer to the HMD and it works as expected now. I need to read up on pointers again! – Zecbmo May 02 '16 at 12:40

0 Answers0