[dd7to9] [d3d9ex] Shogo and Blood 2 doesn't work with Direct3D 9Ex
Shogo and Blood 2 doesn't work with D3d9to9Ex = 1, both games crashes before reaching the main menu, having only dd7to9 = 1 works fine. Here's the attatched log files:
Still nothing, the log files still reports errors:
Try enabling DdrawEmulateSurface. That can help in some cases with locking surfaces when using Driect3DEx.
DdrawEmulateSurface = 1 did nothing unfortunatelly, same result as before
The issue is that it is crashing inside ntdll after dxwrapper calls the d3d9 function CreateOffscreenPlainSurface(). This seems to be a bug in either Direct3D9 or in the OS. I found two fixes for this:
- Create the surface in video memory, even though the game asked for system memory surface.
- Create the surface with at least 64 pixels wide, even though the game is asking for a 35 pixel wide surface.
~Option 1 may have other side effects and is not a solution I want to use. So instead, I updated the DdrawEnableByteAlignment option to set width to a minimum of 64 pixels.~
~Enabling DdrawEnableByteAlignment with this new build should fix the issue: dxwrapper.zip~
The last fix caused some issues. I decided to detect this specific case and then use video memory for this case: dxwrapper.zip
I was about to report that the previous build was causing distortion issues with some 2D elements haha. This newer build seems to be working so far, I'll do a playthrough on both games and see how it goes.
One minor thing I noticed while playing both, there's an issue where the damage indicator isn't displayed correctly, the screen should be red when taking damage, in blood 2 only half of the screen is red, while in Shogo it's not displayed at all. But this is an issue in dd7to9 and not Direct3D 9Ex itself.
It looks like this is a bug in the game. The game is sending an invalid rhw (transformed vertices) value. It is a float value and the game sends in a NAN (not a number) value. DX7 and older is more forgiving for this. However, DX9 drops the vertix if it is invalid.
I update the DdrawClampVertexZDepth option 2 to handle this case.
Here is an updated build that should fix this issue: dxwrapper.zip
Whats the advantage of running the game in d3d9ex vs plain d3d9 anyways?
Direct3D9Ex has better alt+tab support and can, in some cases, offer better performance.