X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=sys_win.c;h=6a33662590836c7ac6dacc6d72577874f4631541;hb=be511c50c3e4e5fa25e56fb957690072d51314c5;hp=c5fdb0c35581bb9dfcb381ad0e66180b27e7b7a8;hpb=8bf0a0e63b2c9998aa79491da2f31fd6d73dd49c;p=xonotic%2Fdarkplaces.git diff --git a/sys_win.c b/sys_win.c index c5fdb0c3..6a336625 100644 --- a/sys_win.c +++ b/sys_win.c @@ -28,8 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "conproc.h" #include "direct.h" -extern void S_BlockSound (void); - 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; @@ -267,11 +265,11 @@ char *Sys_ConsoleInput (void) return NULL; } -void Sys_Sleep(int milliseconds) +void Sys_Sleep(int microseconds) { - if (milliseconds < 1) - milliseconds = 1; - Sleep(milliseconds); + if (microseconds < 1000) + microseconds = 1000; + Sleep(microseconds / 1000); } char *Sys_GetClipboardData (void) @@ -287,8 +285,10 @@ char *Sys_GetClipboardData (void) { if ((cliptext = GlobalLock (hClipboardData)) != 0) { - data = malloc (GlobalSize(hClipboardData)+1); - strcpy (data, cliptext); + size_t allocsize; + allocsize = GlobalSize (hClipboardData) + 1; + data = Z_Malloc (allocsize); + strlcpy (data, cliptext, allocsize); GlobalUnlock (hClipboardData); } } @@ -371,7 +371,6 @@ char program_name[MAX_OSPATH]; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { - double frameoldtime, framenewtime; MEMORYSTATUS lpBuffer; /* previous instances do not exist in Win32 */ @@ -424,17 +423,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin } } - Host_Init (); - - frameoldtime = Sys_DoubleTime (); - - /* main window message loop */ - while (1) - { - framenewtime = Sys_DoubleTime (); - Host_Frame (framenewtime - frameoldtime); - frameoldtime = framenewtime; - } + Host_Main(); /* return success of application */ return true;