X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=sys_win.c;h=ee27f1eb0dbd1d22c0f8a4dfb34c0ce10ef7abde;hb=5297b46dcb238b0e738e2bad7ea5b34413d361a8;hp=54a482ed3120cddcaa365f7b2b96a58f35afcf21;hpb=1b5e3869f0fd3e2fe323680784610d48d6efddca;p=xonotic%2Fdarkplaces.git diff --git a/sys_win.c b/sys_win.c index 54a482ed..ee27f1eb 100644 --- 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_Errorf ("Engine Error: %s\n", text); + Con_Printf(CON_ERROR "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) @@ -242,7 +243,7 @@ void Sys_InitConsole (void) // LadyHavoc: can't check cls.state because it hasn't been initialized yet // if (cls.state == ca_dedicated) - if (COM_CheckParm("-dedicated")) + if (Sys_CheckParm("-dedicated")) { //if ((houtput == 0) || (houtput == INVALID_HANDLE_VALUE)) // LadyHavoc: on Windows XP this is never 0 or invalid, but hinput is invalid { @@ -260,22 +261,22 @@ void Sys_InitConsole (void) #define atoi _atoi64 #endif // give QHOST a chance to hook into the console - if ((t = COM_CheckParm ("-HFILE")) > 0) + if ((t = Sys_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 = Sys_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 = Sys_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++; } @@ -360,8 +361,13 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin Sys_ProvideSelfFD(); + // used by everything + Memory_Init(); + Host_Main(); + Sys_Quit(0); + /* return success of application */ return true; } @@ -380,8 +386,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(); @@ -389,7 +395,7 @@ int main (int argc, const char* argv[]) } #endif -qboolean sys_supportsdlgetticks = false; +qbool sys_supportsdlgetticks = false; unsigned int Sys_SDL_GetTicks (void) { Sys_Error("Called Sys_SDL_GetTicks on non-SDL target");