]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_win.c
Organize system and host globals into structs. Implement host state tracking
[xonotic/darkplaces.git] / sys_win.c
index 54a482ed3120cddcaa365f7b2b96a58f35afcf21..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;
 
 /*
 ===============================================================================
@@ -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();