elishacloud / dxwrapper

Fixes compatibility issues with older games running on Windows 10/11 by wrapping DirectX dlls. Also allows loading custom libraries with the file extension .asi into game processes.
zlib License
1.15k stars 82 forks source link

DirectX7 D3DXCreateContextEx No Z Buffer is available #277

Open H-K-47 opened 2 weeks ago

H-K-47 commented 2 weeks ago

I have a DirectX7 Game that mixes ddraw with GDI.

The game with a custom launcher works fine with ONLY the option DDrawCompat enabled, in fact it works so well it fixes most performance issues through the GDI/GetDC / Surface handling which even dgvodoo2 could not fix till today.

However i tried to use the Dd7to9 option and no matter what setting i try this fails with a game specific error that D3DXCreateContextEx No Z Buffer is available.

  1. Is there a setting for this to fix it? Log File :

14072 01:31:01.055 dd_DirectDrawCreateEx 14072 01:31:01.055 Installing Direct3D driver hooks 14072 01:31:01.055 Installing Win32 hooks 14072 01:31:01.063 Finished installing hooks 14072 01:31:01.063 Redirecting 'DirectDrawCreate' IID_IDirectDraw7 to --> 'Direct3DCreate9' 14072 01:31:01.063 Creating interface m_IDirectDrawX::m_IDirectDrawX (0433DFB0) converting interface from v7 to v9 14072 01:31:01.063 Redirecting 'Direct3DCreate9' ... 14072 01:31:01.065 Creating interface m_IDirect3D9Ex::m_IDirect3D9Ex (042709A8) 14072 01:31:01.088 Creating interface m_IDirect3DX::m_IDirect3DX (008ED530) converting interface from v7 to v9 14072 01:31:01.090 Redirecting 'DirectDrawCreate' IID_IDirectDraw7 to --> 'Direct3DCreate9' 14072 01:31:01.091 Creating interface m_IDirectDrawX::m_IDirectDrawX (0087F1C8) converting interface from v7 to v9 14072 01:31:01.091 m_IDirectDrawX::~m_IDirectDrawX (0087F1C8) deleting interface! 14072 01:31:01.091 m_IDirect3D9Ex::~m_IDirect3D9Ex (008F39C0) deleting interface! 14072 01:31:01.091 m_IDirectDrawX::~m_IDirectDrawX (0433DFB0) deleting interface! 14072 01:31:01.092 m_IDirect3D9Ex::~m_IDirect3D9Ex (042709A8) deleting interface! 14072 01:31:01.092 m_IDirectDrawSurfaceX::CleanupSharedEmulatedMemory Deleting 0 emulated surfaces! 14072 01:31:01.092 m_IDirect3DX::~m_IDirect3DX (008ED530) deleting interface! 14072 01:31:09.712 Redirecting 'Direct3DCreate9' ... 14072 01:31:09.747 Creating interface m_IDirect3D9Ex::m_IDirect3D9Ex (04330ED8) 14072 01:31:09.747 Redirecting 'DirectDrawCreate' IID_IDirectDraw7 to --> 'Direct3DCreate9' 14072 01:31:09.747 Creating interface m_IDirectDrawX::m_IDirectDrawX (043411F0) converting interface from v7 to v9 14072 01:31:09.772 Creating interface m_IDirect3DX::m_IDirect3DX (04336D20) converting interface from v7 to v9 14072 01:31:09.774 m_IDirectDrawX::~m_IDirectDrawX (04340C00) deleting interface! 14072 01:31:09.774 m_IDirect3D9Ex::~m_IDirect3D9Ex (04330ED8) deleting interface! 14072 01:31:09.774 m_IDirectDrawX::CreateD3D9Device Direct3D9 device! 640x480 refresh: 0 format: D3DFMT_X8R8G8B8 wnd: WND(006C0F30,_thegamewndclass,{0,0,2560,1440}) params: {640,480,D3DFMT_X8R8G8B8,1,0,0,1,WND(006C0F30,_thegamewndclass,{0,0,2560,1440}),0,0,D3DFMT_UNKNOWN,0x0,0,0x80000000} flags: 0x44 14072 01:31:10.214 Creating interface m_IDirect3DDevice9Ex::InitDirect3DDevice (0093C9B0) 14072 01:31:10.216 m_IDirectDrawX::CreateSurface2 Primary surface 0x0 dwFlags: 0x21 ddsCaps: 0x2238, 0x0, 513 14072 01:31:10.216 Creating interface m_IDirectDrawSurfaceX::m_IDirectDrawSurfaceX (06F7DFB8) converting interface from v7 to v9 14072 01:31:10.216 Creating interface m_IDirectDrawSurfaceX::m_IDirectDrawSurfaceX (0F3277C0) converting interface from v7 to v9 14072 01:31:10.216 m_IDirectDrawSurfaceX::~m_IDirectDrawSurfaceX (06F7DFB8) deleting interface! 14072 01:31:10.216 m_IDirectDrawSurfaceX::~m_IDirectDrawSurfaceX (0F3277C0) deleting interface! 14072 01:31:10.219 m_IDirectDrawX::CreateD3D9Device Direct3D9 device! 1600x1200 refresh: 0 format: D3DFMT_X8R8G8B8 wnd: WND(006C0F30,_thegamewndclass,{0,0,100,40}) params: {1600,1200,D3DFMT_X8R8G8B8,1,0,0,1,WND(006C0F30,_thegamewndclass,{0,0,100,40}),0,0,D3DFMT_UNKNOWN,0x0,0,0x80000000} flags: 0x44 14072 01:31:10.659 m_IDirectDrawX::CreateSurface2 Primary surface 0x0 dwFlags: 0x21 ddsCaps: 0x2238, 0x0, 513 14072 01:31:10.659 Creating interface m_IDirectDrawSurfaceX::m_IDirectDrawSurfaceX (06F7B9F0) converting interface from v7 to v9 14072 01:31:10.661 m_IDirectDrawSurfaceX::~m_IDirectDrawSurfaceX (06F7B9F0) deleting interface! 14072 01:31:11.497 Quiting DxWrapper 14072 01:31:11.497 DDrawCompat detached successfully 14072 01:31:11.497 Unloading libraries... 14072 01:31:11.497 DxWrapper terminated!

  1. DDrawCompat does some funky stuff with the window/message handler function. The customer launcher i have hooks into the original game windows proc and catches event for key presses. However this does no longer work since the original games window class/window is never registered. Example:

