protonscr

[d3d9] GTA IV will crash/freeze/keep loading indefinitely at first loading screen if you Alt-Tab before

dxvkclosed help wantedd3d9
doitsujin/dxvk#2119 · opened 2021-06-22 by sn-o-w · updated 2022-11-23 · 50 comments · github
1 matching comments, n / p to jump
Ssn-o-w 2021-06-22 github

GTA IV runs smoothly with DXVK, but sometimes it will crash/freeze after going on a mission, during the loading screen. Usually loading screens take a few seconds, like 3-5 seconds, but when the game decides to crash/freeze, it will stay longer, like ~10 seconds. It's easy to figure out when the game decides to stop given that it takes way more time than regular loading screen.

Software information

  • Game: Grand Theft Auto IV: The Complete Edition v1.2.0.43
  • Graphics API: DirectX 9
  • Architecture: x86

System information

Apitrace file(s)

Unfortunately I cannot generate apitrace. It says MSVCP140D.dll, VCRUNTIME140D.dll and UCRTBASED.DLL are not found. And yes, I've reinstalled Visual C++ Redistributable for Visual Studio 2015, both x86 and x64 versions. Error keeps popping up. I followed the instructions posted on Wiki, don't know what else I can do to obtain an apitrace file.

I've managed to record an apitrace eventually: https://drive.google.com/file/d/1Dqv-dsd_HJYvgN3ndB6-uDlgkXlGvx4Y/view

Log files

GTAIV_d3d9.log

KK0bin maintainer 2021-06-22 github

The loading screen hangs are a known issue. It also only happens on Windows and I have no idea what causes it. The game randomly decides to never stop loading.

Don't expect this to be fixed any time soon.

Ssn-o-w 2021-07-01 github

The loading screen hangs are a known issue. It also only happens on Windows and I have no idea what causes it. The game randomly decides to never stop loading.

Don't expect this to be fixed any time soon.

It's pretty weird issue appears only on Windows, but not on Linux. 😕
I've managed to record an apitrace eventually, despite I cannot reproduce the issue with apitrace, only with DXVK.
In above apitrace file it used to crash/freeze during the last loading screen.

KK0bin maintainer 2021-07-01 github

It also happens when you use WineD3D on Windows.

Ssn-o-w 2021-07-01 github

It also happens when you use WineD3D on Windows.

I just tried WinD3D and you are right. I encountered a crash at the first try with WineD3D, lol.
Anyways, there's a huge difference between DXVK and WineD3D. With WineD3D I get inconsistent FPS like 5-10 to 40-50 FPS, textures rendering very chaotic, game feels very choppy... Tbh I'm not sure if it's better or worse than the original renderer of the game.

KK0bin maintainer 2021-07-01 github

When I tried WineD3D it didnt crash but it got stuck on the loading screen in the exact same way as DXVK.

KKuraiShidosha 2021-07-11 github

I'm not sure if this will help but GTA IV used to have a problem with loading being tied to v-sync and certain framerate limiters. For instance, if you forced v-sync on in say the Nvidia driver, then load times would be substantially longer. Eventually Rockstar patched this problem out so now with Complete Edition you get fast loads no matter what you set in the driver. It seems adding DXVK undoes whatever fix this targeted.

KK0bin maintainer 2021-07-24 github

I did some more digging. The problem can be reproduced on Linux and it's caused by the Rockstar Games Overlay which gets stuck waiting for a window message that never arrives. No idea how to fix this though.

Ssn-o-w 2021-07-24 github

I did some more digging. The problem can be reproduced on Linux and it's caused by the Rockstar Games Overlay which gets stuck waiting for a window message that never arrives. No idea how to fix this though.

Are you sure about that? Because I tried both the Steam version and "modified" version that uses Goldberg Socialclub Emu and the issue appears in both versions.

