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 // "double fault": redirect to Sys_Error.
107 if (hosterror)
108 Sys_Error ("Host_Error: recursively entered (original error was: %s new error is: %s)", hosterrorstring2, hosterrorstring1);
109 hosterror = true;
110
111 dp_strlcpy(hosterrorstring2, hosterrorstring1, sizeof(hosterrorstring2));
112
115
116 // print out where the crash happened, if it was caused by QC (and do a cleanup)
117 PRVM_Crash();
118
121
122 // LadyHavoc: if crashing very early, or currently shutting down, do
123 // Sys_Error instead and exit the engine fully
124 if (host.framecount < 1 || host.state != host_active)
125 Sys_Error ("Host_Error during %s: %s", host_state_str[host.state], hosterrorstring1);
126
127 if (cls.state == ca_dedicated)
128 Sys_Error("Host_Error: %s", hosterrorstring1); // dedicated servers exit
129
130 // prevent an endless loop if the error was triggered by a command
132
133 CL_DisconnectEx(false, "Host_Error: %s", hosterrorstring1);
134 cls.demonum = -1; // stop demo loop
135
136 hosterror = false;
137
138 // restore configured outfd
139 sys.outfd = outfd;
140
141 // can't abort a frame if we didn't start one yet, won't get here in that case (see above)
143}
144
145/*
146==================
147Host_Quit_f
148==================
149*/
151{
153 Con_Printf("shutting down already!\n");
154 else
156}
157
159{
160 Con_Printf("Version: %s\n", engineversion);
161}
162
164{
165 dpsnprintf(engineversion, sizeof(engineversion), "%s %s%s %s", gamename ? gamename : "DarkPlaces", DP_OS_NAME, cls.state == ca_dedicated ? " dedicated" : "", buildstring);
166}
167
168static void Host_Framerate_c(cvar_t *var)
169{
170 if (var->value < 0.00001 && var->value != 0)
171 Cvar_SetValueQuick(var, 0);
172}
173
174// TODO: Find a better home for this.
176{
177 if(cmd->source == src_local && host.hook.SV_SendCvar)
178 {
180 return;
181 }
182 if(cmd->source == src_client && host.hook.CL_SendCvar)
183 {
185 return;
186 }
187}
188
189/*
190===============
191Host_SaveConfig_f
192
193Writes key bindings and archived cvars to config.cfg
194===============
195*/
196void Host_SaveConfig(const char *file)
197{
198 qfile_t *f;
199
200// dedicated servers initialize the host but don't parse and set the
201// config.cfg cvars
202 // LadyHavoc: don't save a config if it crashed in startup
203 if (host.framecount >= 3 && cls.state != ca_dedicated && !Sys_CheckParm("-benchmark") && !Sys_CheckParm("-capturedemo"))
204 {
205 f = FS_OpenRealFile(file, "wb", false);
206 if (!f)
207 {
208 Con_Printf(CON_ERROR "Couldn't write %s\n", file);
209 return;
210 }
211 else
212 Con_Printf("Saving config to %s ...\n", file);
213
216#ifdef __EMSCRIPTEN__
217 js_syncFS(false);
218#endif
219 FS_Close (f);
220 }
221}
222
224{
225 const char *file = CONFIGFILENAME;
226
227 if(Cmd_Argc(cmd) >= 2)
228 file = Cmd_Argv(cmd, 1);
229
230 Host_SaveConfig(file);
231}
232
234{
235 // set up the default startmap_sp and startmap_dm aliases (mods can
236 // override these) and then execute the quake.rc startup script
237 if (gamemode == GAME_NEHAHRA)
238 Cbuf_InsertText(cmd, "alias startmap_sp \"map nehstart\"\nalias startmap_dm \"map nehstart\"\nexec " STARTCONFIGFILENAME "\n");
239 else if (gamemode == GAME_TRANSFUSION)
240 Cbuf_InsertText(cmd, "alias startmap_sp \"map e1m1\"\n""alias startmap_dm \"map bb1\"\nexec " STARTCONFIGFILENAME "\n");
241 else if (gamemode == GAME_TEU)
242 Cbuf_InsertText(cmd, "alias startmap_sp \"map start\"\nalias startmap_dm \"map start\"\nexec teu.rc\n");
243 else
244 Cbuf_InsertText(cmd, "alias startmap_sp \"map start\"\nalias startmap_dm \"map start\"\nexec " STARTCONFIGFILENAME "\n");
245
246 // if quake.rc is missing, use default
248 Cbuf_InsertText(cmd, "exec default.cfg\nexec " CONFIGFILENAME "\nexec autoexec.cfg\n");
249}
250
251/*
252===============
253Host_LoadConfig_f
254
255Resets key bindings and cvars to defaults and then reloads scripts
256===============
257*/
259{
260#ifdef CONFIG_MENU
261 // Xonotic QC complains/breaks if its cvars are deleted before its m_shutdown() is called
262 if(MR_Shutdown)
263 MR_Shutdown();
264#endif
266#ifdef CONFIG_MENU
267 // Must re-add menu.c commands or load menu.dat before executing quake.rc or handling events
268 MR_Init();
269#endif
270 // exec startup scripts again
272}
273
274/*
275=======================
276Host_InitLocal
277======================
278*/
280static void Host_InitLocal (void)
281{
282 Cmd_AddCommand(CF_SHARED, "quit", Host_Quit_f, "quit the game");
283 Cmd_AddCommand(CF_SHARED, "version", Host_Version_f, "print engine version");
284 Cmd_AddCommand(CF_SHARED, "saveconfig", Host_SaveConfig_f, "save settings to config.cfg (or a specified filename) immediately (also automatic when quitting)");
285 Cmd_AddCommand(CF_SHARED, "loadconfig", Host_LoadConfig_f, "reset everything and reload configs");
286 Cmd_AddCommand(CF_SHARED, "sendcvar", SendCvar_f, "sends the value of a cvar to the server as a sentcvar command, for use by QuakeC");
291
298
301
303}
304
305char engineversion[128];
306
307
308static qfile_t *locksession_fh = NULL;
309static qbool locksession_run = false;
310static void Host_InitSession(void)
311{
312 int i;
313 char *buf;
316
317 // load the session ID into the read-only cvar
318 if ((i = Sys_CheckParm("-sessionid")) && (i + 1 < sys.argc))
319 {
320 if(sys.argv[i+1][0] == '.')
322 else
323 {
324 buf = (char *)Z_Malloc(strlen(sys.argv[i+1]) + 2);
325 dpsnprintf(buf, sizeof(buf), ".%s", sys.argv[i+1]);
327 }
328 }
329}
330
332{
334 return;
335 locksession_run = true;
336 if(locksession.integer != 0 && !Sys_CheckParm("-readonly"))
337 {
338 char vabuf[1024];
339 char *p = va(vabuf, sizeof(vabuf), "%slock%s", *fs_userdir ? fs_userdir : fs_basedir, sessionid.string);
340 FS_CreatePath(p);
341 locksession_fh = FS_SysOpen(p, "wl", false);
342 // TODO maybe write the pid into the lockfile, while we are at it? may help server management tools
343 if(!locksession_fh)
344 {
345 if(locksession.integer == 2)
346 {
347 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);
348 }
349 else
350 {
351 Sys_Error("session lock %s could not be acquired. Please run with -sessionid and an unique session name.\n", p);
352 }
353 }
354 }
355}
356
358{
359 if(!locksession_run)
360 return;
361 locksession_run = false;
362
364 {
366 // NOTE: we can NOT unlink the lock here, as doing so would
367 // create a race condition if another process created it
368 // between our close and our unlink
370 }
371}
372
373/*
374====================
375Host_Init
376====================
377*/
378void Host_Init (void)
379{
380 int i;
381 char vabuf[1024];
382
383 Sys_SDL_Init();
384
385 Memory_Init();
386
391
393
394 host.realtime = 0;
396
397 if (Sys_CheckParm("-profilegameonly"))
398 Sys_AllowProfiling(false);
399
400 // LadyHavoc: quake never seeded the random number generator before... heh
401 if (Sys_CheckParm("-benchmark"))
402 srand(0); // predictable random sequence for -benchmark
403 else
404 srand((unsigned int)time(NULL));
405
406 // FIXME: this is evil, but possibly temporary
407 // LadyHavoc: doesn't seem very temporary...
408 // LadyHavoc: made this a saved cvar
409// COMMANDLINEOPTION: Console: -developer enables warnings and other notices (RECOMMENDED for mod developers)
410 if (Sys_CheckParm("-developer"))
411 {
413 developer.string = "1";
414 }
415
416 if (Sys_CheckParm("-developer2") || Sys_CheckParm("-developer3"))
417 {
419 developer.string = "1";
428 }
429
430 if (Sys_CheckParm("-developer3"))
431 {
434 }
435
436 // -dedicated is checked in SV_ServerOptions() but that's too late for Cvar_RegisterVariable() to skip all the client-only cvars
437 if (Sys_CheckParm ("-dedicated") || !cl_available)
439
440 // set and print initial version string (will be updated when gamename is changed)
441 Host_UpdateVersion(); // checks for cls.state == ca_dedicated
442 Con_Printf("%s\n", engineversion);
443
444 // initialize console command/cvar/alias/command execution systems
445 Cmd_Init();
446
447 // initialize memory subsystem cvars/commands
449
450 // initialize console and logging and its cvars/commands
451 // this enables Con_Printf() messages to be coloured
452 Con_Init();
453
454 // initialize various cvars that could not be initialized earlier
455 u8_Init();
459
460 // initialize filesystem (including fs_basedir, fs_gamedir, -game, scr_screenshot_name, gamename)
461 FS_Init();
462
463 // initialize process nice level
465
466 // initialize ixtable
467 Mathlib_Init();
468
469 // register the cvars for session locking
471
472 // must be after FS_Init
473 Crypto_Init();
475
476 NetConn_Init();
477 Curl_Init();
478 PRVM_Init();
479 Mod_Init();
480 World_Init();
481 SV_Init();
483
484 Thread_Init();
486
487 CL_Init();
488
489 // save off current state of aliases, commands and cvars for later restore if FS_GameDir_f is called
490 // NOTE: menu commands are freed by Cmd_RestoreInitState
492
493 // here comes the not so critical stuff
494
496 Cbuf_Execute(cmd_local->cbuf); // cannot be in Host_AddConfigText as that would cause Host_LoadConfig_f to loop!
497
499
500 Log_Start();
501
502 if (cls.state != ca_dedicated)
503 {
504 // put up the loading image so the user doesn't stare at a black screen...
506 S_Startup();
507#ifdef CONFIG_MENU
508 MR_Init();
509#endif
510 }
511
512 // check for special benchmark mode
513// 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)
514 i = Sys_CheckParm("-benchmark");
515 if (i && i + 1 < sys.argc)
517 {
518 Cbuf_AddText(cmd_local, va(vabuf, sizeof(vabuf), "timedemo %s\n", sys.argv[i + 1]));
520 }
521
522 // check for special demo mode
523// COMMANDLINEOPTION: Client: -demo <demoname> runs a playdemo and quits
524 i = Sys_CheckParm("-demo");
525 if (i && i + 1 < sys.argc)
527 {
528 Cbuf_AddText(cmd_local, va(vabuf, sizeof(vabuf), "playdemo %s\n", sys.argv[i + 1]));
530 }
531
532#ifdef CONFIG_VIDEO_CAPTURE
533// COMMANDLINEOPTION: Client: -capturedemo <demoname> captures a playdemo and quits
534 i = Sys_CheckParm("-capturedemo");
535 if (i && i + 1 < sys.argc)
537 {
538 Cbuf_AddText(cmd_local, va(vabuf, sizeof(vabuf), "playdemo %s\ncl_capturevideo 1\n", sys.argv[i + 1]));
539 Cbuf_Execute((cmd_local)->cbuf);
540 }
541#endif
542
543 if (cls.state == ca_dedicated || Sys_CheckParm("-listen"))
545 {
546 Cbuf_AddText(cmd_local, "startmap_dm\n");
548 }
549
551 {
552#ifdef CONFIG_MENU
553 Cbuf_AddText(cmd_local, "togglemenu 1\n");
554#endif
556 }
557
558 Con_DPrint("========Initialized=========\n");
560
561 if (cls.state != ca_dedicated)
563}
564
565/*
566===============
567Host_Shutdown
568
569Cleanly shuts down, Host_Frame() must not be called again after this.
570===============
571*/
573{
574 if (Sys_CheckParm("-profilegameonly"))
575 Sys_AllowProfiling(false);
576
577 if(cls.state != ca_dedicated)
578 CL_Shutdown();
579
580 // end the server thread
581 if (svs.threaded)
583
584 // shut down local server if active
587
588 // AK shutdown PRVM
589 // AK hmm, no PRVM_Shutdown(); yet
590
592
593 Curl_Shutdown ();
595
599 Cmd_Shutdown();
601 Log_Close();
603
605
606 Con_Shutdown();
608}
609
610//============================================================================
611
612/*
613==================
614Host_Frame
615
616Runs all active servers
617==================
618*/
619double Host_Frame(double time)
620{
621 double cl_wait, sv_wait;
622
624
625 TaskQueue_Frame(false);
626
627 // keep the random time dependent, but not when playing demos/benchmarking
629 rand();
630
632
634
635 // Run any downloads
636 Curl_Frame();
637
638 // get new SDL events and add commands from keybindings to the cbuf
640
641 // process console commands
643
644 R_TimeReport("---");
645
646 // if the accumulators haven't become positive yet, wait a while
647 sv_wait = - SV_Frame(time);
648 cl_wait = - CL_Frame(time);
649
651
652 if (cls.state == ca_dedicated)
653 return sv_wait; // dedicated
654 else if (!sv.active || svs.threaded)
655 return cl_wait; // connected to server, main menu, or server is on different thread
656 else
657 return min(cl_wait, sv_wait); // listen server or singleplayer
658}
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:331
cvar_t timeformat
Definition host.c:56
cvar_t sessionid
Definition host.c:58
static void Host_InitSession(void)
Definition host.c:310
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:305
static void Host_Version_f(cmd_state_t *cmd)
Definition host.c:158
cvar_t host_framerate
Definition host.c:44
void Host_UpdateVersion(void)
Definition host.c:163
static qfile_t * locksession_fh
Definition host.c:308
cvar_t developer_extra
Definition host.c:49
void Host_Shutdown(void)
Definition host.c:572
void Host_Init(void)
Definition host.c:378
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:223
void Host_UnlockSession(void)
Definition host.c:357
static void SendCvar_f(cmd_state_t *cmd)
Definition host.c:175
cvar_t r_texture_jpeg_fastpicmip
Definition jpeg.c:32
static void Host_Framerate_c(cvar_t *var)
Definition host.c:168
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:258
cvar_t locksession
Definition host.c:59
static void Host_Quit_f(cmd_state_t *cmd)
Definition host.c:150
cvar_t host_isclient
Definition host.c:61
static void Host_AddConfigText(cmd_state_t *cmd)
Definition host.c:233
void Host_SaveConfig(const char *file)
Definition host.c:196
static void Host_InitLocal(void)
Definition host.c:280
static qbool locksession_run
Definition host.c:309
double Host_Frame(double time)
Definition host.c:619
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