WineHQ
Bug Tracking Database – Bug 28869

 Bugzilla

 

Last modified: 2014-03-25 16:59:18 UTC  

Neverwinter Nights fails to load

Bug 28869 - Neverwinter Nights fails to load
Neverwinter Nights fails to load
Status: CLOSED FIXED
AppDB: Show Apps affected by this bug
Product: Wine
Classification: Unclassified
Component: d3d
1.3.28
x86 Linux
: P2 normal
: ---
Assigned To: Mr. Bugs
http://www.gamefront.com/files/2129030
: download, patch, regression
: 26819 31407 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2011-10-23 07:36 UTC by David Shaw
Modified: 2014-03-25 16:59 UTC (History)
9 users (show)

See Also:
Regression SHA1: 77face22d5365d94b9bfe614ed202692e1523593
Fixed by SHA1: 75d53c9aed0b93b5a3607d2949d04d0570e781b1
Distribution: ---
Staged patchset:


Attachments
Terminal output (2.30 KB, text/plain)
2011-10-23 07:36 UTC, David Shaw
Details
Patch to fix (659 bytes, patch)
2014-02-05 13:27 UTC, Ken Thomases
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Shaw 2011-10-23 07:36:29 UTC
Created attachment 37077 [details]
Terminal output

Neverwinter Nights fails to load from wine 1.3.28 to 1.3.31

The videos play, then the cursor changes to the NWN hand, but the menu does not appear.

Regression testing gives

94ae743ea668e49d40ae4e2dc5fe1f5d9be018cb is the first bad commit
commit 94ae743ea668e49d40ae4e2dc5fe1f5d9be018cb
Author: Henri Verbeet <hverbeet@codeweavers.com>
Date:   Tue Aug 30 20:12:31 2011 +0200

    ddraw: Make the OpenGL renderer the default one.

:040000 040000 fbce2dc172258a4a7eabc65b6f86bd58522b4667 dfb3b24196ac3ad09100758a48b2d4ef7e45e26b M	dlls


This is the Diamond Edition as sold on www.gog.com.
Comment 1 Béla Gyebrószki 2011-10-23 08:55:29 UTC
I can confirm/reproduce the problem in NWN Diamond Edition on my system.
The intro videos are playing fine but the main menu is black/nothing can be
seen (music is playing).
The problem is not reproducible in the demo version, because it contains only a
small bik video, which doesn't come into play when launching the demo.
Is it allowed to attach one of the short videos (company logo) here, so the
problem could be reproducible with the demo as well?

Workarounds:
1. winetricks ddr=gdi
2. Remove all bik videos from the movies directory.

Fedora 15 x86
Nvidia 250 / driver 280.13
Comment 2 Béla Gyebrószki 2011-10-23 09:09:32 UTC
NVM, I found another way to reproduce the problem in the demo version.
The demo installs CDpromoEND.bik in the movies directory. Rename that file to AtariLogo.bik.
Start the demo by nwmain.exe. The logo is shown but the main menu shows only black.
Comment 3 Henri Verbeet 2011-11-16 12:07:43 UTC
I don't think I can fix this without moving GL processing into its own thread. What happens is that the application creates a GL context, makes it current, and then immediately destroys the DC that context was created on. This works more or less as long as that context stays current. However, when the application then also uses ddraw we have to make a different GL context current for wined3d. Since the original DC was destroyed, there's no way for wined3d to restore the original GL context after it's done.
Comment 4 Béla Gyebrószki 2012-08-05 02:30:37 UTC
It is still present in Wine 1.5.9.
In 1.5.10 the game hits bug #31407 for me.

I noticed that on my current system (Fedora 17, Nvidia 304.32 drivers), the previously mentioned workaround (ddr=gdi) no longer works for some reason.
Comment 5 Alexandre Julliard 2012-08-14 12:19:31 UTC
*** Bug 31407 has been marked as a duplicate of this bug. ***
Comment 6 Frédéric Delanoy 2013-07-09 03:57:09 UTC
Still in wine-1.6-rc4-65-g6cf05f9
Comment 7 Pierre Etchemaite 2013-11-20 13:55:01 UTC
Problem still exists in 1.7.6

