]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_win.c
Consolidate FS_Init and associated code
[xonotic/darkplaces.git] / sys_win.c
index de1f47187c2e0f766414bebf630c3d62cdcae9ed..aa04130add342067e35a0ec043d8e30d96d0099a 100644 (file)
--- a/sys_win.c
+++ b/sys_win.c
@@ -42,6 +42,7 @@ static HANDLE heventParent;
 static HANDLE  heventChild;
 #endif
 
+sys_t sys;
 
 /*
 ===============================================================================
@@ -64,7 +65,7 @@ void Sys_Error (const char *error, ...)
        dpvsnprintf (text, sizeof (text), error, argptr);
        va_end (argptr);
 
-       Con_Printf ("Quake Error: %s\n", text);
+       Con_Errorf ("Engine Error: %s\n", text);
 
        // close video so the message box is visible, unless we already tried that
        if (!in_sys_error0 && cls.state != ca_dedicated)
@@ -76,7 +77,7 @@ void Sys_Error (const char *error, ...)
        if (!in_sys_error3 && cls.state != ca_dedicated)
        {
                in_sys_error3 = true;
-               MessageBox(NULL, text, "Quake Error", MB_OK | MB_SETFOREGROUND | MB_ICONSTOP);
+               MessageBox(NULL, text, "Engine Error", MB_OK | MB_SETFOREGROUND | MB_ICONSTOP);
        }
 
        if (!in_sys_error1)
@@ -240,11 +241,11 @@ void Sys_InitConsole (void)
        houtput = GetStdHandle (STD_OUTPUT_HANDLE);
        hinput = GetStdHandle (STD_INPUT_HANDLE);
 
-       // LordHavoc: can't check cls.state because it hasn't been initialized yet
+       // LadyHavoc: can't check cls.state because it hasn't been initialized yet
        // if (cls.state == ca_dedicated)
        if (COM_CheckParm("-dedicated"))
        {
-               //if ((houtput == 0) || (houtput == INVALID_HANDLE_VALUE)) // LordHavoc: on Windows XP this is never 0 or invalid, but hinput is invalid
+               //if ((houtput == 0) || (houtput == INVALID_HANDLE_VALUE)) // LadyHavoc: on Windows XP this is never 0 or invalid, but hinput is invalid
                {
                        if (!AllocConsole ())
                                Sys_Error ("Couldn't create dedicated server console (error code %x)", (unsigned int)GetLastError());
@@ -262,20 +263,20 @@ void Sys_InitConsole (void)
        // give QHOST a chance to hook into the console
                if ((t = COM_CheckParm ("-HFILE")) > 0)
                {
-                       if (t < com_argc)
-                               hFile = (HANDLE)atoi (com_argv[t+1]);
+                       if (t < sys.argc)
+                               hFile = (HANDLE)atoi (sys.argv[t+1]);
                }
 
                if ((t = COM_CheckParm ("-HPARENT")) > 0)
                {
-                       if (t < com_argc)
-                               heventParent = (HANDLE)atoi (com_argv[t+1]);
+                       if (t < sys.argc)
+                               heventParent = (HANDLE)atoi (sys.argv[t+1]);
                }
 
                if ((t = COM_CheckParm ("-HCHILD")) > 0)
                {
-                       if (t < com_argc)
-                               heventChild = (HANDLE)atoi (com_argv[t+1]);
+                       if (t < sys.argc)
+                               heventChild = (HANDLE)atoi (sys.argv[t+1]);
                }
 
                InitConProc (hFile, heventParent, heventChild);
@@ -320,12 +321,12 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
        program_name[sizeof(program_name)-1] = 0;
        GetModuleFileNameA(NULL, program_name, sizeof(program_name) - 1);
 
-       com_argc = 1;
-       com_argv = argv;
+       sys.argc = 1;
+       sys.argv = argv;
        argv[0] = program_name;
 
        // FIXME: this tokenizer is rather redundent, call a more general one
-       while (*lpCmdLine && (com_argc < MAX_NUM_ARGVS))
+       while (*lpCmdLine && (sys.argc < MAX_NUM_ARGVS))
        {
                while (*lpCmdLine && ISWHITESPACE(*lpCmdLine))
                        lpCmdLine++;
@@ -337,16 +338,16 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
                {
                        // quoted string
                        lpCmdLine++;
-                       argv[com_argc] = lpCmdLine;
-                       com_argc++;
+                       argv[sys.argc] = lpCmdLine;
+                       sys.argc++;
                        while (*lpCmdLine && (*lpCmdLine != '\"'))
                                lpCmdLine++;
                }
                else
                {
                        // unquoted word
-                       argv[com_argc] = lpCmdLine;
-                       com_argc++;
+                       argv[sys.argc] = lpCmdLine;
+                       sys.argc++;
                        while (*lpCmdLine && !ISWHITESPACE(*lpCmdLine))
                                lpCmdLine++;
                }
@@ -380,8 +381,8 @@ int main (int argc, const char* argv[])
        program_name[sizeof(program_name)-1] = 0;
        GetModuleFileNameA(NULL, program_name, sizeof(program_name) - 1);
 
-       com_argc = argc;
-       com_argv = argv;
+       sys.argc = argc;
+       sys.argv = argv;
 
        Host_Main();