I contacted the creator of Goldberg Socialclub Emu and he said that "when running the emu there should be no rockstar overlay so it can't cause the crash". Perhaps there is another cause whether it's the original game or not.

And I wonder what makes the original renderer so different that it doesn't freeze/crash/keep loading indefinitely the game during loading screens.

KKuraiShidosha 2021-07-24 github

I'm sad to say I'm also certain it isn't the Rockstar Overlay because the version I run the game on, v1.0.4.0, also experiences this problem and this version of the game never knew what the Rockstar Overlay even was. It came out in like 2008/2009 and the Rockstar Overlay wasn't added to the game until 2018 or thereabouts.

I'm confident the issue is related to framerate and vertical sync somehow. It's existed in the game's own D3D9 version since launch, and only got patched out when Rockstar updated it a decade later. For now if I want to avoid long load times with DXVK, I simply turn off all framerate limiters and v-sync, then toggle my FPS limiter back on once the game loads up. But it can be annoying as any time a cutscene loads or you go from an interior like an apartment to outside and you hit a black loading screen, you must toggle the fps limiter off to break through otherwise it can take minutes to load or even outright crash.

KK0bin maintainer 2021-07-24 github

I'm not sure at all.

I'm confident the issue is related to framerate and vertical sync somehow.

I don't use a frame limiter or vsync and can reproduce the issue.

KKuraiShidosha 2021-07-24 github

What graphics card are you running? IIRC the old issue was tied to Nvidia cards. Wonder if you have AMD/Intel.

KK0bin maintainer 2021-07-24 github

GTX 1070

I've checked again, and its indeed probably unrelated to the Rockstar launcher.

Ssn-o-w 2021-07-24 github

@doitsujin @Joshua-Ashton Do you have any ideas?! 🤔

Ssn-o-w 2021-07-30 github

I just realized something.

If I Alt-Tab while playing GTA IV, afterwards the game will always crash/freeze/keep indefinitely loading at the first loading screen.

Which makes me think that DXVK does something wrong when you Alt-Tab out of the game and/or when you Alt-Tab back into the game. Or maybe the game expects something that never happens after Alt-Tab?!

Can you check what happens when you Alt-Tab out of the game and Alt-Tab back into the game? Something happens or it doesn't happen at that point which could cause subsequent problems at least in GTA IV.

As long as you don't Alt-Tab out of the game, most likely loading screens will be fine.

KK0bin maintainer 2021-07-30 github

Which makes me think that DXVK does something wrong when you Alt-Tab out of the game and/or when you Alt-Tab back into the game. Or maybe the game expects something that never happens after Alt-Tab?!

Yeah, I've wasted hours trying to looking into this. I still have no idea what we're doing wrong. So I cannot fix this unless someone else figures it out.

Ssn-o-w 2021-08-06 github

What is interesting is when the game will crash/freeze, especially when I click while in the indefinite loading screen, is that I will get a... "snapshot" of the game state while it was alt-tabbed. Just have a look:

gta-iv

This is an image I see, exactly the state while the game was alt-tabbed, together with "Grand Theft Auto IV is not responding". And I'm 100% sure this "snapshot" is not before the loading screen.

@DaRkL3AD3R I don't really believe it has something to do with framerate. I tried with vsync on and off, tried to limit the game to 60 fps, but no luck. Most likely something is wrong or game expects something when/after you press Alt-Tab and will affect game at first loading screen leading to crash/freeze/keep indefinitely loading.

KK0bin maintainer 2021-08-06 github

If someone finds out what the hell we're doing wrong, I'd gladly fix it. As it is, we simply have no idea what causes it.

Ssn-o-w 2021-08-10 github

I found another weird thing with DXVK. Perhaps something wrong with window handling?!

Have a look at the following video: https://youtu.be/7M6NkCsw8e8

Watch carefully the cursor, after I double click GTAIV.exe and I make some mouse clicks (those red circles in video), the game will start but there's a game specific cursor in the top left corner.

