static HANDLE heventChild;
#endif
+sys_t sys;
/*
===============================================================================
dpvsnprintf (text, sizeof (text), error, argptr);
va_end (argptr);
- Con_Printf ("Quake 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)
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)
{
in_sys_error1 = 1;
- Host_Shutdown ();
+ //Host_Shutdown ();
}
// shut down QHOST hooks if necessary
for ( ;; )
{
if (!GetNumberOfConsoleInputEvents (hinput, &numevents))
- {
- cls.state = ca_disconnected;
Sys_Error ("Error getting # of console events (error code %x)", (unsigned int)GetLastError());
- }
if (numevents <= 0)
break;
if (!ReadConsoleInput(hinput, recs, 1, &numread))
- {
- cls.state = ca_disconnected;
Sys_Error ("Error reading console input (error code %x)", (unsigned int)GetLastError());
- }
if (numread != 1)
- {
- cls.state = ca_disconnected;
Sys_Error ("Couldn't read console input (error code %x)", (unsigned int)GetLastError());
- }
if (recs[0].EventType == KEY_EVENT)
{
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 (Sys_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());
#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);
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++;
{
// 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++;
}
Sys_ProvideSelfFD();
+ // used by everything
+ Memory_Init();
+
Host_Main();
+ Sys_Quit(0);
+
/* return success of application */
return true;
}
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();
}
#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");