Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Red Alert 2: Yuri's Revenge rendering freezes (sometimes) #131

Closed
deftdawg opened this issue Dec 9, 2021 · 13 comments
Closed

Red Alert 2: Yuri's Revenge rendering freezes (sometimes) #131

deftdawg opened this issue Dec 9, 2021 · 13 comments

Comments

@deftdawg
Copy link

deftdawg commented Dec 9, 2021

I believe this is the same issue as recorded in ts-draw here: CnCNet/ts-ddraw/issues/15

The symptoms are after some period of playing the game no longer renders to the screen, though it is definitely still running because you can hear audio and you can use hotkeys to select units and they will acknowledge.

Also it's possible to take a screenshot that the game saves in PCX format and that screenshot will show the current game state (which is newer that what you can see on your monitor)

Alt+Enter to switch between window and full mode still works and doing so will see a couple of frames render (like 1/2 a sec) before the monitor is frozen again. I'm guessing this is because alt+enter might be forcing a repaint as the screen res changes.

My system where this happens somewhat frequently is WS11WineCX6420.04 on OSX 11.6 with 4.4.5.0.

On the advice of #125, I tried it a couple of times with 1.3.9.0 on the system; with very limited testing I was not able to reproduce (yet), I let one game run for over 6 hours.

Next step is to try with the mini-logs debug version, to see if I can capture some logs.

@deftdawg
Copy link
Author

deftdawg commented Dec 9, 2021

It happened again around 0:49 in the log (attached)

cnc-ddraw.log

Doesn't look like much of interest, I did notice that it was 30 FPS on the screen when it froze, it's normally over 50 FPS.

The only other thing I can think of that might be of interest is I normally play in 1600x900 resolution, since that seems to look the best on my display.

@deftdawg
Copy link
Author

With full debug build, I played 1h 22m game the log file was 17GB and it didn't crash.

~200 MB / min of logs is a lot, I tried to set-up logrotate with it, but unfortunately it's unable to rotate the log.

  • If I rotate, then the cnc-ddraw.log does not get recreated and there's no further logging
  • if I copytruncate the log using logrotate, then the log does go to 0 bytes for a second, however as soon as you resume play it goes back to its previous size but with everything before that point in time in the log replaced with null characters.

It would be very helpful if there was a way to have the cnc-ddraw.log file split itself or if there was a hotkey to tell it to close and reopen the log file handle that I could use to manage it from getting too large.

At least, one good thing is that the log doesn't seem to grow if you hit ESC and sit at the settings menu without moving your mouse (probably because there's no repainting going on).

@deftdawg
Copy link
Author

deftdawg commented Dec 15, 2021

I managed to crash once with the full debug build, though this crash had music, but I could not get units to respond to hotkeys...

Unfortunately, the log was 17GB, even zipped it's 238MB, but I can't attach it...

The log is 271 million (271702825) lines long, so I doubt you'd read it anyway.

To try to make some sense of it I ran the follow on it:

gsed -E 's/.{0,18}//;s/[(=].*//' cnc-ddraw.log | sort | uniq -c | sort -nr | tee -a stats.txt

Here is the breakdown of message types and their occurance counts

