aboutsummaryrefslogtreecommitdiff
path: root/TestDLL/HuntClasses.h
blob: 6fb8e5cefe0c1c3dcafc63af6cae5e736136ed91 (plain)
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
#pragma once

#include <Windows.h>

#include <stdio.h>
#include <stdarg.h>
#include <string.h>


struct SSystemGlobalEnvironment {
	UINT64 pDialogSystem;
	UINT64 p3DEngine;
	UINT64 pNetwork;
	UINT64 pNetContext;
	UINT64 pLobby;
	UINT64 pScriptSystem;
	UINT64 pPhysicalWorld;
	UINT64 pFlowSystem;
	UINT64 pInput;
	UINT64 pStatoscope;
	UINT64 pCryPak;
	UINT64 pFileChangeMonitor;
	UINT64 pParticleManager;
	UINT64 pOpticsManager;
	UINT64 pTimer;
	UINT64 pCryFont;
	UINT64 pGameFramework;
	UINT64 pLocalMemoryUsage;
	UINT64 pEntitySystem;
	UINT64 pConsole;
	UINT64 pAudioSystem;
	UINT64 pSystem;
	UINT64 pCharacterManager;
	UINT64 pAISystem;
	UINT64 pLog;
	UINT64 pCodeCheckpointMgr;
	UINT64 pMovieSystem;
	UINT64 pNameTable;
	UINT64 pRenderer;
	UINT64 pAuxGeomRenderer;
	UINT64 pHardwareMouse;
	UINT64 pMaterialEffects;
	UINT64 pJobManager;
	UINT64 pOverloadSceneManager;
	UINT64 pFlashUI;
	UINT64 pUIFramework;
	UINT64 pServiceNetwork;
	UINT64 pRemoteCommandManager;
	UINT64 pDynamicResponseSystem;
	UINT64 pThreadManager;
	UINT64 pScaleformHelper;
	UINT64 pSchematyc;
	UINT64 pSchematyc2;
	UINT64 pReflection;
	UINT64 pScriptCoreEnv;
	UINT64 pScriptCoreRegistry;
	UINT64 pUDR;
	UINT64 pLiveCreateManager;
	UINT64 pLiveCreateHost;
	UINT64 pMonoRuntime;
	UINT32 mMainThreadId;
	UINT32 nMainFrameID;
	UINT64 szCmdLine;
	CHAR szDebugStatus[128];
	BOOL bServer;
	BOOL bMultiplayer;
	BOOL bHostMigrating;
	UCHAR padding_00;
	UINT64 startProfilingSection;
	UINT64 endProfilingSection;
	UINT64 recordProfilingMarker;
	BOOL bUnattendedMode;
	BOOL bTesting;
	BOOL bNoRandomSeed;
	UCHAR padding_01;
	UINT32 assertSettings;
	UCHAR platformInfo[286];
	UCHAR protectedFunctions[80];
	BOOL bIsOutOfMemory;
	BOOL bIsOutOfVideoMemory;
	BOOL bDedicatedArbitrator;
	BOOL bEditor;
	BOOL bEditorGameMode;
	BOOL bEditorSimulationMode;
	BOOL bDedicated;
	BOOL bClient;
	BOOL m_isFMVPlaying;
	BOOL m_isCutscenePlaying;
};

struct IEntitySystem
{
	enum SinkEventSubscriptions : UINT32
	{
		OnBeforeSpawn = 1,
		OnSpawn = 2,
		OnRemove = 4,
		OnReused = 8,

		Last = OnReused,
		Count = 4,

		AllSinkEvents = ~0u,
	};

