wined3d: Add registry key for overriding pci device id.

This commit is contained in:
Roderick Colenbrander 2008-11-23 22:33:29 +01:00 committed by Alexandre Julliard
parent f442bafb8a
commit 52d59718c7
3 changed files with 35 additions and 1 deletions

View File

@ -1669,6 +1669,12 @@ static HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Ad
*(pIdentifier->Revision) = 0; *(pIdentifier->Revision) = 0;
*pIdentifier->DeviceIdentifier = IID_D3DDEVICE_D3DUID; *pIdentifier->DeviceIdentifier = IID_D3DDEVICE_D3DUID;
if(wined3d_settings.pci_device_id != PCI_DEVICE_NONE)
{
TRACE_(d3d_caps)("Overriding pci device id with: %x\n", wined3d_settings.pci_device_id);
*(pIdentifier->DeviceId) = wined3d_settings.pci_device_id;
}
if (Flags & WINED3DENUM_NO_WHQL_LEVEL) { if (Flags & WINED3DENUM_NO_WHQL_LEVEL) {
*(pIdentifier->WHQLLevel) = 0; *(pIdentifier->WHQLLevel) = 0;
} else { } else {

View File

@ -43,6 +43,7 @@ wined3d_settings_t wined3d_settings =
TRUE, /* Use of GLSL enabled by default */ TRUE, /* Use of GLSL enabled by default */
ORM_BACKBUFFER, /* Use the backbuffer to do offscreen rendering */ ORM_BACKBUFFER, /* Use the backbuffer to do offscreen rendering */
RTL_AUTO, /* Automatically determine best locking method */ RTL_AUTO, /* Automatically determine best locking method */
PCI_DEVICE_NONE,/* PCI Device ID */
0, /* The default of memory is set in FillGLCaps */ 0, /* The default of memory is set in FillGLCaps */
NULL, /* No wine logo by default */ NULL, /* No wine logo by default */
FALSE /* Disable multisampling for now due to Nvidia driver bugs which happens for some users */ FALSE /* Disable multisampling for now due to Nvidia driver bugs which happens for some users */
@ -77,6 +78,15 @@ static inline DWORD get_config_key(HKEY defkey, HKEY appkey, const char* name, c
return ERROR_FILE_NOT_FOUND; return ERROR_FILE_NOT_FOUND;
} }
static inline DWORD get_config_key_dword(HKEY defkey, HKEY appkey, const char* name, DWORD *data)
{
DWORD type;
DWORD size = sizeof(DWORD);
if (0 != appkey && !RegQueryValueExA( appkey, name, 0, &type, (LPBYTE) data, &size ) && (type == REG_DWORD)) return 0;
if (0 != defkey && !RegQueryValueExA( defkey, name, 0, &type, (LPBYTE) data, &size ) && (type == REG_DWORD)) return 0;
return ERROR_FILE_NOT_FOUND;
}
static void wined3d_do_nothing(void) static void wined3d_do_nothing(void)
{ {
} }
@ -92,7 +102,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
DWORD size = sizeof(buffer); DWORD size = sizeof(buffer);
HKEY hkey = 0; HKEY hkey = 0;
HKEY appkey = 0; HKEY appkey = 0;
DWORD len; DWORD len, tmpvalue;
WNDCLASSA wc; WNDCLASSA wc;
/* We need our own window class for a fake window which we use to retrieve GL capabilities */ /* We need our own window class for a fake window which we use to retrieve GL capabilities */
@ -238,6 +248,21 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
wined3d_settings.rendertargetlock_mode = RTL_TEXTEX; wined3d_settings.rendertargetlock_mode = RTL_TEXTEX;
} }
} }
if ( !get_config_key_dword( hkey, appkey, "VideoPciDeviceID", &tmpvalue) )
{
int pci_device_id = tmpvalue;
/* A pci device id is 16-bit */
if(pci_device_id > 0xffff)
{
ERR("Invalid value for VideoPciDeviceID. The value should be smaller or equal to 65535 or 0xffff\n");
}
else
{
TRACE("Using PCI Device ID %04x\n", pci_device_id);
wined3d_settings.pci_device_id = pci_device_id;
}
}
if ( !get_config_key( hkey, appkey, "VideoMemorySize", buffer, size) ) if ( !get_config_key( hkey, appkey, "VideoMemorySize", buffer, size) )
{ {
int TmpVideoMemorySize = atoi(buffer); int TmpVideoMemorySize = atoi(buffer);

View File

@ -185,6 +185,8 @@ static inline float float_16_to_32(const unsigned short *in) {
#define RTL_TEXDRAW 3 #define RTL_TEXDRAW 3
#define RTL_TEXTEX 4 #define RTL_TEXTEX 4
#define PCI_DEVICE_NONE 0xffff /* e.g. 0x14f for a Geforce6200 */
/* NOTE: When adding fields to this structure, make sure to update the default /* NOTE: When adding fields to this structure, make sure to update the default
* values in wined3d_main.c as well. */ * values in wined3d_main.c as well. */
typedef struct wined3d_settings_s { typedef struct wined3d_settings_s {
@ -198,6 +200,7 @@ typedef struct wined3d_settings_s {
BOOL glslRequested; BOOL glslRequested;
int offscreen_rendering_mode; int offscreen_rendering_mode;
int rendertargetlock_mode; int rendertargetlock_mode;
unsigned short pci_device_id;
/* Memory tracking and object counting */ /* Memory tracking and object counting */
unsigned int emulated_textureram; unsigned int emulated_textureram;
char *logo; char *logo;