2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
|
|
|
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
|
|
|
*
|
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-03-01 03:30:19 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
2009-03-01 03:30:19 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-03-01 03:30:19 +00:00
|
|
|
*/
|
2009-11-26 03:37:10 +00:00
|
|
|
|
|
|
|
#pragma comment(lib, "User32.lib")
|
|
|
|
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
#include "PrecompiledHeader.h"
|
2009-04-28 20:26:43 +00:00
|
|
|
#include "RedtapeWindows.h"
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-09-12 01:03:44 +00:00
|
|
|
#include <ShTypes.h>
|
2009-03-01 03:30:19 +00:00
|
|
|
|
2010-01-26 13:06:53 +00:00
|
|
|
static __aligned16 LARGE_INTEGER lfreq;
|
2009-03-01 03:30:19 +00:00
|
|
|
|
|
|
|
void InitCPUTicks()
|
|
|
|
{
|
|
|
|
QueryPerformanceFrequency( &lfreq );
|
|
|
|
}
|
|
|
|
|
|
|
|
u64 GetTickFrequency()
|
|
|
|
{
|
|
|
|
return lfreq.QuadPart;
|
|
|
|
}
|
|
|
|
|
|
|
|
u64 GetCPUTicks()
|
|
|
|
{
|
|
|
|
LARGE_INTEGER count;
|
|
|
|
QueryPerformanceCounter( &count );
|
|
|
|
return count.QuadPart;
|
|
|
|
}
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-27 00:06:56 +00:00
|
|
|
// Windows SDK 7 provides this but previous ones do not, so roll our own in those cases:
|
|
|
|
#ifndef VER_SUITE_WH_SERVER
|
|
|
|
# define VER_SUITE_WH_SERVER 0x00008000
|
|
|
|
#endif
|
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
|
|
|
|
typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
|
|
|
|
|
|
|
|
// Calculates the Windows OS Version and install information, and returns it as a
|
|
|
|
// human-readable string. :)
|
|
|
|
// (Handy function borrowed from Microsoft's MSDN Online, and reformatted to use wxString.)
|
|
|
|
wxString GetOSVersionString()
|
2009-07-11 08:31:38 +00:00
|
|
|
{
|
2009-11-26 03:37:10 +00:00
|
|
|
wxString retval;
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
OSVERSIONINFOEX osvi;
|
|
|
|
SYSTEM_INFO si;
|
|
|
|
PGNSI pGNSI;
|
|
|
|
PGPI pGPI;
|
|
|
|
BOOL bOsVersionInfoEx;
|
|
|
|
DWORD dwType;
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
memzero( si );
|
|
|
|
memzero( osvi );
|
|
|
|
|
|
|
|
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
|
|
|
|
|
|
|
if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
|
|
|
|
return L"GetVersionEx Error!";
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
// Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
pGNSI = (PGNSI) GetProcAddress( GetModuleHandle(L"kernel32.dll"), "GetNativeSystemInfo" );
|
|
|
|
if(NULL != pGNSI)
|
|
|
|
pGNSI( &si );
|
|
|
|
else
|
|
|
|
GetSystemInfo( &si );
|
|
|
|
|
|
|
|
if ( VER_PLATFORM_WIN32_NT!=osvi.dwPlatformId || osvi.dwMajorVersion <= 4 )
|
|
|
|
return L"Unsupported Operating System!";
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
retval += L"Microsoft ";
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
// Test for the specific product.
|
|
|
|
|
|
|
|
if ( osvi.dwMajorVersion == 6 )
|
2009-07-11 08:31:38 +00:00
|
|
|
{
|
2009-11-26 03:37:10 +00:00
|
|
|
if( osvi.dwMinorVersion == 0 )
|
|
|
|
retval += ( osvi.wProductType == VER_NT_WORKSTATION ) ? L"Windows Vista " : L"Windows Server 2008 ";
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
if ( osvi.dwMinorVersion == 1 )
|
|
|
|
retval += ( osvi.wProductType == VER_NT_WORKSTATION ) ? L"Windows 7 " : L"Windows Server 2008 R2 ";
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
pGPI = (PGPI) GetProcAddress( GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo");
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
pGPI( osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
|
|
|
|
|
|
|
|
switch( dwType )
|
|
|
|
{
|
|
|
|
case PRODUCT_ULTIMATE: retval += L"Ultimate Edition"; break;
|
|
|
|
case PRODUCT_HOME_PREMIUM: retval += L"Home Premium Edition"; break;
|
|
|
|
case PRODUCT_HOME_BASIC: retval += L"Home Basic Edition"; break;
|
|
|
|
case PRODUCT_ENTERPRISE: retval += L"Enterprise Edition"; break;
|
|
|
|
case PRODUCT_BUSINESS: retval += L"Business Edition"; break;
|
|
|
|
case PRODUCT_STARTER: retval += L"Starter Edition"; break;
|
|
|
|
case PRODUCT_CLUSTER_SERVER: retval += L"Cluster Server Edition"; break;
|
|
|
|
case PRODUCT_DATACENTER_SERVER: retval += L"Datacenter Edition"; break;
|
|
|
|
case PRODUCT_DATACENTER_SERVER_CORE: retval += L"Datacenter Edition (core installation)"; break;
|
|
|
|
case PRODUCT_ENTERPRISE_SERVER: retval += L"Enterprise Edition"; break;
|
|
|
|
case PRODUCT_ENTERPRISE_SERVER_CORE: retval += L"Enterprise Edition (core installation)"; break;
|
|
|
|
case PRODUCT_SMALLBUSINESS_SERVER: retval += L"Small Business Server"; break;
|
|
|
|
case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: retval += L"Small Business Server Premium Edition"; break;
|
|
|
|
case PRODUCT_STANDARD_SERVER: retval += L"Standard Edition"; break;
|
|
|
|
case PRODUCT_STANDARD_SERVER_CORE: retval += L"Standard Edition (core installation)"; break;
|
|
|
|
case PRODUCT_WEB_SERVER: retval += L"Web Server Edition"; break;
|
|
|
|
}
|
2009-07-11 08:31:38 +00:00
|
|
|
}
|
2009-11-26 03:37:10 +00:00
|
|
|
|
|
|
|
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
|
2009-07-11 08:31:38 +00:00
|
|
|
{
|
2009-11-26 03:37:10 +00:00
|
|
|
if( GetSystemMetrics(SM_SERVERR2) )
|
|
|
|
retval += L"Windows Server 2003 R2, ";
|
|
|
|
else if ( osvi.wSuiteMask==VER_SUITE_STORAGE_SERVER )
|
|
|
|
retval += L"Windows Storage Server 2003";
|
|
|
|
else if ( osvi.wSuiteMask==VER_SUITE_WH_SERVER )
|
|
|
|
retval += L"Windows Home Server";
|
|
|
|
else if( osvi.wProductType == VER_NT_WORKSTATION && si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
|
|
|
|
retval += L"Windows XP Professional x64 Edition";
|
2009-07-11 08:31:38 +00:00
|
|
|
else
|
2009-11-26 03:37:10 +00:00
|
|
|
retval += L"Windows Server 2003, ";
|
|
|
|
|
|
|
|
// Test for the server type.
|
|
|
|
if ( osvi.wProductType != VER_NT_WORKSTATION )
|
|
|
|
{
|
|
|
|
if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 )
|
|
|
|
{
|
|
|
|
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
|
|
|
|
retval += L"Datacenter x64 Edition";
|
|
|
|
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
|
|
|
|
retval += L"Enterprise x64 Edition";
|
|
|
|
else
|
|
|
|
retval += L"Standard x64 Edition";
|
|
|
|
}
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER )
|
|
|
|
retval += L"Compute Cluster Edition";
|
|
|
|
else if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
|
|
|
|
retval += L"Datacenter Edition";
|
|
|
|
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
|
|
|
|
retval += L"Enterprise Edition";
|
|
|
|
else if ( osvi.wSuiteMask & VER_SUITE_BLADE )
|
|
|
|
retval += L"Web Edition";
|
|
|
|
else
|
|
|
|
retval += L"Standard Edition";
|
|
|
|
}
|
|
|
|
}
|
2009-07-11 08:31:38 +00:00
|
|
|
}
|
2009-11-26 03:37:10 +00:00
|
|
|
|
|
|
|
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
|
2009-07-11 08:31:38 +00:00
|
|
|
{
|
2009-11-26 03:37:10 +00:00
|
|
|
retval += L"Windows XP ";
|
|
|
|
retval += ( osvi.wSuiteMask & VER_SUITE_PERSONAL ) ? L"Professional" : L"Home Edition";
|
2009-07-11 08:31:38 +00:00
|
|
|
}
|
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
|
|
|
|
{
|
|
|
|
retval += L"Windows 2000 ";
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
if ( osvi.wProductType == VER_NT_WORKSTATION )
|
|
|
|
{
|
|
|
|
retval += L"Professional";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
|
|
|
|
retval += L"Datacenter Server";
|
|
|
|
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
|
|
|
|
retval += L"Advanced Server";
|
|
|
|
else
|
|
|
|
retval += L"Server";
|
|
|
|
}
|
|
|
|
}
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
// Include service pack (if any) and build number.
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
if( _tcslen(osvi.szCSDVersion) > 0 )
|
|
|
|
retval += (wxString)L" " + osvi.szCSDVersion;
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
retval += wxsFormat( L" (build %d)", osvi.dwBuildNumber );
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
if ( osvi.dwMajorVersion >= 6 )
|
|
|
|
{
|
|
|
|
if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 )
|
|
|
|
retval += L", 64-bit";
|
|
|
|
else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL )
|
|
|
|
retval += L", 32-bit";
|
|
|
|
}
|
2009-07-11 08:31:38 +00:00
|
|
|
|
2009-11-26 03:37:10 +00:00
|
|
|
return retval;
|
|
|
|
}
|