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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
#pragma once
#include <Windows.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
struct ISystem;
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 ISystem* 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);
}
};
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;
IEntitySystem* pEntitySystem;
UINT64 pConsole;
UINT64 pAudioSystem;
ISystem* 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 ISystem
{
struct ILoadingProgressListener
{
virtual ~ILoadingProgressListener() {}
virtual void OnLoadingProgress(int steps) = 0;
};
virtual ~ISystem() {}
virtual PVOID GetCVarsWhiteListConfigSink() const = 0;
virtual SSystemGlobalEnvironment* GetGlobalEnvironment() = 0;
virtual PVOID GetUserCallback() const = 0;
virtual const char* GetRootFolder() const = 0;
virtual bool DoFrame(void) = 0;
virtual void RenderBegin(void) = 0;
virtual void RenderEnd(bool bRenderStats = true) = 0;
virtual bool Update(int updateFlags, int nPauseMode = 0) = 0;
virtual void RenderPhysicsHelpers() = 0;
virtual PVOID GetManualFrameStepController() const = 0;
virtual bool UpdateLoadtime() = 0;
virtual void SynchronousLoadingTick(const char* pFunc, int line) = 0;
virtual void RenderStatistics() = 0;
virtual void RenderPhysicsStatistics(PVOID pWorld) = 0;
virtual UINT32 GetUsedMemory() = 0;
virtual const char* GetUserName() = 0;
virtual UINT32 GetCPUFlags() = 0;
virtual int GetLogicalCPUCount() = 0;
virtual void DumpMemoryUsageStatistics(bool bUseKB = false) = 0;
virtual void Quit() = 0;
virtual void Relaunch(bool bRelaunch) = 0;
virtual bool IsQuitting() const = 0;
virtual bool IsShaderCacheGenMode() const = 0;
virtual void SerializingFile(int mode) = 0;
virtual int IsSerializingFile() const = 0;
virtual bool IsRelaunch() const = 0;
virtual void DisplayErrorMessage(const char* acMessage, float fTime, const float* pfColor = 0, bool bHardError = true) = 0;
virtual void FatalError(const char* sFormat, ...) = 0;
virtual void ReportBug(const char* sFormat, ...) = 0;
virtual void WarningV(int module, int severity, int flags, const char* file, const char* format, va_list args) = 0;
virtual void Warning(int module, int severity, int flags, const char* file, const char* format, ...) = 0;
virtual void WarningOnce(int module, int severity, int flags, const char* file, const char* format, ...) = 0;
virtual bool CheckLogVerbosity(int verbosity) = 0;
virtual bool IsUIFrameworkMode() { return false; }
virtual void FillRandomMT(UINT32* pOutWords, UINT32 numWords) = 0;
virtual PVOID GetRandomGenerator() = 0;
virtual PVOID GetIZLibCompressor() = 0;
virtual PVOID GetIZLibDecompressor() = 0;
virtual PVOID GetLZ4Decompressor() = 0;
virtual PVOID GetPerfHUD() = 0;
virtual PVOID GetMiniGUI() = 0;
virtual PVOID GetPlatformOS() = 0;
virtual PVOID GetINotificationNetwork() = 0;
virtual PVOID GetIHardwareMouse() = 0;
virtual PVOID GetIDialogSystem() = 0;
virtual PVOID GetIFlowSystem() = 0;
virtual PVOID GetIBudgetingSystem() = 0;
virtual PVOID GetINameTable() = 0;
virtual PVOID GetIDiskProfiler() = 0;
virtual PVOID GetProfilingSystem() = 0;
virtual PVOID GetLegacyProfilerInterface() = 0;
virtual PVOID GetIValidator() = 0;
virtual PVOID GetIPhysicsDebugRenderer() = 0;
virtual PVOID GetIPhysRenderer() = 0;
virtual PVOID GetIAnimationSystem() = 0;
virtual PVOID GetStreamEngine() = 0;
virtual PVOID GetICmdLine() = 0;
virtual PVOID GetILog() = 0;
virtual PVOID GetIPak() = 0;
virtual PVOID GetICryFont() = 0;
virtual IEntitySystem* GetIEntitySystem() = 0;
virtual PVOID GetIMemoryManager() = 0;
virtual PVOID GetAISystem() = 0;
virtual PVOID GetIMovieSystem() = 0;
virtual PVOID GetIPhysicalWorld() = 0;
virtual PVOID GetIAudioSystem() = 0;
virtual PVOID GetI3DEngine() = 0;
virtual PVOID GetIScriptSystem() = 0;
virtual PVOID GetIConsole() = 0;
virtual PVOID GetIRemoteConsole() = 0;
virtual PVOID GetIUserAnalyticsSystem() = 0;
virtual PVOID GetIPluginManager() = 0;
virtual PVOID GetIProjectManager() = 0;
virtual PVOID GetIUDR() = 0;
virtual PVOID GetIResourceManager() = 0;
virtual PVOID GetISystemEventDispatcher() = 0;
virtual PVOID GetIFileChangeMonitor() = 0;
virtual PVOID GetHWND() = 0;
virtual PVOID GetActiveHWND() = 0;
virtual PVOID GetINetwork() = 0;
virtual PVOID GetIRenderer() = 0;
virtual PVOID GetIInput() = 0;
virtual PVOID GetITimer() = 0;
virtual PVOID GetIThreadManager() = 0;
virtual PVOID GetIMonoEngineModule() = 0;
/* some more virtual functions */
};
|