


#include	"..\SCOL\ZooSCOL.h"


 
///////////////////////////////////////////////////////////////
///		CheckOSVersion										///
///////////////////////////////////////////////////////////////
void ZDetector::CheckOSVersion()
{
	OSVERSIONINFO OSinfo;
	OSinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

	GetVersionEx(&OSinfo);
	
	BOOL bIsWindows98orLater = (OSinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) &&
							 ( (OSinfo.dwMajorVersion>4) || ( OSinfo.dwMajorVersion==4 && OSinfo.dwMinorVersion>0 ) );

	MMechostr(0,"\n-----> OS Version Info <-----\n");
	MMechostr(0,"  Version         : %u.%u.%u\n", OSinfo.dwMajorVersion, OSinfo.dwMinorVersion, OSinfo.dwBuildNumber & 0xFFFF);

	if(strlen(&OSinfo.szCSDVersion[0]) > 1)		MMechostr(0,"  Additional info : %s\n", OSinfo.szCSDVersion);
	else										MMechostr(0,"  Additional info : -none-\n");
	
	switch(OSinfo.dwPlatformId)
	{
		case VER_PLATFORM_WIN32s:
			MMechostr(0,"  Win32s on Windows 3.1 detected.\n");
			break;
		
		case VER_PLATFORM_WIN32_WINDOWS:
			if(bIsWindows98orLater)		MMechostr(0,"  Windows 98 or later detected.\n");
			else						if(LOWORD(OSinfo.dwBuildNumber) > 1080)		MMechostr(0,"  Windows 95 OSR2 detected.\n");
										else										MMechostr(0,"  Windows 95 detected.\n");
			break;
		
		case VER_PLATFORM_WIN32_NT:
			MMechostr(0,"  Windows NT or 2K detected.\n");
		break;
	}

	MMechostr(0,"---> End OS Version Info <---\n\n");
}



///////////////////////////////////////////////////////////////
///		CheckMemorySatus									///
///////////////////////////////////////////////////////////////
void ZDetector::CheckMemorySatus()
{
	MEMORYSTATUS	memstat;
	memstat.dwLength = sizeof(MEMORYSTATUS);

	GlobalMemoryStatus(&memstat);

	MMechostr(0,"\n-----> Memory Stat <-----\n" );
	MMechostr(0,"  Total Physical Memory      : %.02f MB\n", memstat.dwTotalPhys/1048576.f);
	MMechostr(0,"  Available Physical Memory  : %.02f MB\n", memstat.dwAvailPhys/1048576.f);
	MMechostr(0,"  Total Virtual Memory       : %u MB\n", memstat.dwTotalVirtual/1048576);
	MMechostr(0,"  Available Virtual Memory   : %u MB\n", memstat.dwAvailVirtual/1048576);
	MMechostr(0,"---> End Memory Stat <---\n\n");
}



///////////////////////////////////////////////////////////////
///		CheckOpenGLvendor									///
///////////////////////////////////////////////////////////////
char* ZDetector::CheckOpenGLvendor()
{
	char			*str;

	str = (char*) glGetString(GL_VENDOR);

	return str;
}



///////////////////////////////////////////////////////////////
///		CheckOpenGLrenderer									///
///////////////////////////////////////////////////////////////
char* ZDetector::CheckOpenGLrenderer()
{
	char			*str;

	str = (char*) glGetString(GL_RENDERER);

	return str;
}



///////////////////////////////////////////////////////////////
///		CheckOpenGLdriver									///
///////////////////////////////////////////////////////////////
char* ZDetector::CheckOpenGLdriver()
{
	char			*str;

	str = (char*) glGetString(GL_VERSION);

	return str;
}



///////////////////////////////////////////////////////////////
///		CheckOpenGLextensions								///
///////////////////////////////////////////////////////////////
char* ZDetector::CheckOpenGLextensions()
{
	char			*str;

	str = (char*) glGetString(GL_EXTENSIONS);

	return str;
}



///////////////////////////////////////////////////////////////
///		CheckOpenGLdriverInfo								///
///////////////////////////////////////////////////////////////
void ZDetector::CheckOpenGLdriverInfo()
{
	char			*str;
	unsigned short	l1;
	char			car;

	MMechostr(0,"\n-----> OpenGL Driver Info <-----\n");

	str = (char*) glGetString(GL_VENDOR);
	if(str) 	MMechostr(0,"  Vendor   : %s \n",str);
	else		MMechostr(0,"  !! ERROR : NO VENDOR INFORMATION !!\n");

	str = (char*) glGetString(GL_RENDERER);
	if(str) 	MMechostr(0,"  Renderer : %s \n",str);
	else		MMechostr(0,"  !! ERROR : NO RENDERER INFORMATION !!\n");

	str = (char*) glGetString(GL_VERSION);
	if(str) 	MMechostr(0,"  Version  : %s \n",str);
	else		MMechostr(0,"  !! ERROR : NO VERSION INFORMATION !!\n");

	MMechostr(0,"  Supported Extensions :\n");
	str = (char*) glGetString(GL_EXTENSIONS);
	if(str) 
	{
		for(l1=0; l1<strlen(str); l1++) 
		{
			car = *(str+l1);
			if(car=='\n') 							break;
			if(l1==0)								MMechostr(0,"     ");
			if(car==' '&& *(str + l1 + 1)!=0) 		MMechostr(0,"\n     ");
			else									MMechostr(0,"%c",car);
		}
	} 
	else 
	{
		MMechostr(0,"     -none-\n");
	}

	MMechostr(0,"\n---> End OpenGL Driver Info <---\n\n");
}