]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_win.c
376
[xonotic/darkplaces.git] / sys_win.c
index 36ab6e59efef73a816815bf92803ee93bc75e97e..90545065c24c41580170089e0123b64ad659e03d 100644 (file)
--- a/sys_win.c
+++ b/sys_win.c
@@ -57,7 +57,7 @@ void Sys_Error (const char *error, ...)
        static int      in_sys_error3 = 0;
 
        va_start (argptr, error);
-       vsnprintf (text, sizeof (text), error, argptr);
+       dpvsnprintf (text, sizeof (text), error, argptr);
        va_end (argptr);
 
        Con_Printf ("Quake Error: %s\n", text);
@@ -279,7 +279,7 @@ char *Sys_GetClipboardData (void)
 
                if ((hClipboardData = GetClipboardData (CF_TEXT)) != 0)
                {
-                       if ((cliptext = GlobalLock (hClipboardData)) != 0) 
+                       if ((cliptext = GlobalLock (hClipboardData)) != 0)
                        {
                                data = malloc (GlobalSize(hClipboardData)+1);
                                strcpy (data, cliptext);
@@ -291,6 +291,57 @@ char *Sys_GetClipboardData (void)
        return data;
 }
 
+void Sys_InitConsole (void)
+{
+       int t;
+
+       // initialize the windows dedicated server console if needed
+       tevent = CreateEvent(NULL, false, false, NULL);
+
+       if (!tevent)
+               Sys_Error ("Couldn't create event");
+
+       // LordHavoc: can't check cls.state because it hasn't been initialized yet
+       // if (cls.state == ca_dedicated)
+       if (COM_CheckParm("-dedicated"))
+       {
+               if (!AllocConsole ())
+                       Sys_Error ("Couldn't create dedicated server console");
+
+               hinput = GetStdHandle (STD_INPUT_HANDLE);
+               houtput = GetStdHandle (STD_OUTPUT_HANDLE);
+
+       // 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 = COM_CheckParm ("-HPARENT")) > 0)
+               {
+                       if (t < com_argc)
+                               heventParent = (HANDLE)atoi (com_argv[t+1]);
+               }
+
+               if ((t = COM_CheckParm ("-HCHILD")) > 0)
+               {
+                       if (t < com_argc)
+                               heventChild = (HANDLE)atoi (com_argv[t+1]);
+               }
+
+               InitConProc (hFile, heventParent, heventChild);
+       }
+
+// because sound is off until we become active
+       S_BlockSound ();
+}
+
+void Sys_Init_Commands (void)
+{
+       Cvar_RegisterVariable(&sys_usetimegettime);
+}
+
 /*
 ==============================================================================
 
@@ -313,7 +364,6 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
 {
        double frameoldtime, framenewtime;
        MEMORYSTATUS lpBuffer;
-       int t;
 
        /* previous instances do not exist in Win32 */
        if (hPrevInstance)
@@ -365,56 +415,10 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
                }
        }
 
-       Sys_Shared_EarlyInit();
-
-       Cvar_RegisterVariable(&sys_usetimegettime);
-
-       tevent = CreateEvent(NULL, false, false, NULL);
-
-       if (!tevent)
-               Sys_Error ("Couldn't create event");
-
-       // LordHavoc: can't check cls.state because it hasn't been initialized yet
-       // if (cls.state == ca_dedicated)
-       if (COM_CheckParm("-dedicated"))
-       {
-               if (!AllocConsole ())
-                       Sys_Error ("Couldn't create dedicated server console");
-
-               hinput = GetStdHandle (STD_INPUT_HANDLE);
-               houtput = GetStdHandle (STD_OUTPUT_HANDLE);
-
-       // 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 = COM_CheckParm ("-HPARENT")) > 0)
-               {
-                       if (t < com_argc)
-                               heventParent = (HANDLE)atoi (com_argv[t+1]);
-               }
-
-               if ((t = COM_CheckParm ("-HCHILD")) > 0)
-               {
-                       if (t < com_argc)
-                               heventChild = (HANDLE)atoi (com_argv[t+1]);
-               }
-
-               InitConProc (hFile, heventParent, heventChild);
-       }
-
-// because sound is off until we become active
-       S_BlockSound ();
-
        Host_Init ();
 
-       Sys_Shared_LateInit();
-
        frameoldtime = Sys_DoubleTime ();
-       
+
        /* main window message loop */
        while (1)
        {