Files
itgmania212121/stepmania/src/archutils/Win32/DebugInfoHunt.cpp
T

103 lines
2.5 KiB
C++
Raw Normal View History

2003-02-16 04:05:10 +00:00
#include "global.h"
2003-01-24 23:57:02 +00:00
#include "DebugInfoHunt.h"
#include "RageLog.h"
2003-01-24 23:57:03 +00:00
#include "RageUtil.h"
2003-01-24 23:57:02 +00:00
#include <d3d8.h>
#pragma comment(lib, "d3d8.lib")
2003-02-06 17:10:23 +00:00
2003-01-24 23:57:02 +00:00
/*
* The only way I've found to get the display driver version is through
* D3D. (There's an interface in DirectDraw, but it always returned 0.)
* Make sure this doesn't break if D3D isn't available!
*/
static void GetDisplayDriverDebugInfo()
{
if (FAILED(CoInitialize(NULL)))
return;
IDirect3D8 *m_pd3d = NULL;
try
{
// Construct a Direct3D object
m_pd3d = Direct3DCreate8( D3D_SDK_VERSION );
}
catch (...)
{
}
if( m_pd3d == NULL )
{
LOG->Info("Couldn't get video driver info (no d3d)");
return;
}
HRESULT hr;
D3DADAPTER_IDENTIFIER8 id;
hr = m_pd3d->GetAdapterIdentifier(D3DADAPTER_DEFAULT, D3DENUM_NO_WHQL_LEVEL, &id);
if(FAILED(hr))
{
LOG->Info(hr_ssprintf(hr, "Couldn't get video driver info"));
return;
}
LOG->Info("Video description: %s", id.Description);
LOG->Info("Chipset rev: %i Vendor ID: %i Device ID: %i", id.Revision, id.VendorId, id.DeviceId);
LOG->Info("Video driver: %s %i.%i.%i", id.Driver,
LOWORD(id.DriverVersion.HighPart),
HIWORD(id.DriverVersion.LowPart),
LOWORD(id.DriverVersion.LowPart));
2003-01-26 03:40:18 +00:00
LOG->Info("Video ID: {%8.8x-%4.4x-%4.4x-%6.6x}",
id.DeviceIdentifier.Data1,
id.DeviceIdentifier.Data2,
id.DeviceIdentifier.Data3,
id.DeviceIdentifier.Data4);
2003-01-24 23:57:02 +00:00
CoUninitialize();
}
void SearchForDebugInfo()
{
GetDisplayDriverDebugInfo();
2003-02-06 17:10:23 +00:00
/* Detect operating system. */
OSVERSIONINFO ovi;
ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (GetVersionEx(&ovi)) {
CString Ver = ssprintf("Windows %i.%i (", ovi.dwMajorVersion, ovi.dwMinorVersion);
if(ovi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
{
if(ovi.dwMinorVersion == 0)
Ver += "Win95";
else if(ovi.dwMinorVersion == 10)
Ver += "Win98";
else if(ovi.dwMinorVersion == 90)
Ver += "WinME";
else
Ver += "unknown 9x-based";
}
else if(ovi.dwPlatformId == VER_PLATFORM_WIN32_NT)
{
if(ovi.dwMajorVersion == 4 && ovi.dwMinorVersion == 0)
Ver += "WinNT 4.0";
else if(ovi.dwMajorVersion == 5 && ovi.dwMinorVersion == 0)
Ver += "Win2000";
else if(ovi.dwMajorVersion == 5 && ovi.dwMinorVersion == 1)
Ver += "WinXP";
else
Ver += "unknown NT-based";
} else Ver += "???";
Ver += ssprintf(") build %i [%s]", ovi.dwBuildNumber & 0xffff, ovi.szCSDVersion);
LOG->Info("%s", Ver.GetString());
}
2003-01-24 23:57:02 +00:00
}
/*
* Copyright (c) 2003 by the person(s) listed below. All rights reserved.
*
* Glenn Maynard
*/