Line Count Line Message
73469556 <- IDirectDrawSurface__IsLost
73469556 -> IDirectDrawSurface__IsLost
23353328 <- IDirectDrawSurface__Lock
23353328 -> IDirectDrawSurface__Lock
23353328 DDLOCK_WAIT
23353309 <- IDirectDrawSurface__Unlock
23353309 -> IDirectDrawSurface__Unlock
1352529 <- IDirectDrawSurface__GetBltStatus
1352529 -> IDirectDrawSurface__GetBltStatus
1322937 <- IDirectDrawSurface__Blt
1322937 -> IDirectDrawSurface__Blt
1322937 DDBLT_WAIT
1322914 DDBLT_COLORFILL
18 <- IDirectDraw__CreateSurface
18 <- IDirectDrawSurface__GetSurfaceDesc
18 <- IDirectDrawSurface__AddRef
18 -> IDirectDraw__CreateSurface
18 -> IDirectDrawSurface__GetSurfaceDesc
18 -> IDirectDrawSurface__AddRef
18 surface
18 DDSD_CAPS
16 DDSD_WIDTH
16 DDSD_HEIGHT
16 DDSD_ALL
12 Released
11 <- IDirectDrawSurface__Release
11 -> IDirectDrawSurface__Release
11 DDSCAPS_SYSTEMMEMORY
4 <- IDirectDrawClipper__AddRef
4 -> IDirectDrawClipper__AddRef
3 <- IDirectDraw__GetCaps
3 <- IDirectDrawSurface__SetClipper
3 <- IDirectDrawSurface__GetPixelFormat
3 -> IDirectDraw__GetCaps
3 -> IDirectDrawSurface__SetClipper
3 -> IDirectDrawSurface__GetPixelFormat
2 NOT_IMPLEMENTED <- IDirectDrawClipper__SetHWnd
2 NOT_IMPLEMENTED -> IDirectDrawClipper__SetHWnd
2 <- IDirectDraw__SetDisplayMode
2 <- IDirectDraw__CreateClipper
2 <- IDirectDrawClipper__Release
2 -> IDirectDraw__SetDisplayMode
2 -> IDirectDraw__CreateClipper
2 -> IDirectDrawClipper__Release
2 clipper
2 DDSCAPS_PRIMARYSURFACE
1 cnc-ddraw
1 Wine version
1 Module C:\windows\system32\ws2_32.dll
1 Module C:\windows\system32\wow64cpu.dll
1 Module C:\windows\system32\winemac.drv
1 Module C:\windows\system32\version.dll
1 Module C:\windows\system32\usp10.dll
1 Module C:\windows\system32\ucrtbase.dll
1 Module C:\windows\system32\shlwapi.dll
1 Module C:\windows\system32\shcore.dll
1 Module C:\windows\system32\setupapi.dll
1 Module C:\windows\system32\rpcrt4.dll
1 Module C:\windows\system32\opengl32.dll
1 Module C:\windows\system32\ole32.dll
1 Module C:\windows\system32\ntdll.dll
1 Module C:\windows\system32\msvcrt.dll
1 Module C:\windows\system32\kernelbase.dll
1 Module C:\windows\system32\kernel32.dll
1 Module C:\windows\system32\iphlpapi.dll
1 Module C:\windows\system32\imm32.dll
1 Module C:\windows\system32\gdi32.dll
1 Module C:\windows\system32\dbghelp.dll
1 Module C:\windows\system32\api-ms-win-core-synch-l1-2-0.dll
1 Module C:\windows\system32\api-ms-win-core-localization-l1-2-1.dll
1 Module C:\windows\system32\api-ms-win-core-fibers-l1-1-1.dll
1 Module C:\windows\system32\advapi32.dll
1 Module C:\windows\system32\WINMM.dll
1 Module C:\windows\system32\USER32.dll
1 Module C:\windows\system32\SHELL32.dll
1 Module C:\windows\system32\OLEAUT32.dll
1 Module C:\windows\system32\DSOUND.dll
1 Module C:\windows\system32\COMCTL32.dll
1 Module C:\Games\Red Alert 2 - Yuri's Revenge\gamemd.exe
1 Module C:\Games\Red Alert 2 - Yuri's Revenge\blowfish.dll
1 Module C:\Games\Red Alert 2 - Yuri's Revenge\binkw32.dll
1 Module C:\Games\Red Alert 2 - Yuri's Revenge\WSOCK32.dll
1 Microsoft Windows 7
1 <- IDirectDraw__SetCooperativeLevel
1 <- IDirectDraw__AddRef
1 <- DirectDrawCreate
1 -> IDirectDraw__SetCooperativeLevel
1 -> IDirectDraw__AddRef
1 -> DirectDrawCreate
1 Using auto renderer
1 GUID

@FunkyFr3sh
Copy link
Owner

First log looks good, render thread seems to be running still and no opengl errors in it either. So I guess the game doesn't trigger the redraw anymore, which should be done via the IDirectDrawSurface__Blt function in YR.

Can you maybe upload just the end of the 17gb log? Last 1mb would probably be enough

@deftdawg
Copy link
Author

deftdawg commented Dec 16, 2021

It's very hard for me to get the debug build to crash outright, I've only done it once and not like it usually crashes with non-debug or the debug-lite.

What I have noticed is this debug build will seemly pause until I click with my mouse sometimes, it's pretty strange... The music will keep going and everything will be stopped, then I'll click and everything moves again. This crash (17GB log) that I have seems like that without the click unpausing.

Here's the last 1mb...
cnc-ddraw-1mb.log

Don't think you'll find it very interesting, it is basically this (below) repeated over and over (DDLOCK_WAIT x 1689 times):

