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

Dd7to9 has switched textures #180

Closed dkollmann closed 1 year ago

dkollmann commented 1 year ago

Hello Elisha, I am working on getting Black & White run in D3D9 mode. I had to make some specific fixes and so far I have a good start.

image

However, I have the issue that some textures seem to be switched. I wanted to ask if yoiu have a suggestion why this happens.

dxwrapper-runblack.log

I added the functionality to decode DirectX textures through CopySurface.

It would be great if you had a few minutes to look at some of the fixes I did. Some are really more hotfixes, but they did the trick for now. https://github.com/elishacloud/dxwrapper/compare/master...dkollmann:dxwrapper:black_n_white

Thank you, Daniel

elishacloud commented 1 year ago

Hello Daniel,

First of all, it is great to see this code working on a 3D game. This is the furthest I have seen it on any 3D game.

I added an updated version of the code you modified into the project here, I hope you don't mind. This should have everything you added except the "hotfix for rtx remix" and the "config setting to auto create a stencil and depth buffer".

I'm not completely sure why the wrong texture would be shown here. The texture code has not really been fully implemented or tested yet. However, maybe I can point you in the right direction.

Textures are created in QueryInterface() if the DirectDrawSurface. Once it is created I attach it to that surface. There could be a bug with this code.

There are also two different SetTexture() functions. One SetTexture() for IDirect3DDevice3 and older and one SetTexture() for IDirect3DDevice7. This game is certainly using the one for IDirect3DDevice7. There could be an issue with this code.

I don't have the Black & White game, but if you know where I can get a copy of it I can look into this more.

If you figure anything out here please let me know. I'm happy for you to add any pull requests as well.

Thanks, Elisha

mirh commented 1 year ago

Some ideas here maybe https://github.com/openblack/openblack

dkollmann commented 1 year ago

Hello Elisha, thank you, I was hoping you could take a look.

To get the game, it is pretty easy to find if you search for a download. You basically have to follow this guide to install the latest community version: https://forum.bwgame.net/threads/running-black-white-on-windows-10.7916/

Configure the game using Setup.exe and enable the window mode. You then have to set DdrawOverrideWidth/Height to the same settings.

But you will need to set DdrawAutoStencilFormat to D16, otherwise there is no depth rendering. So you will need your own implementation, if mine is too hacky.

Thank you again, I will merge your changes back into my version.

@mirh Thank you, I was no aware of it. This might be useful in the future.

elishacloud commented 1 year ago

Configure the game using Setup.exe and enable the window mode. You then have to set DdrawOverrideWidth/Height to the same settings.

I just put a fix in that eliminates this issue. You no longer need to set DdrawOverrideWidth/Height with this fix: 9dfaede83e7941782fd91830a3fe60e5ea4cef97

It also should get the proper window handle now because it doesn't attempt to create the d3d9 device until after SetCooperativeLevel is called.

dkollmann commented 1 year ago

The textures seem to be correctly assigned now.