Before:

Hook_RegisterClassA lpszClassName _thegamewindowclass

After:

Hook_RegisterClassA lpszClassName DDrawCompatPresentationWindow Hook_RegisterClassA lpszClassName DDrawCompatMessageWindow

I tried to hook into either DDrawCompatPresentationWindow or DDrawCompatMessageWindow but then the loading does not continue. How can i hook into the RegisterClassA function? The original game window still gets created with CreateWindowExA but that doesnt help me, seems like there are 2 more windows that no do the job for the original games window/message handler.

  1. I tried using ONLY DDrawCompat for the GDI fixes in conjunction with dgvodoo2 as a ddraw wrapper for DX7 - but I don't understand how to achieve this - using RealDllPath=DDraw_DGVodoo.dll and renaming DDraw.dll to DDraw_DGVodoo.dll does not do anything.
elishacloud commented 2 weeks ago

However i tried to use the Dd7to9 option and no matter what setting i try this fails with a game specific error that D3DXCreateContextEx No Z Buffer is available.

The released build has limited support for Z Buffer. The latest dev build has better Z Buffer support: dxwrapper.zip

2. DDrawCompat does some funky stuff with the window/message handler function.

It sounds like DDrawCompat overwrites the message handler with the customer launcher. I did not write DDrawCompat and I don't fully understand it all.

3. I tried using ONLY DDrawCompat for the GDI fixes in conjunction with dgvodoo2 as a ddraw wrapper for DX7 - but I don't understand how to achieve this - using RealDllPath=DDraw_DGVodoo.dll and renaming DDraw.dll to DDraw_DGVodoo.dll does not do anything.

I don't think this will work. dgVoodoo2 only handles the DirectDraw/Direct3D calls. However, DDrawCompat does a lot of stuff at the WDDM driver level that is not seen by dgVoodoo2.

H-K-47 commented 1 week ago

Thanks for your feedback - i will try to contact the DDrawCompat author. Can you clarify what version did you use for your last official release because only using the DLL provided by the other project did not work for me at all - only using it with DXWrapper.

Regarding the latest dev build - this does not even work at all for me because the game does not find a valid 3D device during enumeration.

20968 21:40:25.828 DxWrapper loaded! 20968 21:40:28.009 dd_DirectDrawEnumerateExA 20968 21:40:28.009 d9_Direct3DCreate9 20968 21:40:28.009 Redirecting 'Direct3DCreate9' ... 20968 21:40:28.107 Creating interface m_IDirect3D9Ex::m_IDirect3D9Ex (0CF3F5E8) 20968 21:40:28.107 m_IDirect3D9Ex::LogAdapterNames Adapter: 0 \.\DISPLAY1 NVIDIA GeForce RTX 4080 SUPER 20968 21:40:28.107 dd_DirectDrawCreateEx 20968 21:40:28.107 Direct3D9SetSwapEffectUpgradeShim Calling 'Direct3D9SetSwapEffectUpgradeShim' ... 0 20968 21:40:28.107 Redirecting 'DirectDrawCreate' IID_IDirectDraw7 to --> 'Direct3DCreate9' 20968 21:40:28.107 Creating interface m_IDirectDrawX::m_IDirectDrawX (00AE3F78) converting interface from v7 to v9 20968 21:40:28.108 Redirecting 'Direct3DCreate9' ... 20968 21:40:28.109 Creating interface m_IDirect3D9Ex::m_IDirect3D9Ex (0CF3F618) 20968 21:40:28.109 Creating interface m_IDirect3DX::m_IDirect3DX (04FEC238) converting interface from v7 to v9 20968 21:40:28.109 m_IDirect3DX::EnumDevices7 Error: could not get Cap9 cache! 20968 21:40:28.109 m_IDirect3DX::~m_IDirect3DX (04FEC238) deleting interface! 20968 21:40:28.109 m_IDirectDrawX::~m_IDirectDrawX (00AE3F78) deleting interface! 20968 21:40:28.109 m_IDirect3D9Ex::~m_IDirect3D9Ex (0CF3F618) deleting interface! 20968 21:40:28.109 m_IDirectDrawSurfaceX::CleanupSharedEmulatedMemory Deleting 0 emulated surfaces! 20968 21:40:28.118 m_IDirect3D9Ex::~m_IDirect3D9Ex (0CF3F5E8) deleting interface! 20968 21:40:30.058 Quiting DxWrapper