protonscr

Yakuza Kiwami 2 crashing at boot time

dxvkclosed bug
doitsujin/dxvk#1053 · opened 2019-05-13 by RodoMa92 · updated 2019-05-14 · 11 comments · github
RRodoMa92 2019-05-13 github

Software information

Yakuza Kiwami 2, the issue is always present regardless of chosen settings. The game will crash almost every time when the engine is initializing, in booting and if the settings are changed ingame (presumably because the engine is reinitialized again). If the game is booted correctly, if it is not minimized or any settings are changed the game runs perfectly fine, with no graphical problems.

The game will still crash when closing, but that's not an issue for me, since I never had any crashes while playing, it's running perfectly fine (if it's starting).

I'm not sure if this is a DXVK issue or a Wine issue, so I'll apologize if this is not the right place to report such issue.

Under Wine 4.8, when the game doesn't boot, it crashes only when I press any button, not immediately, compared to Proton.

System information

  • GPU: Radeon RX580 8 GB
  • Driver: Mesa 19.2.0_git (but it was present even in the stable version, and all other games runs fine with the development version)
  • Wine version: 4.8 Staging and 4.2 (From Proton)
  • DXVK version: 1.1.1 and 1.0.3 (From Proton)

Proton Logs and Apitraces:

Apitrace file(s) with Proton + DXVK 1.0.3 only

Crash at boot time: https://www.dropbox.com/s/z84gsxu51e10bl3/YakuzaKiwami2ProtonCrash.trace.zip?dl=0

Booted correctly: https://www.dropbox.com/s/9egch582ypgkjkp/YakuzaKiwami2ProtonRunning.trace.zip?dl=0

Log files

Wine staging + DXVK master logs:

Log files

Ddoitsujin maintainer 2019-05-13 github

Will look into it; the engine is somewhat broken so I wouldn't be surprised if this was essentially a game bug that we somehow have to work around. Note that Yakuza 0 has the exact same reference counting issue and also crashed with DXVK at first.

Does this game run with wined3d?

Ddoitsujin maintainer 2019-05-13 github

I take it the traces were recorded with DXVK enabled? Unfortunately that's kind of useless when dealing with crashes since anything that DXVK might be doing wrong will be embedded in the trace files, so I have no way at all to compare it to Windows D3D11.

If the game is stable with wined3d, we'd at least know for sure that this is a DXVK-specific issue and not a wine bug.

RRodoMa92 2019-05-14 github

Yea, Proton without DXVK i literally get the same behaviour, log below:

steam-927380.log

However, the apitrace file is not created; maybe it's crashing before it even initialize the D3D API?

Without DXVK on Wine 3.8 + WineD3D the game doesen't even boot, I just get this message in the console:

apitrace: loaded into Z:\mnt\LinuxDati\SteamWine\steamapps\common\Yakuza Kiwami 2\YakuzaKiwami2.exe
apitrace: tracing to Z:\mnt\LinuxDati\SteamWine\steamapps\common\Yakuza Kiwami 2\YakuzaKiwami2.2.trace
error: unavailable function CreateDXGIFactory1

The apitrace crated there it's literally 2 bytes.

This looks like a Wine bug to me.

Ddoitsujin maintainer 2019-05-14 github

Hm, that unfortunately still doesn't really tell us anything. I guess the only way to confirm or rule out a DXVK bug would would be to test this on Windows if possible.

RRodoMa92 2019-05-14 github

I have access to a Windows install, already tested there and I do not have any crash as under DXVK. Do I need to plop in the dlls in Windows and post a trace for a successful boot? The port is surely not great, and I hope they will improve it, but it is always better that nothing for sure.

Ddoitsujin maintainer 2019-05-14 github

Do I need to plop in the dlls in Windows and post a trace for a successful boot?

Basically, yes.

The other thing that I'm curious about is whether or not it crashes when you use DXVK on Windows (again, just put the DLLs next to the game exe and see if it works).

RRodoMa92 2019-05-14 github

Here comes the apitrace with WinD3D11:
https://www.dropbox.com/s/rlu40wr7moj4rs9/YakuzaKiwami2TraceWithWinD3D11.7z?dl=0

About trying to use DXVK under Windows, I tried using 1.2 released yesterday, and I have three different cases on hand. Everything is extremely laggy when booted with DXVK under Windows, regardless of the result.

First case, crash at boot time, as under Wine:
DXVK1.2CrashOnBlackScreen.zip
Second case, crash in the boot logos when I pressed enter:
DXVK1.2BootedAndCrashOnEnter.zip
Third case, working game (even if it's practically useless, I've checked with Process Hacker and the GPU was capping at 75% in the menu, which for 5/10 FPS it's a bit strange):
DXVK1.2BootAndWorkingMenu.zip

I'm specifying the version since I had tried DXVK 1.1.1 on Windows two days ago, and the game wasn't booting at all, there was two threads stuck (probably deadlocked) in CreateD3D11Device in D3D11.dll, however I've tried today to reproduce this issue and the game now boot just fine. With 1.0.3 it was running as with 1.2.

Under Wine, when it starts, it works perfectly fine (maybe a 5% hit, and probably an issue with the antialiasing (it appears to not being applied, but I will try it now on WinD3D11 to verify it's the API and not the broken mess of a port that the game is)); still, for a two years old project, it's something amazing what a single developer can achieve; I can probably in the short term ditch Windows completely.

Thanks for your time.

EDIT: It's the broken AA implementation, it's the same on Windows.

Ddoitsujin maintainer 2019-05-14 github

The DXVK logs are useless to diagnose the crash. I'm fairly certain at this point that this is caused by a similar engine bug as in Yakuza 0 and is going to be extremely hard to debug even if I get my hands on the game, so it may never work.

RRodoMa92 2019-05-14 github

If you can fix it I would be happy, but even if I need to restart 10 times and set my settings from my INI instead of using the ingame menu, that's good for me as well.

Thanks again for your time, and keep up this amazing project :)

Ddoitsujin maintainer 2019-05-14 github

So I basically figured out what causes this, it is indeed the horrible abuse of reference counting by the game (it basically deletes render targets while they are in use).

Here's a patch that may work around this, but will introduce a memory leak. I tried to fix this properly, but unfortunately that just led to the game locking up because it now sees negative reference counts.
kiwami2.patch.txt

Ddoitsujin maintainer 2019-05-14 github

Should be fixed in master now, feel free to reopen if you find similar issues.

DLLs