-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSharedMem.h
More file actions
91 lines (79 loc) · 2.44 KB
/
SharedMem.h
File metadata and controls
91 lines (79 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#pragma once
#include <windows.h>
#include "SharedMemTemplate.h"
struct SharedMemDataCockpitLook {
// Offset added to the current POV when VR is active. This is controlled by ddraw
float POVOffsetX, POVOffsetY, POVOffsetZ;
// Euler angles, in degrees, for the current camera matrix coming from SteamVR. This is
// written by CockpitLookHook:
float Yaw, Pitch, Roll;
// Positional tracking data. Written by CockpitLookHook:
float X, Y, Z;
// Flag to indicate that the reticle needs setup, to inhibit tracking and avoid roll messing with
// the pips positions.
// Set to 0 by ddraw when the game starts a mission (in OnSizeChanged())
// Set to 1 by a hook in the SetupReticle() XWA function.
int bIsReticleSetup;
// XWA units to meters conversion factor. Set by CockpitLook. Used to apply POVOffset
float povFactor;
SharedMemDataCockpitLook() {
this->POVOffsetX = 0.0f;
this->POVOffsetY = 0.0f;
this->POVOffsetZ = 0.0f;
this->Yaw = 0.0f;
this->Pitch = 0.0f;
this->Roll = 0.0f;
this->X = 0.0f;
this->Y = 0.0f;
this->Z = 0.0f;
this->bIsReticleSetup = 0;
this->povFactor = 25.0f;
}
};
constexpr int TLM_MAX_NAME = 120;
constexpr int TLM_MAX_CARGO = 80;
constexpr int TLM_MAX_SUBCMP = 80;
constexpr int TLM_MAX_SHIP_NAME = 40;
struct SharedMemDataTelemetry
{
int counter;
// Player stats
int shieldsFwd, shieldsBck;
// Target stats
int tgtShds, tgtSys, tgtHull;
float tgtDist;
char tgtName[TLM_MAX_NAME];
char tgtCargo[TLM_MAX_CARGO];
char tgtSubCmp[TLM_MAX_SUBCMP];
char shipName[TLM_MAX_SHIP_NAME];
float yawInertia;
float pitchInertia;
float rollInertia;
float accelInertia;
bool laserFired;
bool warheadFired;
SharedMemDataTelemetry()
{
counter = 0;
shieldsFwd = shieldsBck = -1;
tgtShds = tgtSys = tgtHull = 0;
tgtDist = 0;
tgtName[0] = 0;
tgtCargo[0] = 0;
tgtSubCmp[0] = 0;
shipName[0] = 0;
laserFired = false;
warheadFired = false;
yawInertia = 0;
pitchInertia = 0;
rollInertia = 0;
accelInertia = 0;
};
};
void InitSharedMem();
constexpr auto SHARED_MEM_NAME_COCKPITLOOK = L"Local\\CockpitLookHook";
constexpr auto SHARED_MEM_NAME_TELEMETRY = L"Local\\XWATelemetry";
extern SharedMem<SharedMemDataCockpitLook> g_SharedMem;
extern SharedMemDataCockpitLook* g_SharedData;
extern SharedMem<SharedMemDataTelemetry> g_SharedMemTelemetry;
extern SharedMemDataTelemetry* g_pSharedDataTelemetry;