Joshua-Ashton/d9vk

Battlefield 2 → crash at launch

NerosTie opened this issue · 6 comments

A black screen then it crashes.

System information

  • GPU: Nvidia GT 730M
  • Driver: 435.21
  • Wine version: Proton 4.11
  • DXVK version: #880

Apitrace file(s)

https://mega.nz/#!ynhWQQjK!8mC_JQrJhRguCAJ8RESqV3wJ-2vwshRntMq3nM2FTsE

Log files

battlefield-2-d9vk.log

Trace works fine.. Can you try playing in windowed mode. Looks like a weird setup issue on your end.

Yes, it doesn't crash in windowed mode.
But I have no issue with fullscreen mode with d3d9. What does it mean?

@NerosTie

This is a very well known and long standing issue with BF2:

info:  D3D9: Setting display mode: 800x600@85
err:   D3D9: EnterFullscreenMode: Failed to change display mode

The game attempts to a display mode 800x600 85Hz, which very few displays support. This can be worked around by applying a patch to Wine to allow setting a fallback display frequency.

I see. But it doesn't crash with d3d9, so why a patch for Wine?

Can you try this patch?

diff --git a/src/d3d9/d3d9_monitor.cpp b/src/d3d9/d3d9_monitor.cpp
index a1af87653..b6e0d6c5b 100644
--- a/src/d3d9/d3d9_monitor.cpp
+++ b/src/d3d9/d3d9_monitor.cpp
@@ -108,6 +108,14 @@ namespace dxvk {
     
     LONG status = ::ChangeDisplaySettingsExW(
       monInfo.szDevice, &devMode, nullptr, CDS_FULLSCREEN, nullptr);
+
+    if (status != DISP_CHANGE_SUCCESSFUL) {
+      // Try again but without setting the frequency.
+      devMode.dmFields &= ~DM_DISPLAYFREQUENCY;
+      devMode.dmDisplayFrequency = 0;
+      status = ::ChangeDisplaySettingsExW(
+        monInfo.szDevice, &devMode, nullptr, CDS_FULLSCREEN, nullptr);
+    }
     
     return status == DISP_CHANGE_SUCCESSFUL ? D3D_OK : D3DERR_NOTAVAILABLE;
   }

d3d9.zip

Yes, the issue is solved with this patch :)