Debian unstable architecture amd64
Nvidia GeForce G102M / proprietary driver 325.15

Just out of curiosity I tried with 1.7.1 and CSMT patch, but no difference.
Comment 8 Ken Thomases 2014-01-11 08:04:42 UTC
(In reply to comment #3)

Henri said:
> I don't think I can fix this without moving GL processing into its own
> thread. What happens is that the application creates a GL context, makes it
> current, and then immediately destroys the DC that context was created on.
> This works more or less as long as that context stays current. However, when
> the application then also uses ddraw we have to make a different GL context
> current for wined3d. Since the original DC was destroyed, there's no way for
> wined3d to restore the original GL context after it's done.

I probably come off as WGL-extension-happy but we could solve this with an extension.  Although wglMakeCurrent() requires passing in a DC, we could provide an alternative function which makes the context current with its last-used drawable(s).  The X11 driver already stores sufficient information in the context object to do that.  The Mac driver doesn't even require that.  The Mac APIs separate the notion of making a context current for the thread from setting its drawable, so we can do just the former.
Comment 9 Henri Verbeet 2014-01-11 08:34:44 UTC
(In reply to comment #8)
> I probably come off as WGL-extension-happy but we could solve this with an
> extension.  Although wglMakeCurrent() requires passing in a DC, we could
> provide an alternative function which makes the context current with its
> last-used drawable(s).  The X11 driver already stores sufficient information
> in the context object to do that.  The Mac driver doesn't even require that.
> The Mac APIs separate the notion of making a context current for the thread
> from setting its drawable, so we can do just the former.

That's a good point.
Comment 10 Ken Thomases 2014-02-04 01:01:45 UTC
I'm working on a fix along the lines that I suggested in comment 8.  However, I've found that it's not enough.

There's a place in wined3d where it clears the current GL context without saving it so it can restore it later.  At the top of wined3d_device_uninit_3d() there's a call to context_set_current(NULL).  Just commenting out that call (with none of my other changes) allows the menu to show after the logo video.

(The logo video itself doesn't render for me.  Neither does the game world.  But the menu and the in-game HUD does.  I'm testing with the demo download, as per comment 2.)
Comment 11 Ken Thomases 2014-02-05 12:43:49 UTC
(In reply to comment #10)

> (The logo video itself doesn't render for me.  Neither does the game world. 
> But the menu and the in-game HUD does.  I'm testing with the demo download,
> as per comment 2.)

It turns out that the game world failing to render is because glu32 is still tied to X11.  A hack similar to the one on bug 34398 fixes that, although the logo video still doesn't show.
Comment 12 Ken Thomases 2014-02-05 13:27:26 UTC
Created attachment 47418 [details]
Patch to fix

This removes the clearing of the GL context that loses the app's context unrecoverably.  It was originally introduced with <http://source.winehq.org/git/wine.git/commit/77face22d5365d94b9bfe614ed202692e1523593>.  It doesn't seem related to the rest of the stuff in that commit, but I may not have followed the logic.

There's a comment that the clearing was necessary to work around driver bugs, but doesn't elaborate.  I'm tempted to revert this part of it and see what breaks so it can be fixed the right way and with the appropriate documentation.
Comment 13 Ken Thomases 2014-02-05 14:06:51 UTC
Submitted as <http://source.winehq.org/patches/data/102231>.
Comment 15 Alexandre Julliard 2014-02-07 13:05:38 UTC
Closing bugs fixed in 1.7.12.
Comment 16 Anastasius Focht 2014-03-25 16:59:18 UTC
*** Bug 26819 has been marked as a duplicate of this bug. ***


Privacy Policy
If you have a privacy inquiry regarding this site, please write to [email protected]

Hosted By CodeWeavers