	virtual ~IEntitySystem() {}
	virtual void Release() = 0;
	virtual void PrePhysicsUpdate() = 0;
	virtual void Update() = 0;
	virtual void Reset() = 0;
	virtual void Unload() = 0;
	virtual void PurgeHeaps() = 0;
	virtual void DeletePendingEntities() = 0;
	virtual PVOID GetClassRegistry() = 0;
	virtual PVOID GetReflectionRegistry() const = 0;
	virtual PVOID SpawnEntity(void) = 0;
	virtual bool InitEntity(void) = 0;
	virtual PVOID GetEntity(void) const = 0;
	virtual PVOID FindEntityByName(void) const = 0;
	virtual void ReserveEntityId(void) = 0;
	virtual int ReserveNewEntityId() = 0;
	virtual void RemoveEntity(void) = 0;
	virtual unsigned int GetNumEntities(void) const = 0;
	virtual PVOID GetEntityIterator() = 0;
	virtual void SendEventToAll(void) = 0;
	virtual void OnLevelLoaded() = 0;
	virtual void OnLevelGameplayStart() = 0;
	virtual int QueryProximity(void) = 0;
	virtual void ResizeProximityGrid(int, int) = 0;
	virtual int GetPhysicalEntitiesInBox(void) const = 0;
	virtual PVOID GetEntityFromPhysics(PVOID) const = 0;
	virtual void AddSink(PVOID) = 0;
	virtual void RemoveSink(PVOID) = 0;
	virtual void PauseTimers(bool bPause, bool bResume = false) = 0;
	virtual bool IsIDUsed(int) const = 0;
	virtual void GetMemoryStatistics(PVOID) const = 0;
	virtual PVOID GetSystem() const = 0;
	virtual bool ExtractArcheTypeLoadParams(void) const = 0;
	virtual bool ExtractEntityLoadParams(void) const = 0;
	virtual void BeginCreateEntities(int amtToCreate) = 0;
	virtual bool CreateEntity(void) = 0;
	virtual void EndCreateEntities() = 0;
	virtual void LoadEntities(bool bIsLoadingLevelFile) = 0;
	virtual void LoadEntities(bool bIsLoadingLevelFile, const int) = 0;
	virtual void AddEntityLayerListener(PVOID, PVOID, const bool bCaseSensitive = true) = 0;
	virtual void RemoveEntityLayerListener(PVOID, PVOID, const bool bCaseSensitive = true) = 0;
	virtual int FindEntityByGuid(int) const = 0;
	virtual PVOID GetAreaManager() const = 0;
	virtual PVOID GetBreakableManager() const = 0;
	virtual PVOID LoadEntityArchetype(void) = 0;
	virtual PVOID LoadEntityArchetype(const char* sArchetype) = 0;
	virtual void  UnloadEntityArchetype(const char* sArchetype) = 0;
	virtual PVOID CreateEntityArchetype(PVOID, const char* sArchetype) = 0;
	virtual void  RefreshEntityArchetypesInRegistry() = 0;
	virtual void  SetEntityArchetypeManagerExtension(PVOID) = 0;
	virtual PVOID GetEntityArchetypeManagerExtension() const = 0;
	virtual void Serialize(void) = 0;
	virtual void SetNextSpawnId(int id) = 0;
	virtual void ResetAreas() = 0;
	virtual void UnloadAreas() = 0;
	virtual void DumpEntities() = 0;
	virtual void LockSpawning(bool lock) = 0;
	virtual bool OnLoadLevel(const char* szLevelPath) = 0;
	virtual PVOID AddLayer(const char* szName, const char* szParent, UINT16 id, bool bHasPhysics, int specs, bool bDefaultLoaded) = 0;
	virtual void LoadLayers(const char* dataFile) = 0;
	virtual void LinkLayerChildren() = 0;
	virtual void AddEntityToLayer(const char* layer, int id) = 0;
	virtual void RemoveEntityFromLayers(int id) = 0;
	virtual void ClearLayers() = 0;
	virtual void EnableDefaultLayers(bool isSerialized = true) = 0;
	virtual void EnableLayer(const char* layer, bool isEnable, bool isSerialized = true) = 0;
	virtual void EnableLayerSet(const char* const* pLayers, size_t layerCount, bool isSerialized = true, PVOID pListener = nullptr) = 0;
	virtual void EnableScopedLayerSet(const char* const* pLayers, size_t layerCount, const char* const* pScopeLayers, size_t scopeLayerCount, bool isSerialized = true, PVOID pListener = nullptr) = 0;
	virtual PVOID FindLayer(const char* szLayerName, const bool bCaseSensitive = true) const = 0;
	virtual bool IsLayerEnabled(const char* layer, bool bMustBeLoaded, bool bCaseSensitive = true) const = 0;
	virtual bool ShouldSerializedEntity(PVOID pEntity) = 0;
	virtual void RegisterPhysicCallbacks() = 0;
	virtual void UnregisterPhysicCallbacks() = 0;
	virtual void PurgeDeferredCollisionEvents(bool bForce = false) = 0;
	virtual void ResumePhysicsForSuppressedEntities(bool bWakeUp) = 0;
	virtual void SaveInternalState(struct IDataWriteStream& writer) const = 0;
	virtual void LoadInternalState(struct IDataReadStream& reader) = 0;
	virtual int GetLayerId(const char* szLayerName) const = 0;
	virtual const char* GetLayerName(int layerId) const = 0;
	virtual int GetLayerChildCount(const char* szLayerName) const = 0;
	virtual const char* GetLayerChild(const char* szLayerName, int childIdx) const = 0;
	virtual int GetVisibleLayerIDs(UINT8* pLayerMask, const UINT32 maxCount) const = 0;
	virtual void ToggleLayerVisibility(const char* layer, bool isEnabled, bool includeParent = true) = 0;
	virtual void ToggleLayersBySubstring(const char* pSearchSubstring, const char* pExceptionSubstring, bool isEnable) = 0;
	virtual PVOID CreateBSPTree3D(void) = 0;
	virtual void ReleaseBSPTree3D(PVOID) = 0;

	//! Represents a unique identifier for a static entity loaded from disk
	//! Used to quickly identify static entities over the network, instead of needing to send over long GUIDs
	using StaticEntityNetworkIdentifier = UINT16;

	//! Queries an entity identifier from its static entity network id, most likely sent by the server
	virtual int GetEntityIdFromStaticEntityNetworkId(StaticEntityNetworkIdentifier id) const = 0;
};