[61] 00:02:56.581      DDLOCK_WAIT
[61] 00:02:56.581 <- IDirectDrawSurface__Lock
[61] 00:02:56.581 -> IDirectDrawSurface__IsLost(This=05C68E88)
[61] 00:02:56.581 <- IDirectDrawSurface__IsLost
[61] 00:02:56.581 -> IDirectDrawSurface__Unlock(This=05C68E88, lpRect=02E00000)
[61] 00:02:56.581 <- IDirectDrawSurface__Unlock
[61] 00:02:56.581 -> IDirectDrawSurface__IsLost(This=05C68E88)
[61] 00:02:56.581 <- IDirectDrawSurface__IsLost
[61] 00:02:56.581 -> IDirectDrawSurface__Lock(This=05C68E88, lpDestRect=00000000, lpDDSurfaceDesc=0201FBAC, dwFlags=00000001, hEvent=00000000)
[61] 00:02:56.581      DDLOCK_WAIT
[61] 00:02:56.582 <- IDirectDrawSurface__Lock
[61] 00:02:56.582 -> IDirectDrawSurface__IsLost(This=05C68E88)
[61] 00:02:56.582 <- IDirectDrawSurface__IsLost
[61] 00:02:56.582 -> IDirectDrawSurface__Unlock(This=05C68E88, lpRect=02E00000)
[61] 00:02:56.582 <- IDirectDrawSurface__Unlock
[61] 00:02:56.582 -> IDirectDrawSurface__IsLost(This=05C68E88)
[61] 00:02:56.582 <- IDirectDrawSurface__IsLost
[61] 00:02:56.582 -> IDirectDrawSurface__Lock(This=05C68E88, lpDestRect=00000000, lpDDSurfaceDesc=0201FBE0, dwFlags=00000001, hEvent=00000000)
[61] 00:02:56.582      DDLOCK_WAIT

I'll have to see if I can find a better way to capture the original crashes; maybe I can figure out a way to run it under gdb or valgrind or something...

@FunkyFr3sh
Copy link
Owner

Thanks! I found the problem:

439f71e

YR/TS want all surfaces to be in the video memory, otherwise they will change the way the renderer behaves and just do lock/unlock on the primary surface rather than blt. That's apparently unstable (the games are known to have all kinds of issues..). It also explains the bug @Mitradis reported here #125

Will have to think about a solution... I can't just revert the change because it would break some other games then

@deftdawg
Copy link
Author

Wow, that's really great to hear!

It makes sense that TS and RA2 would share the same issues, RA2 was released 1 year after TS (there weren't any other games released between them in the series). They likely share a lot of the same code.

@FunkyFr3sh
Copy link
Owner

Fixed! Here is the latest build:

cnc-ddraw.zip

@deftdawg
Copy link
Author

deftdawg commented Dec 17, 2021

I'm sad to report this new build crashed the same way the previous full debug build crashed, everything stops except music and in my case a water flowing sound effect, the song finished and then just the water flowing sound effect continued to play, no response from unit hot keys. Alt+Enter didn't work. Can't screenshot with Shift+S... 😭

@Mitradis
Copy link

Mitradis commented Dec 17, 2021

Fixed! Here is the latest build:

cnc-ddraw.zip

wow! on this version i have normal scroll camera speed and no more game freez. In clear TS.

@FunkyFr3sh
Copy link
Owner

FunkyFr3sh commented Dec 18, 2021

I'm sad to report this new build crashed the same way the previous full debug build crashed, everything stops except music and in my case a water flowing sound effect, the song finished and then just the water flowing sound effect continued to play, no response from unit hot keys. Alt+Enter didn't work. Can't screenshot with Shift+S... sob

I can reopen the issue, but not sure if I can fix it

Fixed! Here is the latest build:
cnc-ddraw.zip

wow! on this version i have normal scroll camera speed and no more game freez. In clear TS.

nice!

@FunkyFr3sh FunkyFr3sh reopened this Dec 18, 2021
@deftdawg
Copy link
Author

I'm sad to report this new build crashed the same way the previous full debug build crashed, everything stops except music and in my case a water flowing sound effect, the song finished and then just the water flowing sound effect continued to play, no response from unit hot keys. Alt+Enter didn't work. Can't screenshot with Shift+S... sob

I can reopen the issue, but not sure if I can fix it

No worries, I appreciate your effort; I believe I can use 1.3.9.0 to play YR stably... I'll play on that for the holidays and maybe see if I can figure out how to try to debug it in the new year.

@FunkyFr3sh FunkyFr3sh closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2023
@FunkyFr3sh
Copy link
Owner

Can't reproduce, no one else seems to have the issue either, so I'm closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants