add workaround to jabo for some old intel gpus (seemingly only involving d3d8) which wreck the SetDllDirectory for the process. A similar workaround may be needed for d39 display method, but that isn't clear yet.
This commit is contained in:
parent
0c8f46427d
commit
d155af6ecd
|
@ -121,10 +121,21 @@ extern "C"
|
||||||
|
|
||||||
STDMETHODIMP D3D8Wrapper::IDirect3D8::CreateDevice(UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3D8Base::D3DPRESENT_PARAMETERS* pPresentationParameters,D3D8Wrapper::IDirect3DDevice8** ppReturnedDeviceInterface)
|
STDMETHODIMP D3D8Wrapper::IDirect3D8::CreateDevice(UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3D8Base::D3DPRESENT_PARAMETERS* pPresentationParameters,D3D8Wrapper::IDirect3DDevice8** ppReturnedDeviceInterface)
|
||||||
{
|
{
|
||||||
|
//sometimes, Intel drivers will clear the dll path. So let's save and restore it (do their job for them)
|
||||||
|
//it doesn't seem like this happens any time besides creating the D3D8 object and a device.
|
||||||
|
//If it does, then this solution isn't scalable at all.
|
||||||
|
//This is a good place to note that it appears possible that on the affected drivers, the D3D9 interface will only SetDllDirectory the first time a D3D9 object is created
|
||||||
|
char oldDllDirectory[MAX_PATH];
|
||||||
|
GetDllDirectory(MAX_PATH, oldDllDirectory);
|
||||||
|
|
||||||
LOG("IDirect3D8::CreateDevice( " << Adapter << " , " << DeviceType << " , " << hFocusWindow << " , " << BehaviorFlags << " , " << pPresentationParameters << " , " << ppReturnedDeviceInterface << " ) [ " << this << " ]\n");
|
LOG("IDirect3D8::CreateDevice( " << Adapter << " , " << DeviceType << " , " << hFocusWindow << " , " << BehaviorFlags << " , " << pPresentationParameters << " , " << ppReturnedDeviceInterface << " ) [ " << this << " ]\n");
|
||||||
D3D8Base::IDirect3DDevice8* realDevice = NULL;
|
D3D8Base::IDirect3DDevice8* realDevice = NULL;
|
||||||
|
|
||||||
HRESULT hr = m_pD3D->CreateDevice(Adapter,DeviceType,hFocusWindow,BehaviorFlags,pPresentationParameters,&realDevice);
|
HRESULT hr = m_pD3D->CreateDevice(Adapter,DeviceType,hFocusWindow,BehaviorFlags,pPresentationParameters,&realDevice);
|
||||||
|
|
||||||
|
//restore old DLL directory
|
||||||
|
SetDllDirectory(oldDllDirectory);
|
||||||
|
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
return hr;
|
return hr;
|
||||||
|
|
|
@ -14,7 +14,11 @@ extern "C"
|
||||||
|
|
||||||
D3D8Wrapper::IDirect3D8* WINAPI Direct3DCreate8(UINT Version)
|
D3D8Wrapper::IDirect3D8* WINAPI Direct3DCreate8(UINT Version)
|
||||||
{
|
{
|
||||||
// Get the real DLL path from the system directory
|
//sometimes, Intel drivers will clear the dll path. So let's save and restore it (do their job for them)
|
||||||
|
char oldDllDirectory[MAX_PATH];
|
||||||
|
GetDllDirectory(MAX_PATH, oldDllDirectory);
|
||||||
|
|
||||||
|
// Get the real DLL path from the system directory, needs to be specific to avoid binding to the d3d8.dll we're in now!
|
||||||
// Might be unsafe
|
// Might be unsafe
|
||||||
CHAR dll_path[1024];
|
CHAR dll_path[1024];
|
||||||
GetSystemDirectory(dll_path,1024);
|
GetSystemDirectory(dll_path,1024);
|
||||||
|
@ -30,6 +34,9 @@ extern "C"
|
||||||
// Wrap the object
|
// Wrap the object
|
||||||
D3D8Wrapper::IDirect3D8* wrappedD3D = D3D8Wrapper::IDirect3D8::GetDirect3D(realD3D);
|
D3D8Wrapper::IDirect3D8* wrappedD3D = D3D8Wrapper::IDirect3D8::GetDirect3D(realD3D);
|
||||||
|
|
||||||
|
//restore old DLL directory
|
||||||
|
SetDllDirectory(oldDllDirectory);
|
||||||
|
|
||||||
return wrappedD3D;
|
return wrappedD3D;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue