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 class template and semaphore for shared memory #69

Closed morallo closed 2 years ago

morallo commented 2 years ago

Use a class template to define the SharedMem manager class. This allows to re-use exactly the same SharedMemTemplate.h code for sharing data between different hooks. You just need to create specific struct definitions that you pass to the SharedMem Template to create a dedicated manager object.

Instead of storing just a pointer to the heap in shared memory, put the whole shared structure in the memory mapped file for simplicity.

To signal the availability of data from the hook, use a binary semaphore. This is optional, it's up to the producer and consumer to use the IsDataReady() function.

This PR depends on https://github.com/JeremyAnsel/xwa_hooks/pull/9 and https://github.com/Prof-Butts/Hook_XWACockpitLook/pull/20