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

merged ddraw7 and d3d8 primary buffers #206

Closed ghotik closed 1 year ago

ghotik commented 1 year ago

Hi! Do you remember me? I'm ghotik, the author of DxWnd. We had several exchanges of opinions and source code in the past. Now I got a Chinese game (The Legend Of Dragon's Son - 龍狼傳破凰之路) that behaves in a curious way. The whole long story is here https://sourceforge.net/p/dxwnd/discussion/general/thread/f2f17c810e/#bf69 but to cut that short it just seems that during some troublesome 3D scenes the game does this: renders the frame with D3D8, then it assumes that the D3D8 front buffer is coincident with the DDraw7 front buffer and uses DDraw7 to lock-read-update-unlock the front buffer to add a spinning cursor to the scene. This assumption seems working on old systems / video cards, but on a modern Win10+ system the two front buffers seem no longer coincident, so the final result is a wrong scene displayed on screen. I am seeking for some c++ code example to change the IDirect3DDevice8::Present wrapper and copy the whole surface to a ddraw primary surface. Do you have any advice?

ghotik commented 1 year ago

Never mind, I got a solution by locking the d3ddevice backbuffer with LockRect, the primary ddraw surface with Lock and then looping memcpy for each scanline taking in account for the different pitch values of the two surfaces. It seems to be working well enough. I think I did this also recycling some code borrowed from your sources, so thank you anyway.