After I click once in-game, Windows cursor will disappear and there will be a very fast black screen flicker and I will be able to click in-game with that game specific cursor. Same fast black screen flicker appears when I Alt-Tab back into the game!

It's weird OBS Studio didn't capture anything after I clicked once while in-game, but it captured afterwards the moment when I got the dialog to exit the game.

KKuraiShidosha 2021-08-10 github

What you're describing and looking at it simply what happens when game isn't in focus. It happens even with regular D3D under the right conditions. The thing is you won't typically see it in GTA IV because unlike Vulkan, D3D9 really doesn't like switching to borderless windowed mode when the user switches focus away from the game so it completely collapses and minimizes to the taskbar. Vulkan however can handle this much more gracefully and keep the fullscreen window open but with focus lost the game specific cursor isn't interacting with your current mouse input. Once you click back into the game, focus is switched and it can go back to functioning normally.

KK0bin maintainer 2021-08-10 github

Vulkan however can handle this much more gracefully and keep the fullscreen window open

The minimizing is something the D3D runtime does. We simply don't implement that.

Ssn-o-w 2021-08-10 github

What you're describing and looking at it simply what happens when game isn't in focus. It happens even with regular D3D under the right conditions. The thing is you won't typically see it in GTA IV because unlike Vulkan, D3D9 really doesn't like switching to borderless windowed mode when the user switches focus away from the game so it completely collapses and minimizes to the taskbar. Vulkan however can handle this much more gracefully and keep the fullscreen window open but with focus lost the game specific cursor isn't interacting with your current mouse input. Once you click back into the game, focus is switched and it can go back to functioning normally.

Oh, I didn't know that. Interesting. What are the conditions for regular D3D?

I ask this because I just re-tested with the original D3D renderer. Exactly the same conditions, same steps as I described earlier. The game starts normally and I will get right away the game specific cursor, being able to interact with the game without having to manually click once while in-game.

Also, it seems like the black screen flicker appears with the original D3D renderer too when I Alt-Tab back into the game, but it takes way longer to disappear (few seconds compared to a fraction of second).

Ssn-o-w 2021-08-11 github

What you're describing and looking at it simply what happens when game isn't in focus. It happens even with regular D3D under the right conditions. The thing is you won't typically see it in GTA IV because unlike Vulkan, D3D9 really doesn't like switching to borderless windowed mode when the user switches focus away from the game so it completely collapses and minimizes to the taskbar. Vulkan however can handle this much more gracefully and keep the fullscreen window open but with focus lost the game specific cursor isn't interacting with your current mouse input. Once you click back into the game, focus is switched and it can go back to functioning normally.

I just re-tried without borderless windowed mode, I mean fullscreen mode and it happens the same.

KKuraiShidosha 2021-08-11 github

This is starting to go off topic, but when you're in fullscreen, adjust the volume and if you see the Windows volume overlay pop-up over your game, then you're not in real fullscreen. You have to disable fullscreen optimizations otherwise you're in a hacked borderless fullscreen mode and effectively nothing has changed.

KK0bin maintainer 2021-08-11 github

Report back when you know which API we're not implementing or calling correctly. This wild speculation isnt helpful.

Ssn-o-w 2021-08-11 github

This is starting to go off topic, but when you're in fullscreen, adjust the volume and if you see the Windows volume overlay pop-up over your game, then you're not in real fullscreen. You have to disable fullscreen optimizations otherwise you're in a hacked borderless fullscreen mode and effectively nothing has changed.

Uhm, it seems like DXVK is not entering fullscreen mode?! I disabled fullscreen optimizations for GTAIV.exe.

Then I removed d3d9.dll in order for the game to run using the original D3D renderer. Game seems to enter fullscreen mode, because I cannot see any volume overlay pop-up over the game, but I can clearly notice volume change when I volume up/down by keyboard.

