narzoul / DDrawCompat

DirectDraw and Direct3D 1-7 compatibility, performance and visual enhancements for Windows Vista, 7, 8, 10 and 11
BSD Zero Clause License
939 stars 70 forks source link

Help set up The Legend Of Dragon's Son (龍狼傳破凰之路) #226

Closed ghotik closed 1 year ago

ghotik commented 1 year ago

Hi. Let me say that I wouldn't bother you with an alien Chinese game unless I believe it shows a somehow original and interesting problem. I also add that I won't blame you if you find this request quite out of your targets and will forget it. Now I can follow (maybe you won't ...).

All stuff (including game files) is linked to this post on DxWnd forum: https://sourceforge.net/p/dxwnd/discussion/general/thread/f2f17c810e/#bf69 In short, the game seems to use a 2D engine based on ddraw up to when it enters into a 3D version of a typical RPG battle, where it switches to d3d8. When this happens, the game seems to use two differend windows/surfaces and it is supposed to bring the 3D battle on focus, but instead the game keeps showing the 2D scene while mouse clicks and sounds are related to the invisible battle scene. Also, with some luck and tabbing to switch the focus in and out, sometimes it is even possible to bring the 3D scene on top (we captured a few nice screenshots this way), but this sequence is not reliable and the effect doesn't last long.

The question is: what could be wrong in this game handling, possibly related to a change of Windows version (or culture, though I believe that the game was tested also on a Chinese locale) and how coult that be fixed?

I hope I tickled your curiosity just a little. Thanks anyway and regards gho

update: to be honest, I have to add that the game had a strong protection that was only recently "unprotected", so there is a possibility that the problem was introduced by a bad crack and could not be fixed by our wrappers.

ghotik commented 1 year ago

After quite a lot of tests in different conditions we got the game running on Win7 and older OSs, so this somehow exculpates the cracked exe. The game (or the crack) seems to have a fixable bug since if calls IDirectD3D8::CreateDevice with a DeviceType argument 0 that is invalid, but fixing this error and running it on a 16 bit desktop we managed to make it working both on WinXP and Win7.

Instead, quite curiously, on Vista+ and on my Windows 11 in particular you can get it running with desktop color virtualization, either through DxWnd or the reduced color shim, but the game doesn't manage the switch between the 2D story mode and the 3D battle mode and becomes unplayable. The whole confused story is still on the dedicated thread in DxWnd forum on SourceForge, but I add this post to tell that after all the game really seems to hide some interesting mystery to be solved!

update: A recent discovery was that in the 3D battle scenes the game uses a combination of DirectDrawSurface7 and Direct3D8Device. We were wondering if this could be the source of the problems.

update: It seems that the DirectDrawSurface7 primary surface keeps refreshing or locking the screen while the 3D Direct3D8Device is running behind. This doesn't happen on older OS, it seems the cause of the main problem ...

ghotik commented 1 year ago

A question for you (hoping you still read sometimes these posts ...). After much testing and log captures, I got the impression that this damned game works like this: the game logical cursor is drawn directly on the ddraw7 primary surface in a sequence of Lock(readonly mode) - Unlock() - Lock(writeonly mode) - Unlock. This is weird but possible. Then the combat screen is drawn with D3D8, but there is no trace of cursors in the logs, instead the ddraw7 activity still goes on. So this is the question: Is it possible that the ddwaw7 primary surface is overwritten by a D3D8 Present operation? If that happens, it could be possible that the game draws the 3D frames in D3D8, then ddraw7 gets in the primary surface the presented image and overwrites it with the 2D logical cursor. If so, I think this game is a case of unique architecture!

ghotik commented 1 year ago

Never mind, it seems that the case is now closed, I found a fix for the problem.