From 94767a4e6d53855aea63b7fe0866a911ce192777 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Thu, 30 Dec 2010 17:00:19 +0000 Subject: [PATCH] added windows version detection back from original sources with extra bits from uhexen2. we may use the information some day.. (or not..) git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@354 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/sys_sdl_win.c | 32 ++++++++++++++++++++++++++++++++ Quake/winquake.h | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Quake/sys_sdl_win.c b/Quake/sys_sdl_win.c index 3f8b1d43..83f8d8c6 100644 --- a/Quake/sys_sdl_win.c +++ b/Quake/sys_sdl_win.c @@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. qboolean isDedicated; +qboolean Win95, Win95old, WinNT, WinVista; static HANDLE hinput, houtput; @@ -145,6 +146,37 @@ int Sys_FileTime (const char *path) void Sys_Init (void) { + OSVERSIONINFO vinfo; + + 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 ("QuakeSpasm requires at least Win95 or NT 4.0"); + } + + if (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + WinNT = true; + if (vinfo.dwMajorVersion >= 6) + WinVista = true; + } + else + { + WinNT = false; /* Win9x or WinME */ + if ((vinfo.dwMajorVersion == 4) && (vinfo.dwMinorVersion == 0)) + { + Win95 = true; + /* Win95-gold or Win95A can't switch bpp automatically */ + if (vinfo.szCSDVersion[1] != 'C' && vinfo.szCSDVersion[1] != 'B') + Win95old = true; + } + } + if (isDedicated) { if (!AllocConsole ()) diff --git a/Quake/winquake.h b/Quake/winquake.h index 95e25f53..22313af8 100644 --- a/Quake/winquake.h +++ b/Quake/winquake.h @@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define WM_MOUSEWHEEL 0x020A #endif -extern qboolean WinNT; +extern qboolean Win95, Win95old, WinNT, WinVista; extern HINSTANCE global_hInstance; extern int global_nCmdShow;