https://bugs.winehq.org/show_bug.cgi?id=41292
Bug ID: 41292 Summary: Game freezes to infinite DSOUND_PerformMix loop Product: Wine Version: 1.9.17 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-dsound Assignee: wine-bugs@winehq.org Reporter: wyrex@openmailbox.org Distribution: ---
Nexton LC-ScriptEngine is an engine for visual novels. Games using it (lcsebody.exe) freeze in various places under wine. They don't crash and wine doesn't give output but using +dsound I discovered there is infinite loop that happens after freeze.
trace:dsound:DSOUND_PerformMix (0x1381f8) trace:dsound:DSOUND_MixToPrimary (23808,4160) trace:dsound:DSOUND_MixToPrimary MixToPrimary for 0x13ebb0, state=0 trace:dsound:DSOUND_MixToPrimary MixToPrimary for 0x1422a0, state=0
If I run "winetricks dsound" these games work and don't crash.
My sound setup is pulseaudio with alsa sink and wine is set to use pulseaudio in winecfg.
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #1 from Wyrex wyrex@openmailbox.org --- Still happens in wine staging 2.0-rc1, at least in https://appdb.winehq.org/objectManager.php?sClass=version&iId=34193.
https://bugs.winehq.org/show_bug.cgi?id=41292
Michael Stefaniuc mstefani@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mstefani@redhat.com
--- Comment #2 from Michael Stefaniuc mstefani@redhat.com --- Please see "What to include when filing a bug" from https://wiki.winehq.org/Sound aka please attach the log produced by +tid,+seh,+mmdevapi,+winmm,+driver,+msacm,+midi,+dsound,+dsound3d,+xaudio2,+xapofx,+dmusic,+mci,+pulse,+oss,+alsa,+coreaudio,+timestamp
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #3 from Wyrex wyrex@openmailbox.org --- Created attachment 56502 --> https://bugs.winehq.org/attachment.cgi?id=56502 +tid,+seh,+mmdevapi,+winmm,+driver,+msacm,+midi,+dsound,+dsound3d,+xaudio2,+xapofx,+dmusic,+mci,+pulse,+oss,+alsa,+coreaudio,+timestamp
Attached logs from 2.0rc1 I noticed game starts to play music when it crashes.
I opened the game, loaded save and entered buggy place, then waited few seconds and Ctrl-C. Did same with winetricks dsound but I didn't Ctrl-C, instead closed via 'X' properly.
https://bugs.winehq.org/show_bug.cgi?id=41292
Andrew Eikum aeikum@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |aeikum@codeweavers.com Summary|Game freezes to infinite |Nexton LC-ScriptEngine |DSOUND_PerformMix loop |freezes, possibly bad | |dsound notifications
--- Comment #4 from Andrew Eikum aeikum@codeweavers.com --- DSOUND_PerformMix is our audio mixing function, it is supposed to be called repeatedly until audio stops playing. Seems likely to be a bug in our dsound notifications, needs some analysis of what the game is asking for, and what notifications we are providing it.
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #5 from Wyrex wyrex@openmailbox.org --- Created attachment 57733 --> https://bugs.winehq.org/attachment.cgi?id=57733 wine-staging 2.4 +tid,+seh,+mmdevapi,+winmm,+driver,+msacm,+midi,+dsound,+dsound3d,+xaudio2,+xapofx,+dmusic,+mci,+pulse,+oss,+alsa,+coreaudio,+timestamp
This happens in wine-staging 2.4. Attached is logs with and without dsound.
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #6 from Wyrex wyrex@openmailbox.org --- Happens in wine-staging 2.11
https://bugs.winehq.org/show_bug.cgi?id=41292
bugged jeloganeg@free-temp.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeloganeg@free-temp.net
--- Comment #7 from bugged jeloganeg@free-temp.net --- still happens with wine staging 4.16 i have a LC-ScriptEngine game and for me the game hangs at the exact same place, however there were rare cases where the game actually didn't hang (happend with the 1st time i used WINEDEBUG=+all & WINEDEBUG=+dsound
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #8 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- (In reply to bugged from comment #7)
still happens with wine staging 4.16 i have a LC-ScriptEngine game and for me the game hangs at the exact same place, however there were rare cases where the game actually didn't hang (happend with the 1st time i used WINEDEBUG=+all & WINEDEBUG=+dsound
Can you please attach a +dsound log?
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #9 from bugged2 bugged234@mail.com --- Created attachment 65319 --> https://bugs.winehq.org/attachment.cgi?id=65319 a +dsound attachment
sorre for the late reply , iam bugged but forgot my old account password anyway here is a +dsound attachment where the game hangs i cannot reproduce that rare case where it actually worked
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #10 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- Created attachment 65323 --> https://bugs.winehq.org/attachment.cgi?id=65323 GetStatus to return DSBSTATUS_TERMINATED
Can you please try this patch?
https://bugs.winehq.org/show_bug.cgi?id=41292
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
https://bugs.winehq.org/show_bug.cgi?id=41292
bugged2 bugged234@mail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |bugged234@mail.com
--- Comment #11 from bugged2 bugged234@mail.com --- Created attachment 65330 --> https://bugs.winehq.org/attachment.cgi?id=65330 dsound_dsbstatus
hello , it is my first time compiling wine so i am not sure if i compiled it correctly, anyway i get a msg box "This game failed to generate directsoundmanagers" then the game closes, i use ubuntu 18.04
https://bugs.winehq.org/show_bug.cgi?id=41292
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |leslie_alistair@hotmail.com
--- Comment #12 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- (In reply to bugged2 from comment #11)
Created attachment 65330 [details] dsound_dsbstatus
hello , it is my first time compiling wine so i am not sure if i compiled it correctly, anyway i get a msg box "This game failed to generate directsoundmanagers" then the game closes, i use ubuntu 18.04
Does it work without my patch?
This patch was a long shot anyway.
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #13 from bugged2 bugged234@mail.com --- (In reply to Alistair Leslie-Hughes from comment #12)
(In reply to bugged2 from comment #11)
Created attachment 65330 [details] dsound_dsbstatus
hello , it is my first time compiling wine so i am not sure if i compiled it correctly, anyway i get a msg box "This game failed to generate directsoundmanagers" then the game closes, i use ubuntu 18.04
Does it work without my patch?
This patch was a long shot anyway.
no looks like something went wrong with compiling , i get the same message without the patch , would sending & replacing dsound.dll result in the patch being applied?
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #14 from bugged2 bugged234@mail.com --- (In reply to Alistair Leslie-Hughes from comment #12)
(In reply to bugged2 from comment #11)
Created attachment 65330 [details] dsound_dsbstatus
hello , it is my first time compiling wine so i am not sure if i compiled it correctly, anyway i get a msg box "This game failed to generate directsoundmanagers" then the game closes, i use ubuntu 18.04
Does it work without my patch?
This patch was a long shot anyway.
i tried replacing the dsound.dll from the compiled patched wine to my current wine-staging system32 folder then running the game didn't give "This game failed to generate directsoundmanagers" , but it also hanged. to make sure that it uses the new .dll i added a TRACE line in the modified function.
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #15 from bugged2 bugged234@mail.com --- Created attachment 67003 --> https://bugs.winehq.org/attachment.cgi?id=67003 contains log for both the game hanging and not hanging
still hangs on wine 5.6
however i managed to get more info
looks like the game hangs when it tries to change the current playing background music
i tried renaming the background music file of both the affected area (BGM3) and that of the area right before it (BGM1)
renaming BGM1 then launching the game makes the game complain about missing background music file when accessing the area , but doesn't hang the game in the affected area renaming BGM3 then launching the game , proceeding to the affected area sometimes causes the game to hang (before even complaining about missing background music file) & sometimes not (and in this case ist complains about the missing file)
i believe the 2nd case also happens without renaming BGM3 , which would explain those rare cases where the game doesn't hang
anyway i managed to capture a WINEDEBUG=+tid,+seh,+mmdevapi,+winmm,+driver,+msacm,+midi,+dsound,+dsound3d,+xaudio2,+xapofx,+dmusic,+mci,+pulse,+oss,+alsa,+coreaudio,+timestamp log file for 1 - renaming BGM1 , and no hang 2 - renaming BGM3 , and no hang 3 - renaming BGM3 and hang
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #16 from bugged2 bugged234@mail.com --- Created attachment 67572 --> https://bugs.winehq.org/attachment.cgi?id=67572 lcsebody_assembly
What happens is that the game gets stuck in "WaitForSingleObject".
i found it by debugging the game in win 7 , where i copied wine's dsound.dll to the game folder then running the debugger.
the game executes the following instructions
mov ecx, [ecx+ebx*4] Breakpoint1
call sub_401C5D
the game gets stuck inside sub_401C5D where sub_401C5D is direct jump to sub_40CE60
sub_40CE60 contains the following : /*some code */ add edi, 4 dec ebp jnz short loc_40CE9F mov eax, [esi+34h] cmp eax, ebx jz short loc_40CECC push 0FFFFFFFFh ; dwMilliseconds push eax ; hHandle call ds:WaitForSingleObject // Stuck here mov edx, [esi+34h] /* some code */
when there is no active BGM , both eax and ebx are zero , so "WaitForSingleObject" doesn't get executed
however when there is a current active BGM , eax is 1 . ***** Note when i activate the Breakpoint1 and then resume the breakpoint , the game doesn't get stuck , it enters WaitForSingleObject and returns back from it.
i have attached a file which contains a bit more instructions
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #17 from bugged2 bugged234@mail.com --- Created attachment 67609 --> https://bugs.winehq.org/attachment.cgi?id=67609 the logs around the time IDirectSoundBufferImpl was called for both cases
After further debugging , i found that sub_401550 ends up calling IDirectSoundBufferImpl_Stop sub_401C5D ends up calling IDirectSoundBufferImpl_GetStatus
when there is a breakpoint between them , the game proceeds normally , though when trying to intensify the tracing the game hangs even if there is a breakpoint.
now , i tried launching the game various times , while applying "WINEDEBUG=+seh,+dsound,+server" , i managed to record the log for both cases (without renaming any file)
i've attached the logs around the time where IDirectSoundBufferImpl_Stop was called
please tell me if other logs are required
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #18 from bugged2 bugged234@mail.com --- though i am not 100% sure , but looking at few logs for both cases i can see a common pattern. when the game hangs , it signals to an already closed handle (invalid handle) 0009:trace:dsound:IDirectSoundBufferImpl_Stop (009DAE98) 0009:trace:dsound:IDirectSoundBufferImpl_GetStatus (009DAE98,0032FDD0) 0009:trace:dsound:IDirectSoundBufferImpl_GetStatus status=0 0009: close_handle( handle=00d4 ) 0009: close_handle() = 0 0009: close_handle( handle=00d8 ) 0009: close_handle() = 0 0009: close_handle( handle=00dc ) ///*** the handle was closed here 0009: close_handle() = 0 0009: select( flags=2, cookie=0032f92c, timeout=infinite, prev_apc=0000, result={}, data={WAIT,handles={00e0}} ) 0009: select() = PENDING { call={APC_NONE}, apc_handle=0000 } 002d: event_op( handle=00a4, op=1 ) 002e: *wakeup* signaled=0 002d: event_op() = 0 { state=0 } 002e:trace:dsound:DSOUND_PerformMix (009C1E28) 002e:trace:dsound:DSOUND_MixToPrimary (frames 480) 002e:trace:dsound:DSOUND_MixToPrimary MixToPrimary for 009DAE98, state=3 002e:trace:dsound:DSOUND_MixToPrimary Checking 009DAE98, frames=480 002e:trace:dsound:DSOUND_CheckEvent Stopped... 002e:trace:dsound:DSOUND_CheckEvent Signalling 000000DC //*** signals here 002e: event_op( handle=00dc, op=1 ) 002e: event_op() = INVALID_HANDLE { state=0 }
while when the game doesn't hang
0009:trace:dsound:IDirectSoundBufferImpl_Stop (009DB378) 0031: event_op( handle=00a8, op=1 ) 0032: *wakeup* signaled=0 0009:trace:dsound:IDirectSoundBufferImpl_GetStatus (009DB378,0032FDD0) 0009:trace:dsound:IDirectSoundBufferImpl_GetStatus status=0 0031: event_op() = 0 { state=0 } 0009: close_handle( handle=00d8 ) 0009: close_handle() = 0 0032:trace:dsound:DSOUND_PerformMix (009C2338) 0032:trace:dsound:DSOUND_MixToPrimary (frames 480) 0032:trace:dsound:DSOUND_MixToPrimary MixToPrimary for 009DB378, state=3 0032:trace:dsound:DSOUND_MixToPrimary Checking 009DB378, frames=480 0032:trace:dsound:DSOUND_CheckEvent Stopped... 0032:trace:dsound:DSOUND_CheckEvent Signalling 000000E0 ///*** signals here 0009: close_handle( handle=00dc ) 0009: close_handle() = 0 0032: event_op( handle=00e0, op=1 ) 0034: *wakeup* signaled=2 0032: event_op() = 0 { state=0 } 0009: close_handle( handle=00e0 ) ///*** closes here 0009: close_handle() = 0
https://bugs.winehq.org/show_bug.cgi?id=41292
castaneai castaneai@castaneai.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |castaneai@castaneai.net
--- Comment #19 from castaneai castaneai@castaneai.net --- I have sent a patch for this bug. Thanks buggeed2.
https://www.winehq.org/pipermail/wine-devel/2021-June/188339.html
https://bugs.winehq.org/show_bug.cgi?id=41292
--- Comment #20 from bugged2 bugged234@mail.com --- (In reply to castaneai from comment #19)
I have sent a patch for this bug. Thanks buggeed2.
https://www.winehq.org/pipermail/wine-devel/2021-June/188339.html
This patch fixed the problem thank you
https://bugs.winehq.org/show_bug.cgi?id=41292
Vijay Kamuju infyquest@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |infyquest@gmail.com Resolution|--- |FIXED Fixed by SHA1| |8116d4e11cd11ba466c1cd92a6a | |81ca015e230e0
--- Comment #21 from Vijay Kamuju infyquest@gmail.com --- Fix committed https://source.winehq.org/git/wine.git/commitdiff/8116d4e11cd11ba466c1cd92a6...
https://bugs.winehq.org/show_bug.cgi?id=41292
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #22 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.11.
https://bugs.winehq.org/show_bug.cgi?id=41292
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |6.0.x
https://bugs.winehq.org/show_bug.cgi?id=41292
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|6.0.x |---
--- Comment #23 from Michael Stefaniuc mstefani@winehq.org --- Removing the 6.0.x milestone from bug fixes included in 6.0.3.