add code to find driver versions (gack)
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "RageMath.h"
|
||||
#include "RageTypes.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "StepMania.h"
|
||||
|
||||
RageDisplay* DISPLAY = NULL;
|
||||
|
||||
@@ -70,6 +71,10 @@ void GetGLExtensions(set<string> &ext)
|
||||
RageDisplay::RageDisplay( bool windowed, int width, int height, int bpp, int rate, bool vsync )
|
||||
{
|
||||
LOG->Trace( "RageDisplay::RageDisplay()" );
|
||||
|
||||
/* Give hooks a chance to do some debug init before we try to fire up OpenGL. */
|
||||
HOOKS->PreDisplayInit();
|
||||
|
||||
m_oglspecs = new oglspecs_t;
|
||||
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
@@ -60,7 +60,7 @@ IntDir=.\../Release6
|
||||
TargetDir=\temp\stepmania
|
||||
TargetName=StepMania
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -95,7 +95,7 @@ IntDir=.\../Debug6
|
||||
TargetDir=\temp\stepmania
|
||||
TargetName=StepMania-debug
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -726,6 +726,14 @@ SOURCE=.\archutils\Win32\AppInstance.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\archutils\Win32\DebugInfoHunt.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\archutils\Win32\DebugInfoHunt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\archutils\Win32\GotoURL.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -767,6 +767,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
<File
|
||||
RelativePath="archutils\Win32\AppInstance.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="archutils\Win32\DebugInfoHunt.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="archutils\Win32\DebugInfoHunt.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="archutils\Win32\GotoURL.cpp">
|
||||
</File>
|
||||
|
||||
@@ -20,6 +20,10 @@ class ArchHooks
|
||||
public:
|
||||
/* This receives all logs. 'important' is set for Warn and Info. */
|
||||
virtual void Log(CString str, bool important) { }
|
||||
|
||||
/* This is called when DISPLAY is constructed. */
|
||||
virtual void PreDisplayInit() { }
|
||||
|
||||
virtual ~ArchHooks() { }
|
||||
};
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "archutils/win32/tls.h"
|
||||
#include "archutils/win32/crash.h"
|
||||
#include "archutils/win32/DebugInfoHunt.h"
|
||||
|
||||
ArchHooks_Win32::ArchHooks_Win32()
|
||||
{
|
||||
@@ -21,6 +22,13 @@ void ArchHooks_Win32::Log(CString str, bool important)
|
||||
CrashLog(str);
|
||||
}
|
||||
|
||||
void ArchHooks_Win32::PreDisplayInit()
|
||||
{
|
||||
/* This is a good time to do the debug search: before we actually
|
||||
* start OpenGL (in case something goes wrong). */
|
||||
SearchForDebugInfo();
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved.
|
||||
*
|
||||
|
||||
@@ -7,6 +7,7 @@ class ArchHooks_Win32: public ArchHooks
|
||||
public:
|
||||
ArchHooks_Win32();
|
||||
void Log(CString str, bool important);
|
||||
void PreDisplayInit();
|
||||
};
|
||||
|
||||
#undef ARCH_HOOKS
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#include "stdafx.h"
|
||||
#include "DebugInfoHunt.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
#include <d3d8.h>
|
||||
#pragma comment(lib, "d3d8.lib")
|
||||
|
||||
/*
|
||||
* 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));
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
void SearchForDebugInfo()
|
||||
{
|
||||
GetDisplayDriverDebugInfo();
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 by the person(s) listed below. All rights reserved.
|
||||
*
|
||||
* Glenn Maynard
|
||||
*/
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef DEBUG_INFO_HUNT_H
|
||||
#define DEBUG_INFO_HUNT_H
|
||||
|
||||
/* We want debug information; Windows makes us hunt for it. */
|
||||
void SearchForDebugInfo();
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 by the person(s) listed below. All rights reserved.
|
||||
*
|
||||
* Glenn Maynard
|
||||
*/
|
||||
Reference in New Issue
Block a user