-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathMumbleLink.h
134 lines (114 loc) · 3.04 KB
/
MumbleLink.h
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#pragma once
#include "Bedrock/baselib/baselib.h"
struct MumbleContext
{
unsigned char serverAddress[ 28 ]; // contains sockaddr_in or sockaddr_in6
uint32_t mapId;
uint32_t mapType;
uint32_t shardId;
uint32_t instance;
uint32_t buildId;
// Additional data beyond the 48 bytes Mumble uses for identification
uint32_t uiState; // Bitmask: Bit 1 = IsMapOpen, Bit 2 = IsCompassTopRight, Bit 3 = DoesCompassHaveRotationEnabled, Bit 4 = Game has focus, Bit 5 = Is in Competitive game mode, Bit 6 = Textbox has focus, Bit 7 = Is in Combat
uint16_t compassWidth; // pixels
uint16_t compassHeight; // pixels
float compassRotation; // radians
float playerX; // continentCoords
float playerY; // continentCoords
float mapCenterX; // continentCoords
float mapCenterY; // continentCoords
float mapScale;
uint32_t processId;
uint8_t mountIndex;
};
struct CompassData
{
int compassWidth; // pixels
int compassHeight; // pixels
float compassRotation; // guessing... radians? :-P
float playerX; // continentCoords
float playerY; // continentCoords
float mapCenterX; // continentCoords
float mapCenterY; // continentCoords
float mapScale; // not even sure TBH :-P};
CMatrix4x4 BuildTransformationMatrix( const CRect& miniRect, bool ignoreRotation );
};
struct LinkedMem
{
#ifdef WIN32
UINT32 uiVersion;
DWORD uiTick;
#else
uint32_t uiVersion;
uint32_t uiTick;
#endif
float fAvatarPosition[ 3 ];
float fAvatarFront[ 3 ];
float fAvatarTop[ 3 ];
wchar_t name[ 256 ];
float fCameraPosition[ 3 ];
float fCameraFront[ 3 ];
float fCameraTop[ 3 ];
wchar_t identity[ 256 ];
#ifdef WIN32
UINT32 context_len;
#else
uint32_t context_len;
#endif
unsigned char context[ 256 ];
wchar_t description[ 2048 ];
};
#define AVGCAMCOUNTER 6
class CMumbleLink
{
LinkedMem* lm = NULL;
CVector4 camchardist[ AVGCAMCOUNTER ];
public:
LinkedMem lastData;
LinkedMem prevData;
int tick;
double interpolation;
CVector3 charPosition;
CVector3 charEye;
CVector3 camPosition;
CVector3 camDir;
CVector3 camUp;
TF32 fov;
TS32 mapID = 0;
TS32 worldID = 0;
TS32 mapType = 0;
TS32 mapInstance = 0;
TS32 charIDHash = 0;
TS32 lastMapChangeTime = 0;
bool isMapOpen; // bit 1: IsMapOpen, bit2: IsCompassTopRight, bit3: DoesCompassHaveRotationEnabled
bool isMinimapTopRight;
bool isMinimapRotating;
bool gameHasFocus;
bool isPvp;
bool textboxHasFocus;
bool isInCombat;
CompassData miniMap;
CompassData bigMap;
TS32 uiSize = 1;
CString charName;
CVector4 averagedCharPosition;
bool Update();
TBOOL IsValid();
CRingBuffer<TS32>* frameTimes;
TF32 GetFrameRate();
TS32 lastFrameTime = 0;
CMumbleLink();
virtual ~CMumbleLink();
TU64 lastTickTime = 0;
TU64 lastTickLength = 0;
TBOOL charPosChanged = false;
TBOOL charEyeChanged = false;
TBOOL camPosChanged = false;
TBOOL camDirChanged = false;
TBOOL camUpChanged = false;
CString mumblePath = L"MumbleLink";
TU32 lastGW2ProcessID = 0;
};
extern CMumbleLink mumbleLink;
CRect GetMinimapRectangle();
void ChangeUIScale( int size );