2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 // sys.h -- non-portable functions
41 extern cvar_t sys_usenoclockbutbenchmark;
50 typedef HMODULE dllhandle_t;
54 typedef void* dllhandle_t;
57 typedef struct dllfunction_s
65 * \param dllnames a NULL terminated array of possible names for the DLL you want to load.
69 qbool Sys_LoadLibrary (const char** dllnames, dllhandle_t* handle, const dllfunction_t *fcts);
70 void Sys_UnloadLibrary (dllhandle_t* handle);
71 void* Sys_GetProcAddress (dllhandle_t handle, const char* name);
73 int Sys_CheckParm (const char *parm);
75 /// called early in Host_Init
76 void Sys_InitConsole (void);
77 /// called after command system is initialized but before first Con_Print
78 void Sys_Init_Commands (void);
81 /// \returns current timestamp
82 char *Sys_TimeString(const char *timeformat);
85 // system IO interface (these are the sys functions that need to be implemented in a new driver atm)
88 /// an error will cause the entire program to exit
89 void Sys_Error (const char *error, ...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN;
91 /// (may) output text to terminal which launched program
92 void Sys_PrintToTerminal(const char *text);
93 void Sys_PrintfToTerminal(const char *fmt, ...);
95 /// INFO: This is only called by Host_Shutdown so we dont need testing for recursion
96 void Sys_Shutdown (void);
97 void Sys_Quit (int returnvalue);
99 /*! on some build/platform combinations (such as Linux gcc with the -pg
100 * profiling option) this can turn on/off profiling, used primarily to limit
101 * profiling to certain areas of the code, such as ingame performance without
102 * regard for loading/shutdown performance (-profilegameonly on commandline)
107 void Sys_AllowProfiling (qbool enable);
109 typedef struct sys_cleantime_s
111 double dirtytime; // last value gotten from Sys_DirtyTime()
112 double cleantime; // sanitized linearly increasing time since app start
116 double Sys_DirtyTime(void);
118 void Sys_ProvideSelfFD (void);
120 char *Sys_ConsoleInput (void);
122 /// called to yield for a little bit so as not to hog cpu when paused or debugging
123 void Sys_Sleep(int microseconds);
125 /// Perform Key_Event () callbacks until the input que is empty
126 void Sys_SendKeyEvents (void);
128 char *Sys_GetClipboardData (void);
130 extern qbool sys_supportsdlgetticks;
131 unsigned int Sys_SDL_GetTicks (void); // wrapper to call SDL_GetTicks
132 void Sys_SDL_Delay (unsigned int milliseconds); // wrapper to call SDL_Delay
134 /// called to set process priority for dedicated servers
135 void Sys_InitProcessNice (void);
136 void Sys_MakeProcessNice (void);
137 void Sys_MakeProcessMean (void);