http://bugs.winehq.org/show_bug.cgi?id=20838
Summary: Morrowind Graphics Extender's d3d8.dll replacement fails to load Product: Wine Version: 1.1.33 Platform: PC URL: http://morrgraphext.sourceforge.net/ OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 AssignedTo: wine-bugs@winehq.org ReportedBy: chris.kcat@gmail.com
Morrowind Graphics Extender enhances Morrowind's graphics by providing its own d3d8.dll that calls to d3d9, and catches certain calls to provide enhanced functionality. Under Wine, the provided d3d8.dll fails to load with exception c0000005 (sigsegv).
Being open source, I was able to trace the crash to the handling of the STARTUPINFO provided by GetStartupInfo. As you can see in DllMain here: https://morrgraphext.svn.sourceforge.net/svnroot/morrgraphext/d3d8/main.cpp it calls GetStartupInfo then goes right to parsing the lpTitle field to find the executable name.
Under Wine, though, the returned STARTUPINFO.lpTitle field will either be an empty string (for the unicode version) or NULL (the ansi version, and sometimes the unicode version), as opposed to the full application path/exe. Being that the code uses the ansi version, it gets a NULL lpTitle and segfaults when it derefs it while looking for the directory separator.
To reproduce, you'll have to install MGE, then run Morrowind using WINEDLLOVERRIDES="d3d8=n,b;dinput8=n,b" (it has to be n,b since the dll will also try to load the system/built-in dll). The crash is reproduceable with any d3d8 app, but will likely not work properly when fixed if it's not Morrowind.
http://bugs.winehq.org/show_bug.cgi?id=20838
Chris chris.kcat@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download
http://bugs.winehq.org/show_bug.cgi?id=20838
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |source
http://bugs.winehq.org/show_bug.cgi?id=20838
Xavier Vachon xvachon@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |xvachon@gmail.com
--- Comment #1 from Xavier Vachon xvachon@gmail.com 2010-10-21 09:47:21 CDT --- Is this still an issue in curent git (1.3.5)?
http://bugs.winehq.org/show_bug.cgi?id=20838
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #2 from joaopa jeremielapuree@yahoo.fr 2011-07-09 09:08:35 CDT --- no answer since 2 years. This bug could be closed as ABANDONED
http://bugs.winehq.org/show_bug.cgi?id=20838
--- Comment #3 from Chris chris.kcat@gmail.com 2011-07-09 12:43:10 CDT --- Unfortunately I'm unable to test if the root cause (STARTUPINFO.lpTitle being NULL after calling GetStartupInfo), as MGE has been changed to not make that call anymore. Checking Wine's source, it's difficult to tell if it's still being set to NULL.
http://bugs.winehq.org/show_bug.cgi?id=20838
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |dank@kegel.com Resolution| |ABANDONED
--- Comment #4 from Dan Kegel dank@kegel.com 2011-07-09 13:18:38 CDT --- OK, let's close as abandoned, then. You can reopen if you find the old version and want to pursue this.
http://bugs.winehq.org/show_bug.cgi?id=20838
--- Comment #5 from Jeff Zaroyko jeffz@jeffz.name 2011-07-11 16:24:50 CDT --- Closing abandoned.
http://bugs.winehq.org/show_bug.cgi?id=20838
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Jeff Zaroyko jeffz@jeffz.name 2011-07-11 16:25:42 CDT --- Closing.
http://bugs.winehq.org/show_bug.cgi?id=20838
WineBuG winebugs140@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winebugs140@gmail.com
--- Comment #7 from WineBuG winebugs140@gmail.com 2013-12-01 15:44:37 CST --- It has been closed as ABANDONED, but I think this is still a problem in recent versions of Wine. Maybe it would be good to REOPEN it?
This is an important fragment (2013-06-26) of the discussion concerning Morrowind Graphics Extender and Wine from official MGE forums:
"But actually launching the game with MGE is impossible: if we set Wine to use native d3d8/dinput8 dlls so that MGE is enabled, it'll then fail to find the 'real' dlls which it loads during initialization. Thing is, MGE explicitly tries to load those dlls from system directory (normally \windows\system32 on 32-bit machine), but in Wine those DLLs are just stubs: Wine tries to load them, looks for overrides, see that they're overridden, and tries to load native libs again, which is obviously not the desired behavior. However, through some experimentation, I've found out that LoadLibrary() can happily load Wine's "proper" dll.so libraries. So...
This patch enables MGE to look for "MGE_WINEDLLPATH" environment variable and try to load d3d8.dll.so and dinput8.dll.so from there. Failing to find the variable it'll revert to the original dlls in system directory. Thus, users launching the game on Linux under Wine will now be able to see the MGE in its full glory :)
On Ubuntu, the value for this variable would be /usr/lib/i386-linux-gnu/wine for 32-bit Wine prefix and /usr/lib/x86_64-linux-gnu on 64-bit Wine prefix, though the latter is not tested since pretty much any other prerequisites (DirectX, .NET, etc.) currently only work with 32-bit Wine prefix. G enerally, it's whatever directory that contains d3d8.dll.so and dinput8.dll.so."
I recommend looking through the whole thread: http://sourceforge.net/p/morrgraphext/discussion/866295/thread/422538db
http://bugs.winehq.org/show_bug.cgi?id=20838
WineBuG winebugs140@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeffz@jeffz.name
http://bugs.winehq.org/show_bug.cgi?id=20838
WineBuG winebugs140@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=20838
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- CC|jeffz@jeffz.name |
http://bugs.winehq.org/show_bug.cgi?id=20838
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|CLOSED |REOPENED Resolution|ABANDONED |--- Ever confirmed|0 |1
--- Comment #8 from Austin English austinenglish@gmail.com --- (In reply to comment #7)
It has been closed as ABANDONED, but I think this is still a problem in recent versions of Wine. Maybe it would be good to REOPEN it?
This is an important fragment (2013-06-26) of the discussion concerning Morrowind Graphics Extender and Wine from official MGE forums:
"But actually launching the game with MGE is impossible: if we set Wine to use native d3d8/dinput8 dlls so that MGE is enabled, it'll then fail to find the 'real' dlls which it loads during initialization. Thing is, MGE explicitly tries to load those dlls from system directory (normally \windows\system32 on 32-bit machine), but in Wine those DLLs are just stubs: Wine tries to load them, looks for overrides, see that they're overridden, and tries to load native libs again, which is obviously not the desired behavior. However, through some experimentation, I've found out that LoadLibrary() can happily load Wine's "proper" dll.so libraries. So...
I can confirm this in wine-1.7.11 (didn't try the patch though..)
http://bugs.winehq.org/show_bug.cgi?id=20838
--- Comment #9 from WineBuG winebugs140@gmail.com --- (In reply to comment #8) ...
I can confirm this in wine-1.7.11 (didn't try the patch though..)
Could you attach a debug trace/logs from this version? Maybe it'd help to solve this issue.
http://bugs.winehq.org/show_bug.cgi?id=20838
--- Comment #10 from WineBuG winebugs140@gmail.com --- I currently don't have Morrowind, so I can't test this out.
http://bugs.winehq.org/show_bug.cgi?id=20838
--- Comment #11 from Austin English austinenglish@gmail.com --- Well, I was able to get it to run with MGE, but the screen is black when doing so.
WINEDLLOVERRIDES="*d3d8=n,b;*dinput8=n,b" wine Steam.exe
lsof shows it loading the mge dll: [austin@localhost Steam]$ lsof | grep d3d8 wineserve 23313 austin 297r REG 253,4 479232 9961495 /home/austin/.wine/drive_c/Program Files/Steam/steamapps/common/Morrowind/d3d8.dll Morrowind 23635 austin mem REG 253,4 479232 9961495 /home/austin/.wine/drive_c/Program Files/Steam/steamapps/common/Morrowind/d3d8.dll
but, as I said, there's a black screen. I'm not sure that we support overriding the d3d libraries in this way.
any wined3d guy care to comment?
http://bugs.winehq.org/show_bug.cgi?id=20838
--- Comment #12 from Henri Verbeet hverbeet@gmail.com --- (In reply to comment #11)
but, as I said, there's a black screen. I'm not sure that we support overriding the d3d libraries in this way.
any wined3d guy care to comment?
If it calls into d3d9.dll I think that should work in principle. Calling directly into the D3D DDI won't.
http://bugs.winehq.org/show_bug.cgi?id=20838
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |FIXED
--- Comment #13 from Austin English austinenglish@gmail.com --- (In reply to comment #12)
(In reply to comment #11)
but, as I said, there's a black screen. I'm not sure that we support overriding the d3d libraries in this way.
any wined3d guy care to comment?
If it calls into d3d9.dll I think that should work in principle. Calling directly into the D3D DDI won't.
Well, it seemed like it was a regression, working in wine-1.4.1, but not in recent wine. I started a bisect, but wasn't getting good results. After a reboot, it works fine in wine-1.7.11-114-g6f498c4.
Command used was: WINEPREFIX=~/.wine-mge/ WINEDLLOVERRIDES="*d3d8,*dinput8=n,b" wine Steam.exe -applaunch 22320
http://bugs.winehq.org/show_bug.cgi?id=20838
--- Comment #14 from WineBuG winebugs140@gmail.com --- (In reply to comment #13)
(In reply to comment #12)
(In reply to comment #11)
but, as I said, there's a black screen. I'm not sure that we support overriding the d3d libraries in this way.
any wined3d guy care to comment?
If it calls into d3d9.dll I think that should work in principle. Calling directly into the D3D DDI won't.
Well, it seemed like it was a regression, working in wine-1.4.1, but not in recent wine. I started a bisect, but wasn't getting good results. After a reboot, it works fine in wine-1.7.11-114-g6f498c4.
Command used was: WINEPREFIX=~/.wine-mge/ WINEDLLOVERRIDES="*d3d8,*dinput8=n,b" wine Steam.exe -applaunch 22320
So you say it's fixed even though you had to use these overrides parameters? Does Morrowind Overhaul (it uses MGE) work now? http://www.ornitocopter.net/morrowind-overhaul/
http://bugs.winehq.org/show_bug.cgi?id=20838
--- Comment #15 from Austin English austinenglish@gmail.com --- (In reply to comment #14)
(In reply to comment #13)
(In reply to comment #12)
(In reply to comment #11)
but, as I said, there's a black screen. I'm not sure that we support overriding the d3d libraries in this way.
any wined3d guy care to comment?
If it calls into d3d9.dll I think that should work in principle. Calling directly into the D3D DDI won't.
Well, it seemed like it was a regression, working in wine-1.4.1, but not in recent wine. I started a bisect, but wasn't getting good results. After a reboot, it works fine in wine-1.7.11-114-g6f498c4.
Command used was: WINEPREFIX=~/.wine-mge/ WINEDLLOVERRIDES="*d3d8,*dinput8=n,b" wine Steam.exe -applaunch 22320
So you say it's fixed even though you had to use these overrides parameters?
My understanding is that those DLL overrides are expected to be required. From get_load_order() in dlls/ntdll/load_order.c: /* first explicit module name */ ... /* then module basename preceded by '*' */ ... /* then module basename without '*' (only if explicit path) */ ... /* if loading the main exe with an explicit path, try native first */ ... /* and last the hard-coded default */ ...
Does Morrowind Overhaul (it uses MGE) work now? http://www.ornitocopter.net/morrowind-overhaul/
I was testing on my laptop with a not very powerful intel chip. The initial loading screen shows the 'Morrowind Graphics Extender' message, and lsof indicates that the dll is loaded. I didn't check for improved graphics (since my settings are pretty low anyway).
I didn't try Morrowind Overhaul.
https://bugs.winehq.org/show_bug.cgi?id=20838
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #16 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.7.12.