+WINDOWS CRAP
+
+==============================================================================
+*/
+
+
+/*
+==================
+WinMain
+==================
+*/
+HINSTANCE global_hInstance;
+const char *argv[MAX_NUM_ARGVS];
+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 */
+ if (hPrevInstance)
+ return 0;
+
+ global_hInstance = hInstance;
+
+ lpBuffer.dwLength = sizeof(MEMORYSTATUS);
+ GlobalMemoryStatus (&lpBuffer);
+
+ program_name[sizeof(program_name)-1] = 0;
+ GetModuleFileNameA(NULL, program_name, sizeof(program_name) - 1);
+
+ com_argc = 1;
+ com_argv = argv;
+ argv[0] = program_name;
+
+ // FIXME: this tokenizer is rather redundent, call a more general one
+ while (*lpCmdLine && (com_argc < MAX_NUM_ARGVS))