DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
host.c
Go to the documentation of this file.
1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3Copyright (C) 2000-2021 DarkPlaces contributors
4
5This program is free software; you can redistribute it and/or
6modify it under the terms of the GNU General Public License
7as published by the Free Software Foundation; either version 2
8of the License, or (at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14See the GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20*/
21// host.c -- coordinates spawning and killing of local servers
22
23#include "quakedef.h"
24
25#include <time.h>
26#include "libcurl.h"
27#include "taskqueue.h"
28#include "utf8lib.h"
29
30/*
31
32A server can always be started, even if the system started out as a client
33to a remote system.
34
35A client can NOT be started if the system started as a dedicated server.
36
37Memory is cleared / released when a server or client begins, not when they end.
38
39*/
40
42
43// pretend frames take this amount of time (in seconds), 0 = realtime
44cvar_t host_framerate = {CF_CLIENT | CF_SERVER, "host_framerate","0", "locks frame timing to this value in seconds, 0.05 is 20fps for example, note that this can easily run too fast, use cl_maxfps if you want to limit your framerate instead, or sys_ticrate to limit server speed"};
45// shows time used by certain subsystems
46cvar_t host_speeds = {CF_CLIENT | CF_SERVER, "host_speeds","0", "reports how much time is used in server/graphics/sound"};
47
48cvar_t developer = {CF_CLIENT | CF_SERVER | CF_ARCHIVE, "developer","0", "shows debugging messages and information (recommended for all developers and level designers); the value -1 also suppresses buffering and logging these messages"};
49cvar_t developer_extra = {CF_CLIENT | CF_SERVER, "developer_extra", "0", "prints additional debugging messages, often very verbose!"};
50cvar_t developer_insane = {CF_CLIENT | CF_SERVER, "developer_insane", "0", "prints huge streams of information about internal workings, entire contents of files being read/written, etc. Not recommended!"};
51cvar_t developer_loadfile = {CF_CLIENT | CF_SERVER, "developer_loadfile","0", "prints name and size of every file loaded via the FS_LoadFile function (which is almost everything)"};
52cvar_t developer_loading = {CF_CLIENT | CF_SERVER, "developer_loading","0", "prints information about files as they are loaded or unloaded successfully"};
53cvar_t developer_entityparsing = {CF_CLIENT, "developer_entityparsing", "0", "prints detailed network entities information each time a packet is received"};
54
55cvar_t timestamps = {CF_CLIENT | CF_SERVER | CF_ARCHIVE, "timestamps", "0", "prints timestamps on console messages"};
56cvar_t timeformat = {CF_CLIENT | CF_SERVER | CF_ARCHIVE, "timeformat", "[%Y-%m-%d %H:%M:%S] ", "time format to use on timestamped console messages"};
57
58cvar_t sessionid = {CF_CLIENT | CF_SERVER | CF_READONLY, "sessionid", "", "ID of the current session (use the -sessionid parameter to set it); this is always either empty or begins with a dot (.)"};
59cvar_t locksession = {CF_CLIENT | CF_SERVER, "locksession", "0", "Lock the session? 0 = no, 1 = yes and abort on failure, 2 = yes and continue on failure"};
60
61cvar_t host_isclient = {CF_SHARED | CF_READONLY, "_host_isclient", "0", "If 1, clientside is active."};
62
63/*
64================
65Host_AbortCurrentFrame
66
67aborts the current host frame and goes on with the next one
68================
69*/
71{
72 // in case we were previously nice, make us mean again
74
75 longjmp (host.abortframe, 1);
76}
77
78/*
79================
80Host_Error
81
82This shuts down both the client and server
83================
84*/
85void Host_Error (const char *error, ...)
86{
87 static char hosterrorstring1[MAX_INPUTLINE]; // THREAD UNSAFE
88 static char hosterrorstring2[MAX_INPUTLINE]; // THREAD UNSAFE
89 static qbool hosterror = false;
90 va_list argptr;
91 int outfd = sys.outfd;
92
93 // set output to stderr
94 sys.outfd = fileno(stderr);
95
96 // turn off rcon redirect if it was active when the crash occurred
97 // to prevent loops when it is a networking problem
99
100 va_start (argptr,error);
101 dpvsnprintf (hosterrorstring1,sizeof(hosterrorstring1),error,argptr);
102 va_end (argptr);
103
104 Con_Printf(CON_ERROR "Host_Error: %s\n", hosterrorstring1);
105
106 // LadyHavoc: if crashing very early, or currently shutting down, do
107 // Sys_Error instead
108 if (host.framecount < 1 || host.state != host_active)
109 Sys_Error ("Host_Error during %s: %s", host_state_str[host.state], hosterrorstring1);
110
111 if (hosterror)
112 Sys_Error ("Host_Error: recursively entered (original error was: %s new error is: %s)", hosterrorstring2, hosterrorstring1);
113 hosterror = true;
114
115 dp_strlcpy(hosterrorstring2, hosterrorstring1, sizeof(hosterrorstring2));
116
119
120 // print out where the crash happened, if it was caused by QC (and do a cleanup)
121 PRVM_Crash();
122
125
126 if (cls.state == ca_dedicated)
127 Sys_Error("Host_Error: %s", hosterrorstring1); // dedicated servers exit
128
129 // prevent an endless loop if the error was triggered by a command
131
132 CL_DisconnectEx(false, "Host_Error: %s", hosterrorstring1);
133 cls.demonum = -1; // stop demo loop
134
135 hosterror = false;
136
137 // restore configured outfd
138 sys.outfd = outfd;
139
140 // can't abort a frame if we didn't start one yet, won't get here in that case (see above)
142}
143
144/*
145==================
146Host_Quit_f
147==================
148*/
150{
152 Con_Printf("shutting down already!\n");
153 else
155}
156
158{
159 Con_Printf("Version: %s\n", engineversion);
160}
161
163{
164 dpsnprintf(engineversion, sizeof(engineversion), "%s %s%s %s", gamename ? gamename : "DarkPlaces", DP_OS_NAME, cls.state == ca_dedicated ? " dedicated" : "", buildstring);
165}
166
167static void Host_Framerate_c(cvar_t *var)
168{
169 if (var->value < 0.00001 && var->value != 0)
170 Cvar_SetValueQuick(var, 0);
171}
172
173// TODO: Find a better home for this.
175{
176 if(cmd->source == src_local && host.hook.SV_SendCvar)
177 {
179 return;
180 }
181 if(cmd->source == src_client && host.hook.CL_SendCvar)
182 {
184 return;
185 }
186}
187
188/*
189===============
190Host_SaveConfig_f
191
192Writes key bindings and archived cvars to config.cfg
193===============
194*/
195void Host_SaveConfig(const char *file)
196{
197 qfile_t *f;
198
199// dedicated servers initialize the host but don't parse and set the
200// config.cfg cvars
201 // LadyHavoc: don't save a config if it crashed in startup
202 if (host.framecount >= 3 && cls.state != ca_dedicated && !Sys_CheckParm("-benchmark") && !Sys_CheckParm("-capturedemo"))
203 {
204 f = FS_OpenRealFile(file, "wb", false);
205 if (!f)
206 {
207 Con_Printf(CON_ERROR "Couldn't write %s\n", file);
208 return;
209 }
210 else
211 Con_Printf("Saving config to %s ...\n", file);
212
215#ifdef __EMSCRIPTEN__
216 js_syncFS(false);
217#endif
218 FS_Close (f);
219 }
220}
221
223{
224 const char *file = CONFIGFILENAME;
225
226 if(Cmd_Argc(cmd) >= 2)
227 file = Cmd_Argv(cmd, 1);
228
229 Host_SaveConfig(file);
230}
231
233{
234 // set up the default startmap_sp and startmap_dm aliases (mods can
235 // override these) and then execute the quake.rc startup script
236 if (gamemode == GAME_NEHAHRA)
237 Cbuf_InsertText(cmd, "alias startmap_sp \"map nehstart\"\nalias startmap_dm \"map nehstart\"\nexec " STARTCONFIGFILENAME "\n");
238 else if (gamemode == GAME_TRANSFUSION)
239 Cbuf_InsertText(cmd, "alias startmap_sp \"map e1m1\"\n""alias startmap_dm \"map bb1\"\nexec " STARTCONFIGFILENAME "\n");
240 else if (gamemode == GAME_TEU)
241 Cbuf_InsertText(cmd, "alias startmap_sp \"map start\"\nalias startmap_dm \"map start\"\nexec teu.rc\n");
242 else
243 Cbuf_InsertText(cmd, "alias startmap_sp \"map start\"\nalias startmap_dm \"map start\"\nexec " STARTCONFIGFILENAME "\n");
244
245 // if quake.rc is missing, use default
247 Cbuf_InsertText(cmd, "exec default.cfg\nexec " CONFIGFILENAME "\nexec autoexec.cfg\n");
248}
249
250/*
251===============
252Host_LoadConfig_f
253
254Resets key bindings and cvars to defaults and then reloads scripts
255===============
256*/
258{
259#ifdef CONFIG_MENU
260 // Xonotic QC complains/breaks if its cvars are deleted before its m_shutdown() is called
261 if(MR_Shutdown)
262 MR_Shutdown();
263#endif
265#ifdef CONFIG_MENU
266 // Must re-add menu.c commands or load menu.dat before executing quake.rc or handling events
267 MR_Init();
268#endif
269 // exec startup scripts again
271}
272
273/*
274=======================
275Host_InitLocal
276======================
277*/
279static void Host_InitLocal (void)
280{
281 Cmd_AddCommand(CF_SHARED, "quit", Host_Quit_f, "quit the game");
282 Cmd_AddCommand(CF_SHARED, "version", Host_Version_f, "print engine version");
283 Cmd_AddCommand(CF_SHARED, "saveconfig", Host_SaveConfig_f, "save settings to config.cfg (or a specified filename) immediately (also automatic when quitting)");
284 Cmd_AddCommand(CF_SHARED, "loadconfig", Host_LoadConfig_f, "reset everything and reload configs");
285 Cmd_AddCommand(CF_SHARED, "sendcvar", SendCvar_f, "sends the value of a cvar to the server as a sentcvar command, for use by QuakeC");
290
297
300
302}
303
304char engineversion[128];
305
306
307static qfile_t *locksession_fh = NULL;
308static qbool locksession_run = false;
309static void Host_InitSession(void)
310{
311 int i;
312 char *buf;
315
316 // load the session ID into the read-only cvar
317 if ((i = Sys_CheckParm("-sessionid")) && (i + 1 < sys.argc))
318 {
319 if(sys.argv[i+1][0] == '.')
321 else
322 {
323 buf = (char *)Z_Malloc(strlen(sys.argv[i+1]) + 2);
324 dpsnprintf(buf, sizeof(buf), ".%s", sys.argv[i+1]);
326 }
327 }
328}
329
331{
333 return;
334 locksession_run = true;
335 if(locksession.integer != 0 && !Sys_CheckParm("-readonly"))
336 {
337 char vabuf[1024];
338 char *p = va(vabuf, sizeof(vabuf), "%slock%s", *fs_userdir ? fs_userdir : fs_basedir, sessionid.string);
339 FS_CreatePath(p);
340 locksession_fh = FS_SysOpen(p, "wl", false);
341 // TODO maybe write the pid into the lockfile, while we are at it? may help server management tools
342 if(!locksession_fh)
343 {
344 if(locksession.integer == 2)
345 {
346 Con_Printf(CON_WARN "WARNING: session lock %s could not be acquired. Please run with -sessionid and an unique session name. Continuing anyway.\n", p);
347 }
348 else
349 {
350 Sys_Error("session lock %s could not be acquired. Please run with -sessionid and an unique session name.\n", p);
351 }
352 }
353 }
354}
355
357{
358 if(!locksession_run)
359 return;
360 locksession_run = false;
361
363 {
365 // NOTE: we can NOT unlink the lock here, as doing so would
366 // create a race condition if another process created it
367 // between our close and our unlink
369 }
370}
371
372/*
373====================
374Host_Init
375====================
376*/
377void Host_Init (void)
378{
379 int i;
380 char vabuf[1024];
381
382 Sys_SDL_Init();
383
384 Memory_Init();
385
390
392
393 host.realtime = 0;
395
396 if (Sys_CheckParm("-profilegameonly"))
397 Sys_AllowProfiling(false);
398
399 // LadyHavoc: quake never seeded the random number generator before... heh
400 if (Sys_CheckParm("-benchmark"))
401 srand(0); // predictable random sequence for -benchmark
402 else
403 srand((unsigned int)time(NULL));
404
405 // FIXME: this is evil, but possibly temporary
406 // LadyHavoc: doesn't seem very temporary...
407 // LadyHavoc: made this a saved cvar
408// COMMANDLINEOPTION: Console: -developer enables warnings and other notices (RECOMMENDED for mod developers)
409 if (Sys_CheckParm("-developer"))
410 {
412 developer.string = "1";
413 }
414
415 if (Sys_CheckParm("-developer2") || Sys_CheckParm("-developer3"))
416 {
418 developer.string = "1";
427 }
428
429 if (Sys_CheckParm("-developer3"))
430 {
433 }
434
435 // -dedicated is checked in SV_ServerOptions() but that's too late for Cvar_RegisterVariable() to skip all the client-only cvars
436 if (Sys_CheckParm ("-dedicated") || !cl_available)
438
439 // set and print initial version string (will be updated when gamename is changed)
440 Host_UpdateVersion(); // checks for cls.state == ca_dedicated
441 Con_Printf("%s\n", engineversion);
442
443 // initialize console command/cvar/alias/command execution systems
444 Cmd_Init();
445
446 // initialize memory subsystem cvars/commands
448
449 // initialize console and logging and its cvars/commands
450 // this enables Con_Printf() messages to be coloured
451 Con_Init();
452
453 // initialize various cvars that could not be initialized earlier
454 u8_Init();
458
459 // initialize filesystem (including fs_basedir, fs_gamedir, -game, scr_screenshot_name, gamename)
460 FS_Init();
461
462 // initialize process nice level
464
465 // initialize ixtable
466 Mathlib_Init();
467
468 // register the cvars for session locking
470
471 // must be after FS_Init
472 Crypto_Init();
474
475 NetConn_Init();
476 Curl_Init();
477 PRVM_Init();
478 Mod_Init();
479 World_Init();
480 SV_Init();
482
483 Thread_Init();
485
486 CL_Init();
487
488 // save off current state of aliases, commands and cvars for later restore if FS_GameDir_f is called
489 // NOTE: menu commands are freed by Cmd_RestoreInitState
491
492 // here comes the not so critical stuff
493
495 Cbuf_Execute(cmd_local->cbuf); // cannot be in Host_AddConfigText as that would cause Host_LoadConfig_f to loop!
496
498
499 Log_Start();
500
501 if (cls.state != ca_dedicated)
502 {
503 // put up the loading image so the user doesn't stare at a black screen...
505 S_Startup();
506#ifdef CONFIG_MENU
507 MR_Init();
508#endif
509 }
510
511 // check for special benchmark mode
512// COMMANDLINEOPTION: Client: -benchmark <demoname> runs a timedemo and quits, results of any timedemo can be found in gamedir/benchmark.log (for example id1/benchmark.log)
513 i = Sys_CheckParm("-benchmark");
514 if (i && i + 1 < sys.argc)
516 {
517 Cbuf_AddText(cmd_local, va(vabuf, sizeof(vabuf), "timedemo %s\n", sys.argv[i + 1]));
519 }
520
521 // check for special demo mode
522// COMMANDLINEOPTION: Client: -demo <demoname> runs a playdemo and quits
523 i = Sys_CheckParm("-demo");
524 if (i && i + 1 < sys.argc)
526 {
527 Cbuf_AddText(cmd_local, va(vabuf, sizeof(vabuf), "playdemo %s\n", sys.argv[i + 1]));
529 }
530
531#ifdef CONFIG_VIDEO_CAPTURE
532// COMMANDLINEOPTION: Client: -capturedemo <demoname> captures a playdemo and quits
533 i = Sys_CheckParm("-capturedemo");
534 if (i && i + 1 < sys.argc)
536 {
537 Cbuf_AddText(cmd_local, va(vabuf, sizeof(vabuf), "playdemo %s\ncl_capturevideo 1\n", sys.argv[i + 1]));
538 Cbuf_Execute((cmd_local)->cbuf);
539 }
540#endif
541
542 if (cls.state == ca_dedicated || Sys_CheckParm("-listen"))
544 {
545 Cbuf_AddText(cmd_local, "startmap_dm\n");
547 }
548
550 {
551#ifdef CONFIG_MENU
552 Cbuf_AddText(cmd_local, "togglemenu 1\n");
553#endif
555 }
556
557 Con_DPrint("========Initialized=========\n");
559
560 if (cls.state != ca_dedicated)
562}
563
564/*
565===============
566Host_Shutdown
567
568Cleanly shuts down, Host_Frame() must not be called again after this.
569===============
570*/
572{
573 if (Sys_CheckParm("-profilegameonly"))
574 Sys_AllowProfiling(false);
575
576 if(cls.state != ca_dedicated)
577 CL_Shutdown();
578
579 // end the server thread
580 if (svs.threaded)
582
583 // shut down local server if active
586
587 // AK shutdown PRVM
588 // AK hmm, no PRVM_Shutdown(); yet
589
591
592 Curl_Shutdown ();
594
598 Cmd_Shutdown();
600 Log_Close();
602
604
605 Con_Shutdown();
607}
608
609//============================================================================
610
611/*
612==================
613Host_Frame
614
615Runs all active servers
616==================
617*/
618double Host_Frame(double time)
619{
620 double cl_wait, sv_wait;
621
623
624 TaskQueue_Frame(false);
625
626 // keep the random time dependent, but not when playing demos/benchmarking
628 rand();
629
631
633
634 // Run any downloads
635 Curl_Frame();
636
637 // get new SDL events and add commands from keybindings to the cbuf
639
640 // process console commands
642
643 R_TimeReport("---");
644
645 // if the accumulators haven't become positive yet, wait a while
646 sv_wait = - SV_Frame(time);
647 cl_wait = - CL_Frame(time);
648
650
651 if (cls.state == ca_dedicated)
652 return sv_wait; // dedicated
653 else if (!sv.active || svs.threaded)
654 return cl_wait; // connected to server, main menu, or server is on different thread
655 else
656 return min(cl_wait, sv_wait); // listen server or singleplayer
657}
const char * buildstring
Definition builddate.c:5
void CL_DisconnectEx(qbool kicked, const char *fmt,...)
Definition cl_main.c:370
double CL_Frame(double time)
Definition cl_main.c:2802
void CL_StartVideo(void)
Definition cl_main.c:2786
client_static_t cls
Definition cl_main.c:116
void CL_Shutdown(void)
Definition cl_main.c:2951
void CL_Init(void)
Definition cl_main.c:2988
void CL_Parse_ErrorCleanUp(void)
Definition cl_parse.c:4317
void CL_Parse_DumpPacket(void)
Definition cl_parse.c:4308
void SCR_BeginLoadingPlaque(qbool startup)
Definition cl_screen.c:1838
@ ca_dedicated
Definition client.h:530
void Cbuf_Clear(cmd_buf_t *cbuf)
Clears all command buffers.
Definition cmd.c:436
void Cbuf_InsertText(cmd_state_t *cmd, const char *text)
Definition cmd.c:292
void Cmd_SaveInitState(void)
called by Host_Init, this marks cvars, commands and aliases with their init values
Definition cmd.c:2159
void Cbuf_AddText(cmd_state_t *cmd, const char *text)
Definition cmd.c:264
void Cmd_RestoreInitState(void)
Restores cvars, commands and aliases to their init values and deletes any that were added since init.
Definition cmd.c:2180
void Cmd_Init(void)
Command execution takes a null terminated string, breaks it into tokens, then searches for a command ...
Definition cmd.c:1492
void Cbuf_Frame(cmd_buf_t *cbuf)
Definition cmd.c:417
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
Definition cmd.c:1661
cmd_state_t * cmd_local
command interpreter for local commands injected by SVQC, CSQC, MQC, server or client engine code uses...
Definition cmd.c:25
void Cbuf_Execute(cmd_buf_t *cbuf)
Definition cmd.c:351
void Cmd_Shutdown(void)
Definition cmd.c:1575
#define CF_READONLY
cvar cannot be changed from the console or the command buffer, and is considered CF_PERSISTENT
Definition cmd.h:54
#define CF_SHARED
Definition cmd.h:67
@ src_client
came in over a net connection as a clc_stringcmd host_client will be valid during this state.
Definition cmd.h:73
@ src_local
from the command buffer
Definition cmd.h:75
#define CF_SERVER
cvar/command that only the server can change/execute
Definition cmd.h:49
static int Cmd_Argc(cmd_state_t *cmd)
Definition cmd.h:249
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
Definition cmd.h:254
#define CF_CLIENT
cvar/command that only the client can change/execute
Definition cmd.h:48
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
Definition cmd.h:53
gamemode_t gamemode
Definition com_game.c:26
const char * gamename
Definition com_game.c:27
@ GAME_TEU
Definition com_game.h:37
@ GAME_TRANSFUSION
Definition com_game.h:35
@ GAME_NEHAHRA
Definition com_game.h:32
int dpvsnprintf(char *buffer, size_t buffersize, const char *format, va_list args)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
Definition common.c:1010
char * va(char *buf, size_t buflen, const char *format,...)
Definition common.c:972
void COM_Init_Commands(void)
Definition common.c:917
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
Definition common.c:997
#define dp_strlcpy(dst, src, dsize)
Definition common.h:303
void Con_Init(void)
Definition console.c:861
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
Definition console.c:1514
void Log_Start(void)
Definition console.c:542
void Log_DestBuffer_Flush(void)
call this once per frame to send out replies to rcon streaming clients
Definition console.c:465
void Con_DPrint(const char *msg)
A Con_Print that only shows up if the "developer" cvar is set.
Definition console.c:1531
void Con_Rcon_Redirect_Abort(void)
Definition console.c:1048
void Con_Shutdown(void)
Definition console.c:941
void Log_Close(void)
Definition console.c:521
#define CON_WARN
Definition console.h:101
#define CON_ERROR
Definition console.h:102
void Crypto_Init_Commands(void)
Definition crypto.c:1449
void Crypto_Shutdown(void)
Definition crypto.c:1043
void Crypto_Init(void)
Definition crypto.c:1072
float time
void Cvar_SetValueQuick(cvar_t *var, float value)
Definition cvar.c:473
void Cvar_SetQuick(cvar_t *var, const char *value)
Definition cvar.c:436
cvar_state_t cvars_all
Definition cvar.c:28
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
Definition cvar.c:599
void Cvar_WriteVariables(cvar_state_t *cvars, qfile_t *f)
Definition cvar.c:985
void Cvar_RegisterCallback(cvar_t *variable, void(*callback)(cvar_t *))
Definition cvar.c:495
qfile_t * FS_SysOpen(const char *filepath, const char *mode, qbool nonblocking)
Definition fs.c:2484
qfile_t * FS_OpenRealFile(const char *filepath, const char *mode, qbool quiet)
Definition fs.c:2901
void FS_Init(void)
Definition fs.c:2342
int FS_Close(qfile_t *file)
Definition fs.c:2970
void FS_CreatePath(char *path)
Definition fs.c:1028
char fs_basedir[MAX_OSPATH]
Definition fs.c:444
const char * FS_FileExists(const char *filename)
Look for a file in the packages and in the filesystem Returns its canonical name (same case as used i...
Definition fs.c:3693
char fs_userdir[MAX_OSPATH]
Definition fs.c:442
cvar_t gl_printcheckerror
Definition gl_backend.c:9
cvar_t gl_paranoid
Definition gl_backend.c:8
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition glquake.h:657
cvar_t developer_insane
Definition host.c:50
void Host_LockSession(void)
Definition host.c:330
cvar_t timeformat
Definition host.c:56
cvar_t sessionid
Definition host.c:58
static void Host_InitSession(void)
Definition host.c:309
cvar_t developer
Definition host.c:48
cvar_t host_speeds
Definition host.c:46
host_static_t host
Definition host.c:41
char engineversion[128]
version string for the corner of the console, crash messages, status command, etc
Definition host.c:304
static void Host_Version_f(cmd_state_t *cmd)
Definition host.c:157
cvar_t host_framerate
Definition host.c:44
void Host_UpdateVersion(void)
Definition host.c:162
static qfile_t * locksession_fh
Definition host.c:307
cvar_t developer_extra
Definition host.c:49
void Host_Shutdown(void)
Definition host.c:571
void Host_Init(void)
Definition host.c:377
void Host_AbortCurrentFrame(void)
Definition host.c:70
void Host_Error(const char *error,...)
Definition host.c:85
cvar_t developer_loading
Definition host.c:52
static void Host_SaveConfig_f(cmd_state_t *cmd)
Definition host.c:222
void Host_UnlockSession(void)
Definition host.c:356
static void SendCvar_f(cmd_state_t *cmd)
Definition host.c:174
cvar_t r_texture_jpeg_fastpicmip
Definition jpeg.c:32
static void Host_Framerate_c(cvar_t *var)
Definition host.c:167
cvar_t developer_loadfile
Definition host.c:51
cvar_t developer_entityparsing
Definition host.c:53
static void Host_LoadConfig_f(cmd_state_t *cmd)
Definition host.c:257
cvar_t locksession
Definition host.c:59
static void Host_Quit_f(cmd_state_t *cmd)
Definition host.c:149
cvar_t host_isclient
Definition host.c:61
static void Host_AddConfigText(cmd_state_t *cmd)
Definition host.c:232
void Host_SaveConfig(const char *file)
Definition host.c:195
static void Host_InitLocal(void)
Definition host.c:279
static qbool locksession_run
Definition host.c:308
double Host_Frame(double time)
Definition host.c:618
cvar_t timestamps
Definition host.c:55
@ host_init
Definition host.h:23
@ host_active
Definition host.h:25
@ host_shutdown
states >= host_shutdown cause graceful shutdown, see Sys_HandleCrash() comments
Definition host.h:27
static const char *const host_state_str[]
Definition host.h:31
void Key_WriteBindings(qfile_t *f)
Definition keys.c:1681
void Curl_Init_Commands(void)
Definition libcurl.c:1578
void Curl_Frame(void)
Definition libcurl.c:1134
void Curl_Init(void)
Definition libcurl.c:810
void Curl_Shutdown(void)
Definition libcurl.c:828
void Mathlib_Init(void)
Definition mathlib.c:833
#define min(A, B)
Definition mathlib.h:37
void(* MR_Shutdown)(void)
Definition menu.c:5481
void MR_Init(void)
Definition menu.c:5543
float strlen(string s)
void error(string err,...)
void cmd(string command,...)
void Mod_Init(void)
void NetConn_UpdateSockets(void)
Definition netconn.c:1306
void NetConn_Init(void)
Definition netconn.c:4094
void NetConn_Shutdown(void)
Definition netconn.c:4201
void PRVM_Init(void)
void PRVM_Crash(void)
Definition prvm_exec.c:750
int i
#define MAX_INPUTLINE
maximum size of console commandline, QuakeC strings, and many other text processing buffers
Definition qdefs.h:94
#define NULL
Definition qtypes.h:12
bool qbool
Definition qtypes.h:9
#define STARTCONFIGFILENAME
Definition quakedef.h:28
#define CONFIGFILENAME
Definition quakedef.h:29
void R_TimeReport(const char *desc)
Definition r_stats.c:193
void SV_StartThread(void)
Definition sv_main.c:2850
server_t sv
local server
Definition sv_main.c:223
cvar_t sv_random_seed
Definition sv_main.c:149
double SV_Frame(double time)
Definition sv_main.c:2527
void SV_StopThread(void)
Definition sv_main.c:2860
server_static_t svs
persistant server info
Definition sv_main.c:224
void SV_Init(void)
Definition sv_main.c:504
float f
void S_Startup(void)
Definition snd_main.c:476
qbool demoplayback
Definition client.h:587
qbool connect_trying
Definition client.h:609
cactive_t state
Definition client.h:568
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
Definition cmd.h:127
cmd_buf_t * cbuf
Definition cmd.h:137
Definition cvar.h:66
float value
Definition cvar.h:74
int integer
Definition cvar.h:73
const char * string
Definition cvar.h:71
cmd_buf_t * cbuf
Definition host.h:51
qbool restless
don't sleep
Definition host.h:49
double dirtytime
the main loop wall time for this frame, equal to Sys_DirtyTime() at the start of this host frame
Definition host.h:47
void(* CL_SendCvar)(struct cmd_state_s *)
Definition host.h:58
jmp_buf abortframe
Definition host.h:43
int state
Definition host.h:44
void(* SV_Shutdown)(void)
Definition host.h:60
void(* ConnectLocal)(void)
Definition host.h:55
void(* SV_SendCvar)(struct cmd_state_s *)
Definition host.h:59
unsigned int framecount
incremented every frame, never reset, >0 means Host_AbortCurrentFrame() is possible
Definition host.h:45
double realtime
the accumulated mainloop time since application started (with filtering), without any slowmo or clamp...
Definition host.h:46
void(* ToggleMenu)(void)
Definition host.h:57
struct host_static_t::@12 hook
void(* Disconnect)(qbool, const char *,...)
Definition host.h:56
qbool threaded
Definition server.h:44
qbool active
false if only a net client
Definition server.h:66
int outfd
Definition sys.h:149
int argc
Definition sys.h:146
const char ** argv
Definition sys.h:147
void Sys_SDL_Init(void)
Definition sys_null.c:22
#define DP_OS_NAME
Definition sys.h:95
void Sys_InitProcessNice(void)
called to set process priority for dedicated servers
Definition sys_shared.c:955
void Sys_Error(const char *error,...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN
Causes the entire program to exit ASAP.
Definition sys_shared.c:724
void Sys_AllowProfiling(qbool enable)
Definition sys_shared.c:65
void Sys_SDL_Shutdown(void)
INFO: This is only called by Host_Shutdown so we dont need testing for recursion.
Definition sys_null.c:9
void Sys_SDL_HandleEvents(void)
Perform Key_Event () callbacks until the input que is empty.
Definition vid_null.c:50
double Sys_DirtyTime(void)
Definition sys_shared.c:417
void Sys_MakeProcessMean(void)
Definition sys_shared.c:961
void Sys_Init_Commands(void)
called after command system is initialized but before first Con_Print
Definition sys_shared.c:353
sys_t sys
Definition sys_shared.c:42
int Sys_CheckParm(const char *parm)
Definition sys_shared.c:327
void TaskQueue_Frame(qbool shutdown)
Definition taskqueue.c:213
void TaskQueue_Shutdown(void)
Definition taskqueue.c:60
void TaskQueue_Init(void)
Definition taskqueue.c:53
int Thread_Init(void)
Definition thread_null.c:4
void Thread_Shutdown(void)
Definition thread_null.c:9
void u8_Init(void)
Definition utf8lib.c:13
int cl_available
Definition vid_null.c:24
void World_Init(void)
Definition world.c:38
cvar_t developer_memorydebug
Definition zone.c:91
cvar_t developer_memory
Definition zone.c:90
void Memory_Init_Commands(void)
Definition zone.c:907
void Memory_Init(void)
Definition zone.c:882
void Memory_Shutdown(void)
Definition zone.c:897
#define Z_Malloc(size)
Definition zone.h:161
#define Mem_CheckSentinelsGlobal()
Definition zone.h:102