narzoul / DDrawCompat

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

RealMyst performance downgrade on 0.51 (Windows 7) #274

Closed MiraakThuri closed 2 months ago

MiraakThuri commented 6 months ago

Hey, just upgraded from 0.4.0 to 0.5.1 for RealMyst and noticed massive drawbacks

Performance is pretty bad (i get occasional freezing, when it was perfectly fine before) (and massive stuttering with the debug version but that might be normal for generating the log) Also a bug present since vista (due to the deprecation of directdraw) wich was fixed in 0.4.0 is back (books videos not rendering and showing white screen)

I don't know if it's a W7 specific issue here is my log with debug: DDrawCompat-RealMYST.zip

MiraakThuri commented 6 months ago

Ok so i tried 0.5.1 on my other 2 currently installed ddraw/old dx games (AVP2 and AOE1) and i have perfect performance just as before so my issue is definitly related to RealMyst specifically

PS: I did notice an issue in AOE 1 that was not present in 0.4.0, the cursor on the main menu does not recognize the resolution (in this game i can't put my regular resolution so im using the default DisplayResolution=desktop), my cursor won't be able reach past a certain point on the menu as if the menu was still stuck in 1024x768 even tho it does render in fullscreen visually) i can navigate it with keyboard and once i start a game the issue is gone and my cursor can roam on my entiere screen

narzoul commented 3 months ago

I only have Windows 11, but I can reproduce none of the issues mentioned so far.

Performance is pretty bad (i get occasional freezing, when it was perfectly fine before)

Do you have a save game or some more details how to reproduce this? I just started a new game and have average 144 fps (max refresh rate) with both v0.4.0 and v0.5.1. Didn't notice any stuttering or freezing while moving around either.

(and massive stuttering with the debug version but that might be normal for generating the log)

Of course, this is normal with debug logs enabled.

Also a bug present since vista (due to the deprecation of directdraw) wich was fixed in 0.4.0 is back (books videos not rendering and showing white screen)

The videos are showing up fine here with v0.4.0, v0.5.1 and even natively without DDrawCompat. Maybe because I'm using the GOG release and it's fixed there somehow?

PS: I did notice an issue in AOE 1 that was not present in 0.4.0, the cursor on the main menu does not recognize the resolution (in this game i can't put my regular resolution so im using the default DisplayResolution=desktop), my cursor won't be able reach past a certain point on the menu as if the menu was still stuck in 1024x768 even tho it does render in fullscreen visually) i can navigate it with keyboard and once i start a game the issue is gone and my cursor can roam on my entiere screen

Maybe this is caused by exclusive fullscreen mode. I noticed some similar issue in another game, but I can't reproduce it with Age of Empires 1. Unfortunately, Windows 7 only supports exclusive fullscreen mode. Hopefully, the next release will fix this problem at least, I reworked the surrounding code quite a bit recently.

MiraakThuri commented 3 months ago

Hey, thx for the answer

Do you have a save game or some more details how to reproduce this? I just started a new game and have average 144 fps (max refresh rate) with both v0.4.0 and v0.5.1. Didn't notice any stuttering or freezing while moving around either.

Happens everytime once i am ingame (new game or old, it does not matter)

The videos are showing up fine here with v0.4.0, v0.5.1 and even natively without DDrawCompat. Maybe because I'm using the GOG release and it's fixed there somehow?

I don't know, i am using the steam release, without ddraw compact those videos would not render unless i ran the game with XP compatibility mode (might have been set to default in W10 and up appcompat flags wich cause it to work by default), but with DDC 0.4.0 it was no longer needed and the videos rendered perfectly fine without it

Maybe this is caused by exclusive fullscreen mode. I noticed some similar issue in another game, but I can't reproduce it with Age of Empires 1. Unfortunately, Windows 7 only supports exclusive fullscreen mode. Hopefully, the next release will fix this problem at least, I reworked the surrounding code quite a bit recently.

Yes it's probably related as i didn't got the issue on the other games

Whats weird is that it's for this game only when v0.5.1 work perfectly fine for AVP2 on W7 (and AOE1 too performance wise, beside the screen issue) so it seems to be really RealMyst related wich for some reasons has issues when it run on 0.5.1+W7

narzoul commented 3 months ago

Happens everytime once i am ingame (new game or old, it does not matter)

One blind guess would be that maybe the CpuAffinityRotation setting is causing some stuttering. Try setting it to "off" and see if it changes anything.

If not, then please check if the performance issue was already present in v0.5.0. If yes, then please download the DDrawCompat-v0.5.0-debug-previous-builds.7z archive, which has a separate build for every commit between v0.4.0 and v0.5.0, and try to figure out which was the first build that introduced the issue. If the performance problems started between v0.5.0 and v0.5.1, then I could create a similar build archive for the commits between those.

I don't know, i am using the steam release, without ddraw compact those videos would not render unless i ran the game with XP compatibility mode (might have been set to default in W10 and up appcompat flags wich cause it to work by default), but with DDC 0.4.0 it was no longer needed and the videos rendered perfectly fine without it

That's a bit strange, because this is supposed to be an Indeo codec issue, and v0.4.0 had no fixes for that whatsoever. It was actually v0.5.0 that added the emulation for the needed registry entries.

Anyway, I figured out what was the problem with the emulation. When using RegQueryValueEx, DDrawCompat was returning the emulated values as non-null terminated strings, which is allowed according to the API documentation, but doesn't seem to work on Windows 7. I added a quick fix to always return a null-terminated string, you can try it here: ddraw.zip (diff.txt compared to v0.5.1)

MiraakThuri commented 3 months ago

Just tried your new .dll and it fixed both the videos and the freezing/stuttering issue (i tried setting CpuAffinityRotation=off with the standard .dll before but it made no difference) The RealMyst engine is known to be quite flaky, maybe that non working function on W7 caused it to behave incorrectly ?

I still did try out your "mid version" files to see if i could find when it started (started with 0.4.0-5, then 0.4.0-7 then 0.4.0-8... up to the final 0.4.0-9) all of them had both working video and no freezing Then i tried the final 0.5.0 and both the video and performance issue were there at the same time, so it indeed seems to be the issue

narzoul commented 3 months ago

0.4.0-9 was not the last version before 0.5.0. The last version is v0.4.0-86-g10d1a3a9. Maybe your file browser doesn't show them in proper numeric order. The codec issue should have been introduced in v0.4.0-65-g3b8ff67c.

I have no idea why it would fix the stuttering, but it's good enough for me that it does. Then no additional fixes are needed. Thanks!

MiraakThuri commented 3 months ago

Ah ye, it's because i enabled "alphabetical" numeric sorting and i supposed 0.9 was 0.90

but ye thats indeed the issue, v0.4.0-64 work just fine, v0.4.0-65 introduce both issues

narzoul commented 2 months ago

Fixed in v0.5.2.