DDraceNetwork Docs
client.h
Go to the documentation of this file.
1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3#ifndef ENGINE_CLIENT_CLIENT_H
4#define ENGINE_CLIENT_CLIENT_H
5
6#include <deque>
7#include <memory>
8
9#include <base/hash.h>
10
11#include <engine/client.h>
14#include <engine/client/ghost.h>
17#include <engine/editor.h>
18#include <engine/graphics.h>
20#include <engine/shared/demo.h>
21#include <engine/shared/fifo.h>
22#include <engine/shared/http.h>
24#include <engine/textrender.h>
25#include <engine/warning.h>
26
27#include "graph.h"
28#include "smooth_time.h"
29
30class CDemoEdit;
31class IDemoRecorder;
32class CMsgPacker;
33class CUnpacker;
34class IConfigManager;
35class IDiscord;
36class IEngine;
37class IEngineInput;
38class IEngineMap;
39class IEngineSound;
40class IFriends;
41class ILogger;
42class ISteam;
43class INotifications;
44class IStorage;
45class IUpdater;
46
47#define CONNECTLINK_DOUBLE_SLASH "ddnet://"
48#define CONNECTLINK_NO_SLASH "ddnet:"
49
51{
52public:
53 bool m_ChatTimeoutCode = false;
54 bool m_AnyPlayerFlag = false;
55 bool m_PingEx = false;
56 bool m_AllowDummy = false;
57 bool m_SyncWeaponInput = false;
58};
59
61{
62 // needed interfaces
64 CConfig *m_pConfig = nullptr;
65 IConsole *m_pConsole = nullptr;
66 IDiscord *m_pDiscord = nullptr;
67 IEditor *m_pEditor = nullptr;
68 IEngine *m_pEngine = nullptr;
73 IEngineMap *m_pMap = nullptr;
75 ISteam *m_pSteam = nullptr;
77 IStorage *m_pStorage = nullptr;
79 IUpdater *m_pUpdater = nullptr;
81
92
94
96 bool m_Sixup;
97
98 bool m_HaveGlobalTcpAddr = false;
100
101 uint64_t m_aSnapshotParts[NUM_DUMMIES] = {0, 0};
102 int64_t m_LocalStartTime = 0;
103 int64_t m_GlobalStartTime = 0;
104
106
108
112 bool m_AutoCSVRecycle = false;
113 bool m_EditorActive = false;
114
118 char m_aRconUsername[32] = "";
119 char m_aRconPassword[sizeof(g_Config.m_SvRconPassword)] = "";
123 char m_aPassword[sizeof(g_Config.m_Password)] = "";
124 bool m_SendPassword = false;
125
126 // version-checking
127 char m_aVersionStr[10] = "0";
128
129 // pinging
130 int64_t m_PingStartTime = 0;
131
134
135 char m_aTimeoutCodes[NUM_DUMMIES][32] = {"", ""};
136 bool m_aCodeRunAfterJoin[NUM_DUMMIES] = {false, false};
138
139 char m_aCmdConnect[256] = "";
142
143 // map download
144 char m_aMapDownloadUrl[256] = "";
145 std::shared_ptr<CHttpRequest> m_pMapdownloadTask = nullptr;
148 char m_aMapdownloadName[256] = "";
156
158 char m_aMapDetailsName[256] = "";
161 char m_aMapDetailsUrl[256] = "";
162
163 std::shared_ptr<CHttpRequest> m_pDDNetInfoTask = nullptr;
164
165 // time
168
169 // input
170 struct // TODO: handle input better
171 {
172 int m_aData[MAX_INPUT_SIZE]; // the input data
173 int m_Tick; // the tick that the input is for
174 int64_t m_PredictedTime; // prediction latency when we sent this input
175 int64_t m_PredictionMargin; // prediction margin when we sent this input
176 int64_t m_Time;
178
180 bool m_LastDummy = false;
182 bool m_DummyConnecting = false;
183 bool m_DummyConnected = false;
187
188 // graphs
192
193 // the game snapshots are modifiable by the game
196
200
203
205
206 std::deque<std::shared_ptr<CDemoEdit>> m_EditJobs;
207
208 //
212
214
216 int64_t m_CurrentServerInfoRequestTime = -1; // >= 0 should request, == -1 got info
217
222 int64_t m_CurrentServerCurrentPingTime = -1; // >= 0 request running
223 int64_t m_CurrentServerNextPingTime = -1; // >= 0 should request
224
225 // version info
227 {
228 enum
229 {
233 };
234
237
238 std::vector<SWarning> m_vWarnings;
239 std::vector<SWarning> m_vQuittingWarnings;
240
242
245
249
250 // favorite command handling
251 bool m_FavoritesGroup = false;
255
257 int MaxLatencyTicks() const;
258 int PredictionMargin() const;
259
260 std::shared_ptr<ILogger> m_pFileLogger = nullptr;
261 std::shared_ptr<ILogger> m_pStdoutLogger = nullptr;
262
263 // For DummyName function
265
266public:
268 CConfig *Config() { return m_pConfig; }
270 IEngine *Engine() { return m_pEngine; }
275 ISteam *Steam() { return m_pSteam; }
280 IHttp *Http() { return &m_Http; }
281
282 CClient();
283
284 // ----- send functions -----
285 int SendMsg(int Conn, CMsgPacker *pMsg, int Flags) override;
286 // Send via the currently active client (main/dummy)
287 int SendMsgActive(CMsgPacker *pMsg, int Flags) override;
288
289 void SendInfo(int Conn);
290 void SendEnterGame(int Conn);
291 void SendReady(int Conn);
292 void SendMapRequest();
293
294 bool RconAuthed() const override { return m_aRconAuthed[g_Config.m_ClDummy] != 0; }
295 bool UseTempRconCommands() const override { return m_UseTempRconCommands != 0; }
296 void RconAuth(const char *pName, const char *pPassword, bool Dummy = g_Config.m_ClDummy) override;
297 void Rcon(const char *pCmd) override;
298 bool ReceivingRconCommands() const override { return m_ExpectedRconCommands > 0; }
299 float GotRconCommandsPercentage() const override;
300
301 bool ConnectionProblems() const override;
302
304
305 void SendInput();
306
307 // TODO: OPT: do this a lot smarter!
308 int *GetInput(int Tick, int IsDummy) const override;
309
310 const char *LatestVersion() const override;
311
312 // ------ state handling -----
314
315 // called when the map is loaded and we should init for a new round
316 void OnEnterGame(bool Dummy);
317 void EnterGame(int Conn) override;
318
319 void Connect(const char *pAddress, const char *pPassword = nullptr) override;
320 void DisconnectWithReason(const char *pReason);
321 void Disconnect() override;
322
323 void DummyDisconnect(const char *pReason) override;
324 void DummyConnect() override;
325 bool DummyConnected() const override;
326 bool DummyConnecting() const override;
327 bool DummyConnectingDelayed() const override;
328 bool DummyAllowed() const override;
329
330 void GetServerInfo(CServerInfo *pServerInfo) const override;
331 void ServerInfoRequest();
332
333 void LoadDebugFont();
334
335 // ---
336
337 int GetPredictionTime() override;
338 CSnapItem SnapGetItem(int SnapId, int Index) const override;
339 const void *SnapFindItem(int SnapId, int Type, int Id) const override;
340 int SnapNumItems(int SnapId) const override;
341 void SnapSetStaticsize(int ItemType, int Size) override;
342 void SnapSetStaticsize7(int ItemType, int Size) override;
343
344 void Render();
345 void DebugRender();
346
347 void Restart() override;
348 void Quit() override;
349
350 const char *PlayerName() const override;
351 const char *DummyName() override;
352 const char *ErrorString() const override;
353
354 const char *LoadMap(const char *pName, const char *pFilename, SHA256_DIGEST *pWantedSha256, unsigned WantedCrc);
355 const char *LoadMapSearch(const char *pMapName, SHA256_DIGEST *pWantedSha256, int WantedCrc);
356
357 int TranslateSysMsg(int *pMsgId, bool System, CUnpacker *pUnpacker, CPacker *pPacker, CNetChunk *pPacket, bool *pIsExMsg);
358
359 void ProcessConnlessPacket(CNetChunk *pPacket);
360 void ProcessServerInfo(int Type, NETADDR *pFrom, const void *pData, int DataSize);
361 void ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy);
362
364
365 void ResetMapDownload(bool ResetActive);
366 void FinishMapDownload();
367
368 void RequestDDNetInfo() override;
369 void ResetDDNetInfoTask();
370 void FinishDDNetInfo();
371 void LoadDDNetInfo();
372
373 bool IsSixup() const override { return m_Sixup; }
374
375 const NETADDR &ServerAddress() const override { return *m_aNetClient[CONN_MAIN].ServerAddress(); }
376 int ConnectNetTypes() const override;
377 const char *ConnectAddressString() const override { return m_aConnectAddressStr; }
378 const char *MapDownloadName() const override { return m_aMapdownloadName; }
379 int MapDownloadAmount() const override { return !m_pMapdownloadTask ? m_MapdownloadAmount : (int)m_pMapdownloadTask->Current(); }
380 int MapDownloadTotalsize() const override { return !m_pMapdownloadTask ? m_MapdownloadTotalsize : (int)m_pMapdownloadTask->Size(); }
381
382 void PumpNetwork();
383
384 void OnDemoPlayerSnapshot(void *pData, int Size) override;
385 void OnDemoPlayerMessage(void *pData, int Size) override;
386
387 void Update();
388
389 void RegisterInterfaces();
390 void InitInterfaces();
391
392 void Run();
393
394 bool InitNetworkClient(char *pError, size_t ErrorSize);
395 bool CtrlShiftKey(int Key, bool &Last);
396
397 static void Con_Connect(IConsole::IResult *pResult, void *pUserData);
398 static void Con_Disconnect(IConsole::IResult *pResult, void *pUserData);
399
400 static void Con_DummyConnect(IConsole::IResult *pResult, void *pUserData);
401 static void Con_DummyDisconnect(IConsole::IResult *pResult, void *pUserData);
402 static void Con_DummyResetInput(IConsole::IResult *pResult, void *pUserData);
403
404 static void Con_Quit(IConsole::IResult *pResult, void *pUserData);
405 static void Con_Restart(IConsole::IResult *pResult, void *pUserData);
406 static void Con_DemoPlay(IConsole::IResult *pResult, void *pUserData);
407 static void Con_DemoSpeed(IConsole::IResult *pResult, void *pUserData);
408 static void Con_Minimize(IConsole::IResult *pResult, void *pUserData);
409 static void Con_Ping(IConsole::IResult *pResult, void *pUserData);
410 static void Con_Screenshot(IConsole::IResult *pResult, void *pUserData);
411
412#if defined(CONF_VIDEORECORDER)
413 void StartVideo(const char *pFilename, bool WithTimestamp);
414 static void Con_StartVideo(IConsole::IResult *pResult, void *pUserData);
415 static void Con_StopVideo(IConsole::IResult *pResult, void *pUserData);
416 const char *DemoPlayer_Render(const char *pFilename, int StorageType, const char *pVideoName, int SpeedIndex, bool StartPaused = false) override;
417#endif
418
419 static void Con_Rcon(IConsole::IResult *pResult, void *pUserData);
420 static void Con_RconAuth(IConsole::IResult *pResult, void *pUserData);
421 static void Con_RconLogin(IConsole::IResult *pResult, void *pUserData);
422 static void Con_BeginFavoriteGroup(IConsole::IResult *pResult, void *pUserData);
423 static void Con_EndFavoriteGroup(IConsole::IResult *pResult, void *pUserData);
424 static void Con_AddFavorite(IConsole::IResult *pResult, void *pUserData);
425 static void Con_RemoveFavorite(IConsole::IResult *pResult, void *pUserData);
426 static void Con_Play(IConsole::IResult *pResult, void *pUserData);
427 static void Con_Record(IConsole::IResult *pResult, void *pUserData);
428 static void Con_StopRecord(IConsole::IResult *pResult, void *pUserData);
429 static void Con_AddDemoMarker(IConsole::IResult *pResult, void *pUserData);
430 static void Con_BenchmarkQuit(IConsole::IResult *pResult, void *pUserData);
431 static void ConchainServerBrowserUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
432 static void ConchainFullscreen(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
433 static void ConchainWindowBordered(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
434 static void ConchainWindowScreen(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
435 static void ConchainWindowVSync(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
436 static void ConchainWindowResize(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
437 static void ConchainTimeoutSeed(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
438 static void ConchainPassword(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
439 static void ConchainReplays(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
440 static void ConchainLoglevel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
441 static void ConchainStdoutOutputLevel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
442
443 static void Con_DemoSlice(IConsole::IResult *pResult, void *pUserData);
444 static void Con_DemoSliceBegin(IConsole::IResult *pResult, void *pUserData);
445 static void Con_DemoSliceEnd(IConsole::IResult *pResult, void *pUserData);
446 static void Con_SaveReplay(IConsole::IResult *pResult, void *pUserData);
447
448 void RegisterCommands();
449
450 const char *DemoPlayer_Play(const char *pFilename, int StorageType) override;
451 void DemoRecorder_Start(const char *pFilename, bool WithTimestamp, int Recorder, bool Verbose = false) override;
452 void DemoRecorder_HandleAutoStart() override;
453 void DemoRecorder_UpdateReplayRecorder() override;
454 void DemoRecorder_AddDemoMarker(int Recorder);
455 IDemoRecorder *DemoRecorder(int Recorder) override;
456
457 void AutoScreenshot_Start() override;
458 void AutoStatScreenshot_Start() override;
461
462 void AutoCSV_Start() override;
463 void AutoCSV_Cleanup();
464
465 void ServerBrowserUpdate() override;
466
467 void HandleConnectAddress(const NETADDR *pAddr);
468 void HandleConnectLink(const char *pLink);
469 void HandleDemoPath(const char *pPath);
470 void HandleMapPath(const char *pPath);
471
472 virtual void InitChecksum();
473 virtual int HandleChecksum(int Conn, CUuid Uuid, CUnpacker *pUnpacker);
474
475 // gfx
476 void SwitchWindowScreen(int Index) override;
477 void SetWindowParams(int FullscreenMode, bool IsBorderless) override;
478 void ToggleWindowVSync() override;
479 void Notify(const char *pTitle, const char *pMessage) override;
480 void OnWindowResize() override;
481 void BenchmarkQuit(int Seconds, const char *pFilename);
482
483 void UpdateAndSwap() override;
484
485 // DDRace
486
487 void GenerateTimeoutSeed() override;
488 void GenerateTimeoutCodes(const NETADDR *pAddrs, int NumAddrs);
489
490 const char *GetCurrentMap() const override;
491 const char *GetCurrentMapPath() const override;
492 SHA256_DIGEST GetCurrentMapSha256() const override;
493 unsigned GetCurrentMapCrc() const override;
494
495 void RaceRecord_Start(const char *pFilename) override;
496 void RaceRecord_Stop() override;
497 bool RaceRecord_IsRecording() override;
498
499 void DemoSliceBegin() override;
500 void DemoSliceEnd() override;
501 void DemoSlice(const char *pDstPath, CLIENTFUNC_FILTER pfnFilter, void *pUser) override;
502 virtual void SaveReplay(int Length, const char *pFilename = "");
503
504 bool EditorHasUnsavedData() const override { return m_pEditor->HasUnsavedData(); }
505
506 IFriends *Foes() override { return &m_Foes; }
507
508 void GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override;
509
510 void AddWarning(const SWarning &Warning) override;
511 SWarning *GetCurWarning() override;
512 std::vector<SWarning> &&QuittingWarnings() { return std::move(m_vQuittingWarnings); }
513
515 int UdpConnectivity(int NetType) override;
516
517 bool ViewLink(const char *pLink) override;
518 bool ViewFile(const char *pFilename) override;
519
520#if defined(CONF_FAMILY_WINDOWS)
521 void ShellRegister() override;
522 void ShellUnregister() override;
523#endif
524
525 void ShowMessageBox(const char *pTitle, const char *pMessage, EMessageBoxType Type = MESSAGE_BOX_TYPE_ERROR) override;
526 void GetGpuInfoString(char (&aGpuInfo)[256]) override;
527 void SetLoggers(std::shared_ptr<ILogger> &&pFileLogger, std::shared_ptr<ILogger> &&pStdoutLogger);
528};
529
530#endif
const SHA256_DIGEST SHA256_ZEROED
Definition: hash.cpp:6
Definition: client.h:61
bool m_MapdownloadSha256Present
Definition: client.h:154
int SendMsgActive(CMsgPacker *pMsg, int Flags) override
Definition: client.cpp:207
const char * LoadMapSearch(const char *pMapName, SHA256_DIGEST *pWantedSha256, int WantedCrc)
Definition: client.cpp:1101
bool m_AutoStatScreenshotRecycle
Definition: client.h:111
void Restart() override
Definition: client.cpp:951
bool m_DummyDeactivateOnReconnect
Definition: client.h:186
char m_aCmdPlayDemo[IO_MAX_PATH_LENGTH]
Definition: client.h:140
std::shared_ptr< CHttpRequest > m_pMapdownloadTask
Definition: client.h:145
void GenerateTimeoutCodes(const NETADDR *pAddrs, int NumAddrs)
Definition: client.cpp:515
IOHANDLE m_OwnExecutable
Definition: client.h:248
struct CClient::CVersionInfo m_VersionInfo
static void ConchainWindowScreen(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: client.cpp:4210
std::shared_ptr< ILogger > m_pFileLogger
Definition: client.h:260
bool ViewFile(const char *pFilename) override
Definition: client.cpp:5085
void GenerateTimeoutSeed() override
Definition: client.cpp:510
int m_MapDetailsCrc
Definition: client.h:159
void SwitchWindowScreen(int Index) override
Definition: client.cpp:4183
bool InitNetworkClient(char *pError, size_t ErrorSize)
Definition: client.cpp:3320
static void Con_EndFavoriteGroup(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3615
char m_aTimeoutCodes[NUM_DUMMIES][32]
Definition: client.h:135
void HandleConnectLink(const char *pLink)
Definition: client.cpp:4434
static void ConchainWindowResize(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: client.cpp:4288
void ServerInfoRequest()
Definition: client.cpp:784
void OnWindowResize() override
Definition: client.cpp:4268
void UpdateAndSwap() override
Definition: client.cpp:4040
int m_SnapCrcErrors
Definition: client.h:109
IDiscord * m_pDiscord
Definition: client.h:66
IEngine * Engine()
Definition: client.h:270
ISteam * Steam()
Definition: client.h:275
void AutoStatScreenshot_Cleanup()
Definition: client.cpp:3464
IEditor * m_pEditor
Definition: client.h:67
IOHANDLE m_MapdownloadFileTemp
Definition: client.h:149
int64_t m_Time
Definition: client.h:176
const char * LoadMap(const char *pName, const char *pFilename, SHA256_DIGEST *pWantedSha256, unsigned WantedCrc)
Definition: client.cpp:1025
void RconAuth(const char *pName, const char *pPassword, bool Dummy=g_Config.m_ClDummy) override
Definition: client.cpp:265
void DebugRender()
Definition: client.cpp:836
static void Con_Quit(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3405
static void ConchainWindowBordered(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: client.cpp:4241
static void Con_DemoSpeed(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3904
char m_aMapDetailsName[256]
Definition: client.h:158
static void Con_SaveReplay(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3702
void ResetDDNetInfoTask()
Definition: client.cpp:2288
void HandleDemoPath(const char *pPath)
Definition: client.cpp:4450
static void ConchainPassword(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: client.cpp:4306
IDemoRecorder * DemoRecorder(int Recorder) override
Definition: client.cpp:3991
void OnDemoPlayerSnapshot(void *pData, int Size) override
Definition: client.cpp:2525
CFifo m_Fifo
Definition: client.h:241
struct CClient::@41 m_aInputs[NUM_DUMMIES][200]
CGraph m_GametimeMarginGraph
Definition: client.h:190
bool m_FavoritesGroupAllowPing
Definition: client.h:252
SHA256_DIGEST m_MapdownloadSha256
Definition: client.h:155
int64_t m_CurrentServerCurrentPingTime
Definition: client.h:222
static void Con_Ping(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3423
int64_t m_LastRenderTime
Definition: client.h:107
void GetServerInfo(CServerInfo *pServerInfo) const override
Definition: client.cpp:779
void Notify(const char *pTitle, const char *pMessage) override
Definition: client.cpp:4259
IStorage * Storage()
Definition: client.h:277
IEngineInput * Input()
Definition: client.h:273
static void Con_Screenshot(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3498
CFriends m_Friends
Definition: client.h:90
void SendInfo(int Conn)
Definition: client.cpp:212
IConsole * m_pConsole
Definition: client.h:65
void DemoRecorder_HandleAutoStart() override
Definition: client.cpp:3950
const char * MapDownloadName() const override
Definition: client.h:378
void HandleMapPath(const char *pPath)
Definition: client.cpp:4455
void RegisterCommands()
Definition: client.cpp:4344
bool m_Sixup
Definition: client.h:96
CGhostLoader m_GhostLoader
Definition: client.h:87
void ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
Definition: client.cpp:1412
CUuid m_ConnectionId
Definition: client.h:95
CSmoothTime m_PredictedTime
Definition: client.h:167
char m_aMapdownloadFilename[256]
Definition: client.h:146
static void Con_DemoPlay(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3888
static void Con_Play(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3882
int m_CurrentServerPingToken
Definition: client.h:220
void DemoSlice(const char *pDstPath, CLIENTFUNC_FILTER pfnFilter, void *pUser) override
Definition: client.cpp:3781
CGraph m_InputtimeMarginGraph
Definition: client.h:189
void ProcessServerInfo(int Type, NETADDR *pFrom, const void *pData, int DataSize)
Definition: client.cpp:1181
void Connect(const char *pAddress, const char *pPassword=nullptr) override
Definition: client.cpp:535
char m_aaaDemorecSnapshotData[NUM_SNAPSHOT_TYPES][2][CSnapshot::MAX_SIZE]
Definition: client.h:202
virtual int HandleChecksum(int Conn, CUuid Uuid, CUnpacker *pUnpacker)
Definition: client.cpp:4085
static void Con_BeginFavoriteGroup(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3597
int m_ExpectedRconCommands
Definition: client.h:121
IEngineGraphics * Graphics()
Definition: client.h:272
int m_aAckGameTick[NUM_DUMMIES]
Definition: client.h:115
int m_MapdownloadTotalsize
Definition: client.h:153
bool m_CanReceiveServerCapabilities
Definition: client.h:209
CSnapshotStorage::CHolder * m_aapSnapshots[NUM_DUMMIES][NUM_SNAPSHOT_TYPES]
Definition: client.h:195
unsigned GetCurrentMapCrc() const override
Definition: client.cpp:4912
void Rcon(const char *pCmd) override
Definition: client.cpp:290
std::shared_ptr< ILogger > m_pStdoutLogger
Definition: client.h:261
NETADDR m_GlobalTcpAddr
Definition: client.h:99
static void Con_AddDemoMarker(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:4018
static void Con_Restart(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3411
CFriends m_Foes
Definition: client.h:91
static void ConchainWindowVSync(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: client.cpp:4276
void StartVideo(const char *pFilename, bool WithTimestamp)
Definition: client.cpp:3520
CSnapshotStorage m_aSnapshotStorage[NUM_DUMMIES]
Definition: client.h:194
SWarning * GetCurWarning() override
Definition: client.cpp:4995
CConfig * Config()
Definition: client.h:268
char m_aMapdownloadName[256]
Definition: client.h:148
bool m_MapDetailsPresent
Definition: client.h:157
static void Con_DummyResetInput(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3399
CClient()
Definition: client.cpp:86
bool DummyConnecting() const override
Definition: client.cpp:709
IGameClient * m_pGameClient
Definition: client.h:70
void AddWarning(const SWarning &Warning) override
Definition: client.cpp:4990
void Render()
Definition: client.cpp:1002
int m_aSnapshotIncomingDataSize[NUM_DUMMIES]
Definition: client.h:199
uint64_t m_aSnapshotParts[NUM_DUMMIES]
Definition: client.h:101
CSnapshotDelta m_SnapshotDelta
Definition: client.h:204
void DemoSliceEnd() override
Definition: client.cpp:3684
char m_aMapdownloadFilenameTemp[256]
Definition: client.h:147
void DummyDisconnect(const char *pReason) override
Definition: client.cpp:758
char m_aRconUsername[32]
Definition: client.h:118
char m_aAutomaticDummyName[MAX_NAME_LENGTH]
Definition: client.h:264
static void Con_Record(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3996
int m_MapdownloadAmount
Definition: client.h:152
SHA256_DIGEST GetCurrentMapSha256() const override
Definition: client.cpp:4907
void DisconnectWithReason(const char *pReason)
Definition: client.cpp:642
char m_aaSnapshotIncomingData[NUM_DUMMIES][CSnapshot::MAX_SIZE]
Definition: client.h:198
void DemoRecorder_Start(const char *pFilename, bool WithTimestamp, int Recorder, bool Verbose=false) override
Definition: client.cpp:3910
const NETADDR & ServerAddress() const override
Definition: client.h:375
void SnapSetStaticsize7(int ItemType, int Size) override
Definition: client.cpp:831
static void Con_DummyConnect(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3387
void HandleConnectAddress(const NETADDR *pAddr)
Definition: client.cpp:4429
bool m_DummyReconnectOnReload
Definition: client.h:185
bool m_EditorActive
Definition: client.h:113
void LoadDebugFont()
Definition: client.cpp:790
IEngineTextRender * m_pTextRender
Definition: client.h:78
int m_MapdownloadChunk
Definition: client.h:150
bool DummyAllowed() const override
Definition: client.cpp:774
void PumpNetwork()
Definition: client.cpp:2459
int m_GotRconCommands
Definition: client.h:122
CConfig * m_pConfig
Definition: client.h:64
void ResetMapDownload(bool ResetActive)
Definition: client.cpp:2219
void SetState(EClientState State)
Definition: client.cpp:393
void RaceRecord_Stop() override
Definition: client.cpp:4938
bool m_LastDummy
Definition: client.h:180
char m_aCurrentMap[IO_MAX_PATH_LENGTH]
Definition: client.h:132
static void Con_DemoSliceEnd(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3696
static void Con_StopRecord(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:4012
bool DummyConnected() const override
Definition: client.cpp:704
std::deque< std::shared_ptr< CDemoEdit > > m_EditJobs
Definition: client.h:206
void RaceRecord_Start(const char *pFilename) override
Definition: client.cpp:4917
CNetClient m_aNetClient[NUM_CONNS]
Definition: client.h:82
bool EditorHasUnsavedData() const override
Definition: client.h:504
void ProcessConnlessPacket(CNetChunk *pPacket)
Definition: client.cpp:1151
void SetLoggers(std::shared_ptr< ILogger > &&pFileLogger, std::shared_ptr< ILogger > &&pStdoutLogger)
Definition: client.cpp:5177
char m_aMapDownloadUrl[256]
Definition: client.h:144
IFavorites * m_pFavorites
Definition: client.h:69
IEngineMap * m_pMap
Definition: client.h:73
CDemoPlayer m_DemoPlayer
Definition: client.h:83
int PredictionMargin() const
Definition: client.cpp:5017
bool m_DummyConnected
Definition: client.h:183
static void Con_StartVideo(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3506
char m_aCmdEditMap[IO_MAX_PATH_LENGTH]
Definition: client.h:141
void UpdateDemoIntraTimers()
Definition: client.cpp:2585
bool m_DummyConnecting
Definition: client.h:182
bool ReceivingRconCommands() const override
Definition: client.h:298
IUpdater * Updater()
Definition: client.h:279
IHttp * Http()
Definition: client.h:280
char m_aCurrentMapPath[IO_MAX_PATH_LENGTH]
Definition: client.h:133
CGhostRecorder m_GhostRecorder
Definition: client.h:86
int64_t m_BenchmarkStopTime
Definition: client.h:244
void Quit() override
Definition: client.cpp:956
void InitInterfaces()
Definition: client.cpp:2906
int MaxLatencyTicks() const
Definition: client.cpp:5012
static void Con_AddFavorite(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3632
void Update()
Definition: client.cpp:2596
SHA256_DIGEST m_MapDetailsSha256
Definition: client.h:160
void ShowMessageBox(const char *pTitle, const char *pMessage, EMessageBoxType Type=MESSAGE_BOX_TYPE_ERROR) override
Definition: client.cpp:5159
static void Con_Disconnect(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3381
void OnEnterGame(bool Dummy)
Definition: client.cpp:435
const char * GetCurrentMapPath() const override
Definition: client.cpp:4902
static void Con_RconLogin(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3591
bool m_DummySendConnInfo
Definition: client.h:181
CSnapItem SnapGetItem(int SnapId, int Index) const override
Definition: client.cpp:797
const char * ConnectAddressString() const override
Definition: client.h:377
CChecksumData * ChecksumData() override
Definition: client.h:514
bool IsSixup() const override
Definition: client.h:373
bool m_SendPassword
Definition: client.h:124
IEngineGraphics * m_pGraphics
Definition: client.h:71
int m_UseTempRconCommands
Definition: client.h:120
void Run()
Definition: client.cpp:2942
int64_t m_PredictionMargin
Definition: client.h:175
static void Con_Connect(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3375
IUpdater * m_pUpdater
Definition: client.h:79
int TranslateSysMsg(int *pMsgId, bool System, CUnpacker *pUnpacker, CPacker *pPacker, CNetChunk *pPacket, bool *pIsExMsg)
Definition: sixup_translate_system.cpp:3
static void ConchainTimeoutSeed(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: client.cpp:4298
bool ViewLink(const char *pLink) override
Definition: client.cpp:5066
void LoadDDNetInfo()
Definition: client.cpp:2365
CHttp m_Http
Definition: client.h:80
char m_aPassword[sizeof(g_Config.m_Password)]
Definition: client.h:123
const char * DemoPlayer_Render(const char *pFilename, int StorageType, const char *pVideoName, int SpeedIndex, bool StartPaused=false) override
Definition: client.cpp:3866
INotifications * Notifications()
Definition: client.h:276
CServerBrowser m_ServerBrowser
Definition: client.h:88
void SendMapRequest()
Definition: client.cpp:248
static void ConchainLoglevel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: client.cpp:4324
INotifications * m_pNotifications
Definition: client.h:76
int ConnectNetTypes() const override
Definition: client.cpp:2446
static void Con_Minimize(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3417
bool m_GenerateTimeoutSeed
Definition: client.h:137
int m_aData[MAX_INPUT_SIZE]
Definition: client.h:172
virtual void InitChecksum()
Definition: client.cpp:4060
int * GetInput(int Tick, int IsDummy) const override
Definition: client.cpp:377
int GetPredictionTime() override
Definition: client.cpp:4974
bool m_AutoCSVRecycle
Definition: client.h:112
IStorage * m_pStorage
Definition: client.h:77
void ToggleWindowVSync() override
Definition: client.cpp:4253
std::vector< SWarning > && QuittingWarnings()
Definition: client.h:512
const char * DummyName() override
Definition: client.cpp:974
int64_t m_PredictedTime
Definition: client.h:174
int m_aCurrentInput[NUM_DUMMIES]
Definition: client.h:179
const void * SnapFindItem(int SnapId, int Type, int Id) const override
Definition: client.cpp:810
char m_aCmdConnect[256]
Definition: client.h:139
IEngine * m_pEngine
Definition: client.h:68
int SendMsg(int Conn, CMsgPacker *pMsg, int Flags) override
Definition: client.cpp:170
static void Con_RemoveFavorite(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3670
IOHANDLE m_BenchmarkFile
Definition: client.h:243
void SendReady(int Conn)
Definition: client.cpp:242
bool DummyConnectingDelayed() const override
Definition: client.cpp:714
void RequestDDNetInfo() override
Definition: client.cpp:4951
int SnapNumItems(int SnapId) const override
Definition: client.cpp:818
void OnDemoPlayerMessage(void *pData, int Size) override
Definition: client.cpp:2564
int m_aRconAuthed[NUM_DUMMIES]
Definition: client.h:117
static void Con_DemoSlice(IConsole::IResult *pResult, void *pUserData)
void AutoScreenshot_Cleanup()
Definition: client.cpp:3450
IGraphics::CTextureHandle m_DebugFont
Definition: client.h:105
void AutoCSV_Start() override
Definition: client.cpp:3478
CSnapshotStorage::CHolder m_aDemorecSnapshotHolders[NUM_SNAPSHOT_TYPES]
Definition: client.h:201
char m_aMapDetailsUrl[256]
Definition: client.h:161
CChecksum m_Checksum
Definition: client.h:246
int64_t m_LocalStartTime
Definition: client.h:102
void SendInput()
Definition: client.cpp:312
CServerInfo m_CurrentServerInfo
Definition: client.h:215
int64_t m_GlobalStartTime
Definition: client.h:103
int m_Tick
Definition: client.h:173
bool RconAuthed() const override
Definition: client.h:294
static void Con_DemoSliceBegin(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3690
CDemoEditor m_DemoEditor
Definition: client.h:85
void AutoScreenshot_Start() override
Definition: client.cpp:3432
CDemoRecorder m_aDemoRecorder[RECORDER_MAX]
Definition: client.h:84
bool CtrlShiftKey(int Key, bool &Last)
Definition: client.cpp:3362
void DemoRecorder_AddDemoMarker(int Recorder)
Definition: client.cpp:3986
IDiscord * Discord()
Definition: client.h:269
IEngineTextRender * TextRender()
Definition: client.h:278
IGameClient * GameClient()
Definition: client.h:271
static void Con_StopVideo(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3565
void EnterGame(int Conn) override
Definition: client.cpp:476
CSmoothTime m_aGameTime[NUM_DUMMIES]
Definition: client.h:166
static void Con_BenchmarkQuit(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:4025
IFriends * Foes() override
Definition: client.h:506
std::shared_ptr< CHttpRequest > m_pDDNetInfoTask
Definition: client.h:163
float m_LastDummyConnectTime
Definition: client.h:184
CUuid m_CurrentServerPingUuid
Definition: client.h:221
bool ServerCapAnyPlayerFlag() const override
Definition: client.h:213
int m_OwnExecutableSize
Definition: client.h:247
int m_MapdownloadCrc
Definition: client.h:151
static void ConchainReplays(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: client.cpp:4314
std::vector< SWarning > m_vWarnings
Definition: client.h:238
int m_CurrentServerPingBasicToken
Definition: client.h:219
const char * GetCurrentMap() const override
Definition: client.cpp:4897
IEngineSound * Sound()
Definition: client.h:274
CUpdater m_Updater
Definition: client.h:89
void SendEnterGame(int Conn)
Definition: client.cpp:236
void Disconnect() override
Definition: client.cpp:696
void FinishMapDownload()
Definition: client.cpp:2252
IEngineInput * m_pInput
Definition: client.h:72
static void ConchainFullscreen(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: client.cpp:4229
char m_aRconPassword[sizeof(g_Config.m_SvRconPassword)]
Definition: client.h:119
void GetGpuInfoString(char(&aGpuInfo)[256]) override
Definition: client.cpp:5165
CServerCapabilities m_ServerCapabilities
Definition: client.h:211
bool m_AutoScreenshotRecycle
Definition: client.h:110
const char * DemoPlayer_Play(const char *pFilename, int StorageType) override
Definition: client.cpp:3789
char m_aVersionStr[10]
Definition: client.h:127
int m_aCurrentRecvTick[NUM_DUMMIES]
Definition: client.h:116
int UnpackAndValidateSnapshot(CSnapshot *pFrom, CSnapshot *pTo)
Definition: client.cpp:2180
virtual void SaveReplay(int Length, const char *pFilename="")
Definition: client.cpp:3722
void AutoStatScreenshot_Start() override
Definition: client.cpp:3441
void DemoSliceBegin() override
Definition: client.cpp:3678
int64_t m_CurrentServerNextPingTime
Definition: client.h:223
int MapDownloadTotalsize() const override
Definition: client.h:380
void BenchmarkQuit(int Seconds, const char *pFilename)
Definition: client.cpp:4033
ISteam * m_pSteam
Definition: client.h:75
int UdpConnectivity(int NetType) override
Definition: client.cpp:5022
NETADDR m_aFavoritesGroupAddresses[MAX_SERVER_ADDRESSES]
Definition: client.h:254
void DemoRecorder_UpdateReplayRecorder() override
Definition: client.cpp:3971
int MapDownloadAmount() const override
Definition: client.h:379
std::vector< SWarning > m_vQuittingWarnings
Definition: client.h:239
void AutoCSV_Cleanup()
Definition: client.cpp:3484
bool m_HaveGlobalTcpAddr
Definition: client.h:98
void FinishDDNetInfo()
Definition: client.cpp:2297
static void Con_RconAuth(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3585
const char * PlayerName() const override
Definition: client.cpp:961
void ServerBrowserUpdate() override
Definition: client.cpp:4048
static void Con_Rcon(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3579
char m_aConnectAddressStr[MAX_SERVER_ADDRESSES *NETADDR_MAXSTRSIZE]
Definition: client.h:93
static void ConchainStdoutOutputLevel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: client.cpp:4334
void SnapSetStaticsize(int ItemType, int Size) override
Definition: client.cpp:826
int m_FavoritesGroupNum
Definition: client.h:253
bool m_aCodeRunAfterJoin[NUM_DUMMIES]
Definition: client.h:136
IGraphics::CTextureHandle GetDebugFont() const override
Definition: client.h:303
const char * ErrorString() const override
Definition: client.cpp:997
static void ConchainServerBrowserUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
Definition: client.cpp:4053
IEngineSound * m_pSound
Definition: client.h:74
int m_aReceivedSnapshots[NUM_DUMMIES]
Definition: client.h:197
CGraph m_FpsGraph
Definition: client.h:191
static void Con_DummyDisconnect(IConsole::IResult *pResult, void *pUserData)
Definition: client.cpp:3393
bool m_FavoritesGroup
Definition: client.h:251
float GotRconCommandsPercentage() const override
Definition: client.cpp:297
bool UseTempRconCommands() const override
Definition: client.h:295
int m_CurrentServerPingInfoType
Definition: client.h:218
void GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override
Definition: client.cpp:4980
int64_t m_PingStartTime
Definition: client.h:130
void RegisterInterfaces()
Definition: client.cpp:2891
int64_t m_CurrentServerInfoRequestTime
Definition: client.h:216
const char * LatestVersion() const override
Definition: client.cpp:371
bool m_ServerSentCapabilities
Definition: client.h:210
void DummyConnect() override
Definition: client.cpp:719
IConfigManager * m_pConfigManager
Definition: client.h:63
void SetWindowParams(int FullscreenMode, bool IsBorderless) override
Definition: client.cpp:4222
IConfigManager * ConfigManager()
Definition: client.h:267
bool ConnectionProblems() const override
Definition: client.cpp:307
bool RaceRecord_IsRecording() override
Definition: client.cpp:4946
Definition: config.h:23
Definition: demoedit.h:11
Definition: demo.h:188
Definition: demo.h:67
Definition: demo.h:64
Definition: demo.h:19
Definition: fifo.h:8
Definition: friends.h:12
Definition: ghost.h:75
Definition: ghost.h:47
Definition: graph.h:17
Definition: http.h:266
Definition: message.h:10
Definition: network.h:511
const NETADDR * ServerAddress() const
Definition: network.h:541
Definition: packer.h:7
Definition: serverbrowser.h:235
Definition: client.h:51
bool m_SyncWeaponInput
Definition: client.h:57
bool m_AnyPlayerFlag
Definition: client.h:54
bool m_ChatTimeoutCode
Definition: client.h:53
bool m_AllowDummy
Definition: client.h:56
bool m_PingEx
Definition: client.h:55
Definition: serverbrowser.h:23
Definition: smooth_time.h:12
Definition: snapshot.h:74
Definition: snapshot.h:118
Definition: snapshot.h:115
Definition: snapshot.h:31
@ MAX_SIZE
Definition: snapshot.h:52
Definition: packer.h:32
Definition: updater.h:45
Definition: client.h:36
EMessageBoxType
Definition: client.h:335
@ MESSAGE_BOX_TYPE_ERROR
Definition: client.h:336
EClientState
Definition: client.h:49
EClientState State() const
Definition: client.h:137
@ NUM_CONNS
Definition: client.h:122
@ CONN_MAIN
Definition: client.h:119
@ NUM_SNAPSHOT_TYPES
Definition: client.h:230
Definition: config.h:9
Definition: console.h:45
Definition: console.h:18
void(* FCommandCallback)(IResult *pResult, void *pUserData)
Definition: console.h:92
Definition: demo.h:102
Definition: discord.h:8
Definition: editor.h:8
virtual bool HasUnsavedData() const =0
Definition: graphics.h:501
Definition: input.h:171
Definition: map.h:35
Definition: sound.h:115
Definition: textrender.h:373
Definition: engine.h:15
Definition: favorites.h:14
Definition: friends.h:19
Definition: client.h:345
Definition: graphics.h:200
Definition: http.h:12
Definition: logger.h:67
Definition: notifications.h:7
Definition: steam.h:9
Definition: storage.h:20
Definition: updater.h:7
@ RECORDER_MAX
Definition: client.h:29
bool(* CLIENTFUNC_FILTER)(const void *pData, int DataSize, void *pUser)
Definition: client.h:32
CConfig g_Config
Definition: config.cpp:12
@ NUM_DUMMIES
Definition: enums.h:8
@ MAX_SERVER_ADDRESSES
Definition: protocol.h:86
@ MAX_INPUT_SIZE
Definition: protocol.h:94
@ MAX_NAME_LENGTH
Definition: protocol.h:97
void * IOHANDLE
Definition: logger.h:11
Definition: checksum.h:7
Definition: client.h:227
@ STATE_START
Definition: client.h:231
@ STATE_READY
Definition: client.h:232
@ STATE_INIT
Definition: client.h:230
int m_State
Definition: client.h:235
Definition: network.h:129
Definition: uuid_manager.h:17
Definition: types.h:67
Definition: hash.h:15
Definition: warning.h:5
const NETADDR NETADDR_ZEROED
Definition: system.cpp:961
@ NETADDR_MAXSTRSIZE
Definition: types.h:45
@ IO_MAX_PATH_LENGTH
Definition: types.h:43
Definition: checksum.h:31
CChecksumData m_Data
Definition: checksum.h:33
const CUuid UUID_ZEROED
Definition: uuid_manager.cpp:14