Closed tomsons26 closed 2 months ago
Same request as in your other issue, please share debug logs. I can't reproduce this on my end. If you can, find out which release introduced the issue.
0.5.0 didn't work at all, game just resulted in a lockup and black screen was then informed that there's a fix for iGPUs in 0.5.1. Seems no dice on the log, it grows to over 1GB too quick, by the time i make it ingame it's over 1GB
0.4.0 works but tabing makes ui elements disappear after tabbing Doesn't hang up however, game remains working after tabbing back and clicking some menu option makes it redraw properly
Tried AltTabFix, didn't make any difference
Huh, over 1 GB doesn't sound right, I only got 20 MB by getting to the menu and just alt-tabbing there, then shutting it down from Task Manager. Are you playing with some mods or something? Or did you actually start a game from the menu? I thought you already have alt-tab issues in the menu itself, so you wouldn't have to go that far.
I know about the menu button issue after alt-tabbing, it's still there with v0.5.1. I always thought it's just a bug with the game and it doesn't redraw properly after alt-tabbing, but I might take another look when I have some time.
Can you try getting the logs from Tiberian Sun instead then? Using something like FpsLimiter=msgloop(30) should significantly reduce the log size, especially if you need to enter a game instead of just alt-tabbing from the menu. You can also use 7-zip to compress it to something much smaller.
This is awkward, the games work fine today(besides ui disappearing in RA2-YR).. Recover all 3 recover after alt tab.. Not sure on the UI elements, TS doesn't seem to do this so only manifests in RA2-YR, menu in those two are using surfaces, TS draws its menus to DC context instead
I know about the menu button issue after alt-tabbing, it's still there with v0.5.1. I always thought it's just a bug with the game and it doesn't redraw properly after alt-tabbing, but I might take another look when I have some time.
@narzoul I have tested this on a physical Pentium III machine running Win98. The buttons don't disappear after alt-tab.
I finally got somewhere with the invisible menu buttons after alt-tabbing in RA2, but I don't fully understand why it works this way.
The game has a primary surface, and two additional surfaces of the same size: one in video memory, and one in system memory. The video memory surface is rarely used. Most rendering seems to be done first in the system memory surface, including the buttons, and then copied over to the primary surface. Most of the rendering and copying is done via Lock/Unlock.
After alt-tabbing back to the game, everything is actually rendered correctly in the system memory surface, including the buttons. But afterwards, the game also renders the main menu background in the video memory surface, and then copies it to the primary surface via Blt. Prior to this, the correct image was already copied from the system memory surface to the primary surface via Lock/Unlock.
This is where the rendered buttons disappear with DDrawCompat, as it gets overwritten by the background image from the video memory surface. Afterwards, the game only seems to copy those parts of the (still correct) system memory surface to the primary surface which are changing, e.g. the big constantly changing radar image, or buttons that are clicked.
Interestingly, the Blt does not overwrite the locked image of the primary surface on Win 7 and XP VMs. So even if it gets displayed for a split second (to be verified), the next time the primary is locked, its last unlocked image is restored, so the buttons reappear.
At the moment, I'm not sure if this is just some weirdness in the VM drivers, or this is how DirectDraw is expected to work. Can anyone do some tests on a real Win XP system? Prerequisite is that RA2 must be working with proper alt-tabbing without any ddraw wrappers.
Nevermind. It turns out the reason the Blt does nothing is because there is a clipper attached, which clips off the whole Blt. So the problem is most likely in DDrawCompat's clipper calculations. I guess it doesn't consider WS_CLIPCHILDREN child windows or some such.
Found it. The clipper calculations were actually correct, the problem was that ddraw doesn't accept a clip list with 0 rectangles in it. I had to add a dummy empty rectangle in this case. Now the clipping is correct even after alt-tabbing.
Tested it in RA2 and YR, it works!
Fixed in v0.5.2.
Possibly a iGPU specific issue?