add VideoDriverInfo
This commit is contained in:
+34
-21
@@ -64,7 +64,7 @@ IntDir=.\../Debug6
|
||||
TargetDir=\temp\stepmania
|
||||
TargetName=StepMania-debug-ogl
|
||||
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
|
||||
|
||||
@@ -82,25 +82,25 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania
|
||||
# PROP Intermediate_Dir "StepMania___Xbox_Debug___VC6"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
CPP=cl.exe
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
XBCP=xbecopy.exe
|
||||
# ADD BASE XBCP /NOLOGO
|
||||
# ADD XBCP /NOLOGO
|
||||
XBE=imagebld.exe
|
||||
# ADD BASE XBE /nologo /stack:0x10000 /debug
|
||||
# ADD XBE /nologo /stack:0x10000 /debug
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
|
||||
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
||||
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
|
||||
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
||||
XBE=imagebld.exe
|
||||
# ADD BASE XBE /nologo /stack:0x10000 /debug
|
||||
# ADD XBE /nologo /stack:0x10000 /debug
|
||||
XBCP=xbecopy.exe
|
||||
# ADD BASE XBCP /NOLOGO
|
||||
# ADD XBCP /NOLOGO
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
CPP=cl.exe
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
|
||||
# Begin Special Build Tool
|
||||
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
|
||||
|
||||
@@ -140,7 +140,7 @@ IntDir=.\../Release6
|
||||
TargetDir=\temp\stepmania
|
||||
TargetName=StepMania-ogl
|
||||
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
|
||||
|
||||
@@ -1775,6 +1775,23 @@ SOURCE=.\archutils\Win32\USB.cpp
|
||||
|
||||
SOURCE=.\archutils\Win32\USB.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\archutils\Win32\VideoDriverInfo.cpp
|
||||
|
||||
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\archutils\Win32\VideoDriverInfo.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
@@ -3183,15 +3200,11 @@ SOURCE=.\ScreenAutogenOptions.h
|
||||
|
||||
SOURCE=.\ScreenAutoGraphicDetail.cpp
|
||||
|
||||
!IF "$(CFG)" == "StepMania - Win32 Debug OGL"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Win32 Debug D3D"
|
||||
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Win32 Release D3D"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Win32 Release OGL"
|
||||
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
@@ -189,6 +189,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath="ScreenAttract.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenAutoGraphicDetail.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenAutoGraphicDetail.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenAutogenOptions.cpp">
|
||||
</File>
|
||||
@@ -992,6 +998,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath="archutils\Win32\USB.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="archutils\Win32\VideoDriverInfo.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="archutils\Win32\VideoDriverInfo.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="archutils\Win32\arch_setup.h">
|
||||
</File>
|
||||
|
||||
@@ -2,17 +2,10 @@
|
||||
#include "DebugInfoHunt.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageUtil.h"
|
||||
#include "VideoDriverInfo.h"
|
||||
#include "../../archutils/Win32/GotoURL.h"
|
||||
|
||||
|
||||
struct VideoDriverInfo
|
||||
{
|
||||
CString sProvider;
|
||||
CString sDescription;
|
||||
CString sVersion;
|
||||
CString sDate;
|
||||
CString sDeviceID;
|
||||
};
|
||||
|
||||
|
||||
void LogVideoDriverInfo( VideoDriverInfo info )
|
||||
@@ -25,90 +18,6 @@ void LogVideoDriverInfo( VideoDriverInfo info )
|
||||
LOG->Info("%-15s:\t%s", "DeviceID", info.sDeviceID.c_str());
|
||||
}
|
||||
|
||||
CString GetRegValue( HKEY hKey, CString sName )
|
||||
{
|
||||
char szBuffer[MAX_PATH];
|
||||
DWORD nSize = sizeof(szBuffer)-1;
|
||||
if( RegQueryValueEx(hKey, sName, NULL, NULL, (LPBYTE)szBuffer, &nSize) == ERROR_SUCCESS )
|
||||
return szBuffer;
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
bool GetVideoDriverInfo9x( int iIndex, VideoDriverInfo& infoOut )
|
||||
{
|
||||
HKEY hkey;
|
||||
CString sKey = ssprintf("SYSTEM\\CurrentControlSet\\Services\\Class\\Display\\%04d",iIndex);
|
||||
if (RegOpenKey(HKEY_LOCAL_MACHINE, sKey, &hkey) != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
infoOut.sDate = GetRegValue( hkey, "DriverDate");
|
||||
infoOut.sDescription = GetRegValue( hkey, "DriverDesc");
|
||||
infoOut.sDeviceID = GetRegValue( hkey, "MatchingDeviceId");
|
||||
infoOut.sProvider = GetRegValue( hkey, "ProviderName");
|
||||
infoOut.sVersion = GetRegValue( hkey, "Ver");
|
||||
|
||||
RegCloseKey(hkey);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool GetVideoDriverInfo2k( int iIndex, VideoDriverInfo& infoOut )
|
||||
{
|
||||
HKEY hkey;
|
||||
CString sKey = ssprintf("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E968-E325-11CE-BFC1-08002BE10318}\\%04d",iIndex);
|
||||
if (RegOpenKey(HKEY_LOCAL_MACHINE, sKey, &hkey) != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
infoOut.sDate = GetRegValue( hkey, "DriverDate");
|
||||
infoOut.sDescription = GetRegValue( hkey, "DriverDesc");
|
||||
infoOut.sDeviceID = GetRegValue( hkey, "MatchingDeviceId");
|
||||
infoOut.sProvider = GetRegValue( hkey, "ProviderName");
|
||||
infoOut.sVersion = GetRegValue( hkey, "DriverVersion");
|
||||
|
||||
RegCloseKey(hkey);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
CString GetPrimaryVideoName9xAnd2k() // this will not work on 95 and NT b/c of EnumDisplayDevices
|
||||
{
|
||||
|
||||
typedef BOOL (WINAPI* pfnEnumDisplayDevices)(PVOID,DWORD,PDISPLAY_DEVICE,DWORD);
|
||||
pfnEnumDisplayDevices EnumDisplayDevices;
|
||||
HINSTANCE hInstUser32;
|
||||
|
||||
hInstUser32 = LoadLibrary("User32.DLL");
|
||||
if( !hInstUser32 )
|
||||
return "";
|
||||
|
||||
// VC6 don't have a stub to static link with, so link dynamically.
|
||||
EnumDisplayDevices = (pfnEnumDisplayDevices)GetProcAddress(hInstUser32,"EnumDisplayDevicesA");
|
||||
if( EnumDisplayDevices == NULL )
|
||||
{
|
||||
FreeLibrary(hInstUser32);
|
||||
return "";
|
||||
}
|
||||
|
||||
CString sPrimaryDeviceName;
|
||||
for( DWORD i=0; true; i++ )
|
||||
{
|
||||
DISPLAY_DEVICE dd;
|
||||
ZERO( dd );
|
||||
dd.cb = sizeof(dd);
|
||||
if( !EnumDisplayDevices(NULL, i, &dd, 0) )
|
||||
break;
|
||||
if( dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE )
|
||||
{
|
||||
sPrimaryDeviceName = (char*)dd.DeviceString;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FreeLibrary(hInstUser32);
|
||||
return sPrimaryDeviceName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -121,15 +30,10 @@ static void GetDisplayDriverDebugInfo()
|
||||
else
|
||||
LOG->Info( "Primary display driver: %s", sPrimaryDeviceName.c_str() );
|
||||
|
||||
OSVERSIONINFO version;
|
||||
version.dwOSVersionInfoSize=sizeof(version);
|
||||
GetVersionEx(&version);
|
||||
bool bIsWin9x = version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS;
|
||||
|
||||
for( int i=0; true; i++ )
|
||||
{
|
||||
VideoDriverInfo info;
|
||||
if( ! (bIsWin9x ? GetVideoDriverInfo9x : GetVideoDriverInfo2k)(i,info) )
|
||||
if( !GetVideoDriverInfo(i, info) )
|
||||
break;
|
||||
|
||||
if( sPrimaryDeviceName == "" ) // failed to get primary disaply name (NT4)
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
#include "global.h"
|
||||
#include "VideoDriverInfo.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
static CString GetRegValue( HKEY hKey, CString sName )
|
||||
{
|
||||
char szBuffer[MAX_PATH];
|
||||
DWORD nSize = sizeof(szBuffer)-1;
|
||||
if( RegQueryValueEx(hKey, sName, NULL, NULL, (LPBYTE)szBuffer, &nSize) == ERROR_SUCCESS )
|
||||
return szBuffer;
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
bool GetVideoDriverInfo9x( int iIndex, VideoDriverInfo& infoOut )
|
||||
{
|
||||
HKEY hkey;
|
||||
CString sKey = ssprintf("SYSTEM\\CurrentControlSet\\Services\\Class\\Display\\%04d",iIndex);
|
||||
if (RegOpenKey(HKEY_LOCAL_MACHINE, sKey, &hkey) != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
infoOut.sDate = GetRegValue( hkey, "DriverDate");
|
||||
infoOut.sDescription = GetRegValue( hkey, "DriverDesc");
|
||||
infoOut.sDeviceID = GetRegValue( hkey, "MatchingDeviceId");
|
||||
infoOut.sProvider = GetRegValue( hkey, "ProviderName");
|
||||
infoOut.sVersion = GetRegValue( hkey, "Ver");
|
||||
|
||||
RegCloseKey(hkey);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool GetVideoDriverInfo2k( int iIndex, VideoDriverInfo& infoOut )
|
||||
{
|
||||
HKEY hkey;
|
||||
CString sKey = ssprintf("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E968-E325-11CE-BFC1-08002BE10318}\\%04d",iIndex);
|
||||
if (RegOpenKey(HKEY_LOCAL_MACHINE, sKey, &hkey) != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
infoOut.sDate = GetRegValue( hkey, "DriverDate");
|
||||
infoOut.sDescription = GetRegValue( hkey, "DriverDesc");
|
||||
infoOut.sDeviceID = GetRegValue( hkey, "MatchingDeviceId");
|
||||
infoOut.sProvider = GetRegValue( hkey, "ProviderName");
|
||||
infoOut.sVersion = GetRegValue( hkey, "DriverVersion");
|
||||
|
||||
RegCloseKey(hkey);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// this will not work on 95 and NT b/c of EnumDisplayDevices
|
||||
CString GetPrimaryVideoName9xAnd2k()
|
||||
{
|
||||
|
||||
typedef BOOL (WINAPI* pfnEnumDisplayDevices)(PVOID,DWORD,PDISPLAY_DEVICE,DWORD);
|
||||
pfnEnumDisplayDevices EnumDisplayDevices;
|
||||
HINSTANCE hInstUser32;
|
||||
|
||||
hInstUser32 = LoadLibrary("User32.DLL");
|
||||
if( !hInstUser32 )
|
||||
return "";
|
||||
|
||||
// VC6 don't have a stub to static link with, so link dynamically.
|
||||
EnumDisplayDevices = (pfnEnumDisplayDevices)GetProcAddress(hInstUser32,"EnumDisplayDevicesA");
|
||||
if( EnumDisplayDevices == NULL )
|
||||
{
|
||||
FreeLibrary(hInstUser32);
|
||||
return "";
|
||||
}
|
||||
|
||||
CString sPrimaryDeviceName;
|
||||
for( DWORD i=0; true; i++ )
|
||||
{
|
||||
DISPLAY_DEVICE dd;
|
||||
ZERO( dd );
|
||||
dd.cb = sizeof(dd);
|
||||
if( !EnumDisplayDevices(NULL, i, &dd, 0) )
|
||||
break;
|
||||
if( dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE )
|
||||
{
|
||||
sPrimaryDeviceName = (char*)dd.DeviceString;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FreeLibrary(hInstUser32);
|
||||
return sPrimaryDeviceName;
|
||||
}
|
||||
|
||||
void GetPrimaryVideoDriverInfo(VideoDriverInfo &info)
|
||||
{
|
||||
const CString sPrimaryDeviceName = GetPrimaryVideoName9xAnd2k();
|
||||
if( sPrimaryDeviceName == "" )
|
||||
LOG->Warn("GetPrimaryVideoName9xAnd2k failed; renderer selection may be wrong");
|
||||
|
||||
for( int i=0; true; i++ )
|
||||
{
|
||||
if( !GetVideoDriverInfo(i, info) )
|
||||
RageException::Throw( "Got video name \"%s\" but wasn't enumerated among %i devices",
|
||||
sPrimaryDeviceName.c_str(), i );
|
||||
|
||||
if( sPrimaryDeviceName == "" ) // failed to get primary display name (NT4)
|
||||
return;
|
||||
|
||||
if( info.sDescription == sPrimaryDeviceName )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get info for the given card number. Return false if that card doesn't exist. */
|
||||
bool GetVideoDriverInfo(int cardno, VideoDriverInfo &info)
|
||||
{
|
||||
OSVERSIONINFO version;
|
||||
version.dwOSVersionInfoSize=sizeof(version);
|
||||
GetVersionEx(&version);
|
||||
const bool bIsWin9x = version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS;
|
||||
|
||||
return (bIsWin9x ? GetVideoDriverInfo9x : GetVideoDriverInfo2k)(cardno,info);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef VIDEO_DRIVER_INFO_H
|
||||
#define VIDEO_DRIVER_INFO_H
|
||||
|
||||
struct VideoDriverInfo
|
||||
{
|
||||
CString sProvider;
|
||||
CString sDescription;
|
||||
CString sVersion;
|
||||
CString sDate;
|
||||
CString sDeviceID;
|
||||
};
|
||||
|
||||
CString GetPrimaryVideoName9xAnd2k();
|
||||
bool GetVideoDriverInfo(int cardno, VideoDriverInfo &info);
|
||||
void GetPrimaryVideoDriverInfo(VideoDriverInfo &info);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user