After that, I added back the d3d9.dll file from DXVK. I ran GTAIV.exe and everytime I changed volume by keyboard, there's a volume overlay pop-up over the game.

In both cases full screen optimizations were disabled.

So is this actually an issue?!

KK0bin maintainer 2021-08-11 github

No it's not.

KKuraiShidosha 2021-08-12 github

DXVK runs in exclusive fullscreen just fine for me, in fact it's one of the primary reasons why I use it on Windows (escape from fullscreen optimizations hack). Something on your end is bugged. Your game is probably trying to run in borderless windowed mode because of some mod and you don't realize it.

Ssn-o-w 2021-08-12 github

DXVK runs in exclusive fullscreen just fine for me, in fact it's one of the primary reasons why I use it on Windows (escape from fullscreen optimizations hack). Something on your end is bugged. Your game is probably trying to run in borderless windowed mode because of some mod and you don't realize it.

@DaRkL3AD3R Can you double-click on the GTAIV executable, then just give some random mouse clicks on the screen, before the game will show up and then see if the game will enter fullscreen mode? It seems like that's the issue, somehow that prevents DXVK from entering fullscreen mode.

And how could there be something bugged on my end, given that the game with the original D3D renderer will always run in fullscreen mode? It doesn't matter if I give random mouse clicks on the screen or not before the game will show up, the game will always enter fullscreen mode. What you say makes no sense.

@K0bin It looks like DXVK is not initialising properly just because I give random clicks a few seconds before the game will show up on the screen. Is that normal? It doesn't happen with the original D3D renderer tho.

KKuraiShidosha 2021-08-12 github

I can spam the mouse button as the game is opening up and nothing happens. DXVK works perfectly fine with the game for me aside from the long load times compared to DX9.

KK0bin maintainer 2021-08-12 github

Again, can you please stop the off topic speculation until anyone has something substantial.

CCrezyDud 2021-10-17 github

might just be a wine issue

KK0bin maintainer 2021-10-17 github

Also happens on Windows with DXVK (or WineD3D).

CCrezyDud 2021-10-19 github

shiddy

Kks202005 2021-11-26 github

I'm having this issue as well. I'm also having an issue that I can't determine if it's related, where cutscenes freeze visually every few seconds, then resume.

This is on:
dxvk-1.9.2
Windows 8.1 Professional
AMD RX 580
Radeon 21.5.2
Ryzen 2600X

KK0bin maintainer 2021-11-26 github

Yes, it happens to everyone. I don't need more people to confirm the issue.

Kks202005 2021-11-26 github

It didn't start happening to me until a few days ago, and I've only played GTA IV with DXVK on this install. There's likely more conditions than just using DXVK. I provided hardware and software information in an attempt to be helpful.

Ssn-o-w 2022-01-18 github

@K0bin I kept thinking about this lately: https://github.com/ThirteenAG/Ultimate-ASI-Loader

As far as I know, Ultimate ASI Loader is needed by GTA 4 (regardless of its version) in order to run DXVK or WineD3D.

So perhaps something's misinitialized/missing in Ultimate ASI Loader resulting in such crashes/problems with DXVK?

Can you perhaps have a look at Ultimate-ASI-Loader?! I wonder if Ultimate ASI Loader has something to do with the Alt+Tab.

KK0bin maintainer 2022-01-18 github

I've never heard of Ultimate ASI and it's definitely not required to use DXVK or WineD3D.

Ssn-o-w 2022-02-14 github

@K0bin I am stupid, sorry about that.

Perhaps this is fixed?! Today I tried the latest dxvk releases and I was able to reproduce it only on v1.9.2.

I tried at least 4 times with v1.9.3 and looks like it's not crashing/freezing anymore during loading screens.

So maybe a commit/some commits between 20 September 2021 and 11 January 2022 actually helped GTA IV as well.

Ssn-o-w 2022-02-16 github

