Prof-Butts / xwa_ddraw_d3d11

Direct3D 11 implementation of DDraw.dll for XWA with VR support and New Shaders
MIT License
6 stars 4 forks source link

Use pose from cockpitlook shared memory #35

Closed morallo closed 3 years ago

morallo commented 3 years ago

Using the shared memory functions included by @Prof-Butts, share the trackedDevicePose obtained by CockpitLook and use it in ddraw.

Status: pitch, yaw, x,y,z work, but roll is broken (seems to be fixed to 0).

morallo commented 3 years ago

Requires merging https://github.com/Prof-Butts/Hook_XWACockpitLook/pull/5

The problem with the roll was in fact that the pose obtained from shared memory was invalid. The pointer was to a local variable in cockpitlook, so by the time ddraw wanted to access the data, it was not there. I created a global variable in Hook_XWACockpitLook to store the HMD pose.

Prof-Butts commented 3 years ago

Hello!

In general terms, this looks good, but I've got a few comments:

The g_pSharedData->bDataReady flag is not intended to be set to false on each frame. The meaning of this flag is to say "The shared memory has been set up and is ready to be used". So it's set to true once, during startup, and that's it. If the pose itself needs another flag that tells us when the pose is valid, then it should be part of the data placed in shared memory.

I see that you added a new global called g_hmdPose, but I didn't see how g_SharedMem is taking the address of that variable so that its contents can be shared. I probably missed it, so I'll take a look again later.

Thanks for taking care of this!