https://bugs.winehq.org/show_bug.cgi?id=37983
Bug ID: 37983 Summary: Jedi Knight: Dark Forces II (GOG.com version) - music doesn't work Product: Wine Version: 1.7.35 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: rixa@cs.tut.fi Distribution: ---
The game originally used to have background music on CD audio tracks. The recent GOG.com release includes those tracks in .ogg format, along with what seems to be some sort of a hack to play them through a custom winmm.dll in the game directory.
The music does not play.
For the included winmm.dll to do anything, an override of "winmm (native,builtin)" seems like a logical step. Indeed, it was reported on the GOG.com forums that this gets the music working on Crossover, and I used the trial version to verify that this is indeed the case.
But if I do the same on Wine, the game doesn't start anymore. It just dies with: err:seh:raise_exception Exception frame is not in stack limits => unable to dispatch exception.
I tried to trace it down to other overrides that crossover sets by default, but it would still work even if I removed them all. It would even keep working if I replaced the entire drive_c there with the one from my wineprefix where it doesn't work, so it probably does not have to do with any of the pre-installed software, nor an installation broken for whatever reason. Using wine on the prefix installed in crossover didn't work any better either.
In addition to a clean unpatched wine 1.7.35 that I compiled myself, I tried multiple versions of wine from PlayOnLinux but none of them started the game with the override in place; each died with the same message.
Without the override the game is still very playable, just has no background music.
Xubuntu 14.10, nvidia 331.113.
https://bugs.winehq.org/show_bug.cgi?id=37983
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sebastian@fds-team.de
--- Comment #1 from Sebastian Lackner sebastian@fds-team.de --- Created attachment 50611 --> https://bugs.winehq.org/attachment.cgi?id=50611 winmm: Delay import ole32 msacm32 to workaround bug when loading multiple winmm versions.
Confirming. Michael Müller has tracked it down to the attached change which is included in Crossover. With that applied (and setting 'winmm' to native) the music plays fine. Please note that the wine Makefile system is buggy here, you'll have to do some other changes in dlls/winmm (touch dlls/winmm/*.c), otherwise it will not recompile the library.
https://bugs.winehq.org/show_bug.cgi?id=37983
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |michael@fds-team.de
https://bugs.winehq.org/show_bug.cgi?id=37983
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |leslie_alistair@hotmail.com
https://bugs.winehq.org/show_bug.cgi?id=37983
--- Comment #2 from Rixa rixa@cs.tut.fi --- Confirming that the patch works. Great work!
https://bugs.winehq.org/show_bug.cgi?id=37983
--- Comment #3 from Sebastian Lackner sebastian@fds-team.de --- Created attachment 50634 --> https://bugs.winehq.org/attachment.cgi?id=50634 Log with WINEDEBUG=+module and winedbg stack trace
The attached log shows that this is indeed a ntdll/loader problem.
* The game loads the native winmm library. * While resolving the forwarded export "system32\winmm.waveOutClose" the builtin dll is loaded. * While fixing up the imports for the native library (load_builtin_callback -> fixup_imports -> import_dll), additional libraries (ole32, msacm32) are loaded as dependencies. * Those dependencies also try to import winmm. Unfortunately they are also affected by the hook, so they don't get the builtin library, but instead the native lib.
This recursive loading situation is not handled properly by the Wine loader. This has the effect that wm->deps[i] is referenced before it was initialized (in the attached log it contained the garbage value 0x640000). To demonstrate this a bit better you can also apply the following patch:
--- snip --- diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index e1444d2..0405cf5 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -884,4 +884,7 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path ) wm->deps = RtlAllocateHeap( GetProcessHeap(), 0, nb_imports*sizeof(WINE_MODREF *) );
+ for (i = 0; i < nb_imports; i++) + wm->deps[i] = (void *)0xdeadbeef; + /* load the imported modules. They are automatically * added to the modref list of the process. --- snip ---
I am not sure how exactly this issue can be fixed (besides the workaround above), but probably some other people more experienced with the wine loader area can take a look.
https://bugs.winehq.org/show_bug.cgi?id=37983
Shmerl shtetldik@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |shtetldik@gmail.com
--- Comment #4 from Shmerl shtetldik@gmail.com --- Looks like Outlaws (GOG release) uses the same winmm hook technique. I'll test the patch a bit later and will report the result.
https://bugs.winehq.org/show_bug.cgi?id=37983
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #5 from Bruno Jesus 00cpxxx@gmail.com --- Confirming as per previous comments.
https://bugs.winehq.org/show_bug.cgi?id=37983
Sean DuBois sean@siobud.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sean@siobud.com
--- Comment #6 from Sean DuBois sean@siobud.com --- Bruno Jesus you were able to build with the patch and play outlaws with the current HEAD?
I built f34ec94308514d4379d7af2e73e78c3b99a94c75 + the attached the patch and got the following backtrace on OSX
https://bugs.winehq.org/show_bug.cgi?id=37983
--- Comment #7 from Sean DuBois sean@siobud.com --- Created attachment 51076 --> https://bugs.winehq.org/attachment.cgi?id=51076 Outlaws Backtrace with patch applied against f34ec94308514d4379d7af2e73e78c3b99a94c75
https://bugs.winehq.org/show_bug.cgi?id=37983
--- Comment #8 from Sean DuBois sean@siobud.com --- Created attachment 51077 --> https://bugs.winehq.org/attachment.cgi?id=51077 Outlaws Wine Debug with patch applied against f34ec94308514d4379d7af2e73e78c3b99a94c75
With WINEDEBUG=+module this is the output when using (native, builtin) for winmm.dll
https://bugs.winehq.org/show_bug.cgi?id=37983
Rixa rixa@cs.tut.fi changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Jedi Knight: Dark Forces II |Jedi Knight: Dark Forces |(GOG.com version) - music |II, Outlaws (GOG.com |doesn't work |versions) - music doesn't | |work
https://bugs.winehq.org/show_bug.cgi?id=37983
--- Comment #9 from Shmerl shtetldik@gmail.com --- I also opened a bug in ogg-winmm just for tracking this: https://github.com/hifi/ogg-winmm/issues/2
https://bugs.winehq.org/show_bug.cgi?id=37983
Sean DuBois sean@siobud.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #51076|0 |1 is obsolete| |
--- Comment #10 from Sean DuBois sean@siobud.com --- Created attachment 51093 --> https://bugs.winehq.org/attachment.cgi?id=51093 Outlaws Backtrace with patch applied against f34ec94308514d4379d7af2e73e78c3b99a94c75 with symbols
https://bugs.winehq.org/show_bug.cgi?id=37983
--- Comment #11 from Sebastian Lackner sebastian@fds-team.de --- Hello guys. Could someone explain me please (via email) why the Outlaws issue has anything to do with the original bug report? This is a bug tracker and not a forum, it is meant to provide Wine developers with the necessary information to fix _one_ specific issue. This only works when wild speculations are avoided.
This issue was opened for Jedi Knight: Dark Forces II and was already half-analyzed and tracked down to a wine loader issue (see comment #3). I have confirmed myself that the patch from comment #1 is fully sufficient to fix/workaround _this_ bug, with that applied Jedi Knight: Dark Forces II works perfectly fine.
The backtraces / logs from Outlaws have nothing in common (and show a crash related to dialog procs), so unless you already debugged the application, there is no way to conclude that is has anything to do with this bug. It could be basically anything. Asking the ogg-winmm people will also not help, because this is not a bug in their wrapper, its in the wine loader. Please try to avoid all the confusion, it will make it much harder for someone else to investigate this issue.
If you need help with testing the patch, please discuss that in the forums. Otherwise, if you are sure that the patch doesn't help, please open a new bug report instead of mixing up different issues in this one. Thanks.
https://bugs.winehq.org/show_bug.cgi?id=37983
--- Comment #12 from Shmerl shtetldik@gmail.com --- Not sure about the traces, but Outlaws uses exactly the same library which is internal GOG's fork of ogg-winmm, and also doesn't play music. So I'd say it should be a common bug for both. There is actually an easy workaround for this, and I'll post it shortly (writing a small script now).
https://bugs.winehq.org/show_bug.cgi?id=37983
--- Comment #13 from Shmerl shtetldik@gmail.com --- The workaround is to rename hook winmm.dll to something else (with same length of the name), and to patch binaries which use it with that change.
See example for Outlaws here: https://gist.github.com/shmerl/baa5367fce111e6999a4
https://bugs.winehq.org/show_bug.cgi?id=37983
--- Comment #14 from Rixa rixa@cs.tut.fi --- I noticed that the 1998 remakes of X-Wing and TIE Fighter as sold by GOG.com also have this same setup. They too require an override for winmm.dll, but this again crashes wine. The patch in Comment1 helps, and the music then works.
https://bugs.winehq.org/show_bug.cgi?id=37983
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch CC| |focht@gmx.net Component|-unknown |winmm&mci
--- Comment #15 from Anastasius Focht focht@gmx.net --- Hello folks,
obviously still present.
$ wine --version wine-1.7.43-123-g90ed96a
The patch from Michael is also available/included in Wine-Staging by default:
https://github.com/wine-compholio/wine-staging/blob/master/patches/winmm-Del...
Regards
https://bugs.winehq.org/show_bug.cgi?id=37983
WineBuG winebugs140@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winebugs140@gmail.com
--- Comment #16 from WineBuG winebugs140@gmail.com --- *** Bug 35992 has been marked as a duplicate of this bug. ***
https://bugs.winehq.org/show_bug.cgi?id=37983
--- Comment #17 from WineBuG winebugs140@gmail.com --- Not fixed in Wine 1.7.51, GOG.com HoMM 2 Gold Windows version seems to be affected by this bug as well.
https://bugs.winehq.org/show_bug.cgi?id=37983
Michael Müller michael@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |STAGED Staged patchset| |https://github.com/wine-com | |pholio/wine-staging/tree/ma | |ster/patches/winmm-Delay_Im | |port_Depends
https://bugs.winehq.org/show_bug.cgi?id=37983
fjfrackiewicz@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fjfrackiewicz@gmail.com
--- Comment #18 from fjfrackiewicz@gmail.com --- Music during the actual levels in Outlaws (GOG version) does not play. The music does play i the intro movies, though.
https://bugs.winehq.org/show_bug.cgi?id=37983
Paul The Tall paulthetall@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |paulthetall@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=37983
--- Comment #19 from Rixa rixasha@yahoo.com --- I decided to get Outlaws from the current GOG.com sale to finally check it out for the purposes of this bug.
* First I tried it with wine 2.2, and the music during missions didn't play. * I then added an override to winmm.dll, and wine crashed. * I then added the patch from Comment 1, and the music started to play.
As far as I can tell, there is nothing special about Outlaws. It is the same setup as with Dark Forces II, the 1998 remakes of X-Wing and Tie Fighter and probably others as this seems to be the way that GOG.com likes to handle used-to-be-CD-audio. It has the same problem as the others, and the same patch fixes it.
(A wine-staging build together with the override also plays the music, which is not surprising if wine-staging already includes the patch)
https://bugs.winehq.org/show_bug.cgi?id=37983
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Staged patchset|https://github.com/wine-com |https://github.com/wine-sta |pholio/wine-staging/tree/ma |ging/wine-staging/tree/mast |ster/patches/winmm-Delay_Im |er/patches/winmm-Delay_Impo |port_Depends |rt_Depends CC| |nerv@dawncrow.de
https://bugs.winehq.org/show_bug.cgi?id=37983
--- Comment #20 from Shmerl shtetldik@gmail.com --- I just tested Outlaws with winmm native override. In regular Wine, the music works, but it's too fast. With Wine staging, the music is normal.
What patch in Staging exactly is fixing this?
https://bugs.winehq.org/show_bug.cgi?id=37983
Le Gluon du Net legluondunet@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |legluondunet@gmail.com
--- Comment #21 from Le Gluon du Net legluondunet@gmail.com --- winmm works for me with this games: motoracer 1 and 2 dark forces II heretic II
just override dll in "native, builtin" this bug could be close
https://bugs.winehq.org/show_bug.cgi?id=37983
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|winmm&mci |ntdll CC| |z.figura12@gmail.com Resolution|--- |FIXED Status|STAGED |RESOLVED
--- Comment #22 from Zebediah Figura z.figura12@gmail.com --- I can confirm that the music in Jedi Knight: Dark Forces II (from GOG) works, with winmm set to "native,builtin". I started a new game, skipped the cutscene, and there was music playing that matched "MUSIC/Track12.ogg". When I removed the override, no music played.
I haven't bisected when it was fixed.
https://bugs.winehq.org/show_bug.cgi?id=37983
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #23 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.5.