After testing a while with different older builds, it looks like this commit fixes this issue: https://github.com/doitsujin/dxvk/commit/b672c07a939dbc5643933676cbb2b76dbe2fed6b

I can reproduce this issue with older builds that don't include the above commit.

So any DXVK builds newer than 29 Nov 2021 are fine for GTA 4.

@K0bin Can you test this out? I'm pretty sure about it.

KK0bin maintainer 2022-02-16 github

This appears to be fixed.

KK0bin maintainer 2022-02-28 github

Apparently it's not fixed. :(

Nnipkownix 2022-02-28 github

@K0bin What's the current status on this? This has to be related to window messages, right?

I imagine reproducing this on Windows is simple?

KK0bin maintainer 2022-03-01 github

Reproducing it was just a matter of alt tabbing at some point while playing the game and then doing something that triggers a loading screen. At some point I reproduced it with both WineD3D and DXVK on Windows.

No idea how to fix it though. Some people have reported that it doesn't happen for them anymore but I've seen reports about infinite loading screens in recent versions. No clue what to do.

Ssn-o-w 2022-03-02 github

@K0bin What's the current status on this? This has to be related to window messages, right?

I imagine reproducing this on Windows is simple?

Yup, it's pretty simple. Just open GTA 4, load your game. After your save was loaded, just Alt-Tab out of GTA4, you can even press a few mouse clicks within Windows, then Alt-Tab back into GTA4. Go to any mission and notice the game could crash/freeze/keep loading indefinitely at the loading screen.

While the screen is loading indefinitely for a long time (like +15 secs), you can press many times Alt+Tab & press mouse clicks. It will appear "GTA 4 is not responding" and you can "Close the program" to quit the game.

This is how I reproduced this issue but it's no longer the case at least for me.

For me, the issue was fixed by this commit: https://github.com/doitsujin/dxvk/commit/b672c07a939dbc5643933676cbb2b76dbe2fed6b

You can still reproduce the issue by creating a dxvk build against the master branch and by reverting the above commit.

Ssn-o-w 2022-03-02 github

Reproducing it was just a matter of alt tabbing at some point while playing the game and then doing something that triggers a loading screen. At some point I reproduced it with both WineD3D and DXVK on Windows.

No idea how to fix it though. Some people have reported that it doesn't happen for them anymore but I've seen reports about infinite loading screens in recent versions. No clue what to do.

Can you provide more details? 🤔

In my case, this issue was clearly fixed. This commit fixes the issue: https://github.com/doitsujin/dxvk/commit/b672c07a939dbc5643933676cbb2b76dbe2fed6b

I created a dxvk build against the master branch and I reverted the above commit and without the commit, the issue appears again.

The only weird thing left is that the loading screen takes a lot of time when you want to do a benchmark test using the tool inside the game. But I don't complain at all, it doesn't freeze/crash/keep loading indefinitely anymore, at least for me. Not sure if this always happened with GTA4 with any other dxvk build, tho. It's not like I want to benchmark GTA4 on a daily basis. 😆

Perhaps your issue is different than what I experienced in the past then?! 🤨

Ssn-o-w 2022-03-24 github

Apparently it's not fixed. :(

So... can you provide more details why you said "it's not fixed"?

The issue doesn't occur anymore for me, so it's very likely something different from the issue you experience in GTA IV.

This commit fixed my issue: https://github.com/doitsujin/dxvk/commit/b672c07a939dbc5643933676cbb2b76dbe2fed6b

I tried many dxvk builds with and without the above commit and I can certainly say that the commit fixed my issue.

At this point, I'm just curious what issue you still face. 🤔

KK0bin maintainer 2022-03-24 github

I've seen reports of it still happening with DXVK versions that have this commit. That's all I know.

SSquall-Leonhart 2022-11-13 github

this issue happens on native windows, not sure why anyone thinks its a dxvk bug.

KK0bin maintainer 2022-11-23 github

I can no longer reproduce the issue.

DLLs