template<typename T, int N>
struct INumberArray
{
};

template<typename T, int N, typename Final>
struct INumberVector : INumberArray<T, N>
{
};

template<typename T> struct Vec2_tpl;
template<class F> struct Vec2_tpl
	: INumberVector<F, 2, Vec2_tpl<F>>
{
	F x, y;
};
typedef Vec2_tpl<float> Vec2;

template<typename F> struct Vec3_tpl;
template<typename F> struct Vec3_tpl
	: INumberVector<F, 3, Vec3_tpl<F>>
{
	F x, y, z;
};
typedef Vec3_tpl<float> Vec3;

struct SDrawTextInfo
{
	//! One of EDrawTextFlags flags.
	int flags;

	//! Text color, (r,g,b,a) all members must be specified.
	float   color[4];
	Vec2    scale;
	PVOID   pFont;

	SDrawTextInfo()
	{
		flags = 0;
		color[0] = color[1] = color[2] = color[3] = 1;
		scale.x = 0.0f;
		scale.y = 0.0f;
		pFont = nullptr;
	}
};

template<class T> struct Color_tpl
{
	T r, g, b, a;
};
typedef Color_tpl<float> ColorF;

enum EDrawTextFlags : UINT32
{
	eDrawText_Default,
	eDrawText_Center = 1,
	eDrawText_Right = 2,
	eDrawText_CenterV = 4,
	eDrawText_Bottom = 8,
	eDrawText_2D = 16,
	eDrawText_FixedSize = 32,
	eDrawText_800x600 = 64,
	eDrawText_Monospace = 128,
	eDrawText_Framed = 256,
	eDrawText_DepthTest = 512,
	eDrawText_IgnoreOverscan = 1024,
	eDrawText_LegacyBehavior = 2048
};

class IRenderAuxGeom
{
public:
	virtual ~IRenderAuxGeom() {}
	virtual void SetRenderFlags(void) = 0;
	virtual void GetRenderFlags() = 0;
	virtual const void GetCamera() const = 0;
	virtual void SetCurrentDisplayContext(void) = 0;
	virtual void DrawPoint(void) = 0;
	virtual void DrawPoints(void) = 0;
	virtual void DrawPoints(int) = 0;
	virtual void DrawLine(void) = 0;
	virtual void DrawLines(void) = 0;
	virtual void DrawLines(int) = 0;
	virtual void DrawLines(int, int) = 0;
	virtual void DrawLines(int, int, int) = 0;
	virtual void DrawLines(int, int, int, int) = 0;
	virtual void DrawLineStrip(void) = 0;
	virtual void DrawPolyline(void) = 0;
	virtual void DrawPolyline(int) = 0;
	virtual void DrawTriangle(void) = 0;
	virtual void DrawTriangles(void) = 0;
	virtual void DrawTriangles(int) = 0;
	virtual void DrawTriangles(int, int) = 0;
	virtual void DrawTriangles(int, int, int) = 0;
	virtual void DrawBuffer(void) = 0;
	virtual void BeginDrawBuffer(void) = 0;
	virtual void EndDrawBuffer(void) = 0;
	virtual void DrawAABB(void) = 0;
	virtual void DrawAABBs(void) = 0;
	virtual void DrawAABB(int) = 0;
	virtual void DrawOBB(void) = 0;
	virtual void DrawOBB(int) = 0;
	virtual void DrawSphere(void) = 0;
	virtual void DrawCone(void) = 0;
	virtual void DrawCylinder(void) = 0;
	virtual void DrawBone(void) = 0;
	virtual void RenderTextQueued(Vec3 pos, const SDrawTextInfo& ti, const char* text) = 0;
	virtual int PushMatrix(void) = 0;
	virtual void PushImage(void) = 0;
	virtual int SetTexture(void) { return -1; }
	virtual void GetMatrix() = 0;
	virtual void SetMatrixIndex(void) = 0;
	virtual void Submit(void) = 0;
	virtual void SetOrthographicProjection(void) = 0;

	void RenderText(Vec3 pos, const SDrawTextInfo& ti, const char* format, va_list args)
	{
		if (format)
		{
			char str[512];

			vsnprintf(str, sizeof str, format, args);

			RenderTextQueued(pos, ti, str);
		}
	}

	void Draw2dLabel(float x, float y, float font_size, const ColorF& fColor, bool bCenter, const char* format, va_list args)
	{
		SDrawTextInfo ti;
		ti.scale.x = font_size;
		ti.scale.y = font_size;
		ti.flags = eDrawText_2D | eDrawText_800x600 | eDrawText_FixedSize | ((bCenter) ? eDrawText_Center : 0);
		ti.color[0] = fColor.r;
		ti.color[1] = fColor.g;
		ti.color[2] = fColor.b;
		ti.color[3] = fColor.a;
		Vec3 pos;
		pos.x = x;
		pos.y = y;
		pos.z = 0.5f;

		RenderText(pos, ti, format, args);
	}
};