]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_win.c
Implement experimental hook-like system, with working example.
[xonotic/darkplaces.git] / sys_win.c
index 5079e6ac57f3fccbdb9da3ee1e5bfa133eb2d3e1..54a482ed3120cddcaa365f7b2b96a58f35afcf21 100644 (file)
--- a/sys_win.c
+++ b/sys_win.c
@@ -19,18 +19,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 // sys_win.c -- Win32 system interface code
 
-#include "quakedef.h"
 #include <windows.h>
 #include <mmsystem.h>
+#include <direct.h>
 #ifdef SUPPORTDIRECTX
 #include <dsound.h>
 #endif
-#include "errno.h"
+
+#include "qtypes.h"
+
+#include "quakedef.h"
+#include <errno.h>
 #include "resource.h"
 #include "conproc.h"
-#include "direct.h"
-
-cvar_t sys_usetimegettime = {CVAR_SAVE, "sys_usetimegettime", "1", "use windows timeGetTime function (which has issues on some motherboards) for timing rather than QueryPerformanceCounter timer (which has issues on multicore/multiprocessor machines and processors which are designed to conserve power)"};
 
 HANDLE                         hinput, houtput;
 
@@ -63,7 +64,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)
@@ -75,7 +76,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)
@@ -199,16 +200,6 @@ char *Sys_ConsoleInput (void)
        return NULL;
 }
 
-double Sys_DoubleTime (void)
-{
-       return Sys_DoubleTime_Shared();
-}
-
-void Sys_Sleep(int microseconds)
-{
-       Sys_Sleep_Shared(microseconds);
-}
-
 char *Sys_GetClipboardData (void)
 {
        char *data = NULL;
@@ -249,11 +240,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());
@@ -367,6 +358,8 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
                }
        }
 
+       Sys_ProvideSelfFD();
+
        Host_Main();
 
        /* return success of application */