-/*
-================
-Sys_MakeCodeWriteable
-================
-*/
-void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
-{
- DWORD flOldProtect;
-
- if (!VirtualProtect((LPVOID)startaddr, length, PAGE_READWRITE, &flOldProtect))
- Sys_Error("Protection change failed\n");
-}
-
-
-/*
-================
-Sys_Init
-================
-*/
-void Sys_Init (void)
-{
- LARGE_INTEGER PerformanceFreq;
- unsigned int lowpart, highpart;
- OSVERSIONINFO vinfo;
-
- if (!QueryPerformanceFrequency (&PerformanceFreq))
- Sys_Error ("No hardware timer available");
-
-// get 32 out of the 64 time bits such that we have around
-// 1 microsecond resolution
- lowpart = (unsigned int)PerformanceFreq.LowPart;
- highpart = (unsigned int)PerformanceFreq.HighPart;
- lowshift = 0;
-
- while (highpart || (lowpart > 2000000.0))
- {
- lowshift++;
- lowpart >>= 1;
- lowpart |= (highpart & 1) << 31;
- highpart >>= 1;
- }
-
- pfreq = 1.0 / (double)lowpart;
-
- Sys_InitFloatTime ();
-
- vinfo.dwOSVersionInfoSize = sizeof(vinfo);
-
- if (!GetVersionEx (&vinfo))
- Sys_Error ("Couldn't get OS info");
-
- if ((vinfo.dwMajorVersion < 4) ||
- (vinfo.dwPlatformId == VER_PLATFORM_WIN32s))
- {
- Sys_Error ("WinQuake requires at least Win95 or NT 4.0");
- }
-
- if (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
- WinNT = true;
- else
- WinNT = false;
-}
-
-