http://bugs.winehq.org/show_bug.cgi?id=11716
Summary: star wars battlefront regression Product: Wine Version: unspecified Platform: Other OS/Version: other Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-dsound AssignedTo: wine-bugs@winehq.org ReportedBy: ajw1980@gmail.com
Created an attachment (id=10942) --> (http://bugs.winehq.org/attachment.cgi?id=10942) battlefront pagefault output
There is a regression in star wars battlefront that causes a page fault. I'll attach the output. I did a bisect and traced it to this:
2a117a20176815b3b8e52c0e4b56a40c4e41e74d is first bad commit commit 2a117a20176815b3b8e52c0e4b56a40c4e41e74d Author: Maarten Lankhorst maarten@codeweavers.com Date: Mon Nov 5 23:23:11 2007 +0100
dsound: Add support for WAVEFORMATEXTENSIBLE format.
:040000 040000 c15e15dea6363c9afea9cc1b16aedfe9d68aacab 30550b00f81d89f2aac88946e5d3a5bfd48d02fd M dlls
http://bugs.winehq.org/show_bug.cgi?id=11716
James Hawkins truiken@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |regression Summary|star wars battlefront |star wars battlefront |regression |crashes
http://bugs.winehq.org/show_bug.cgi?id=11716
Lei Zhang thestig@google.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #10942|application/octet-stream |text/plain mime type| |
http://bugs.winehq.org/show_bug.cgi?id=11716
--- Comment #1 from Austin English austinenglish@gmail.com 2008-02-26 00:30:22 --- Is there a demo of this showing the same problem?
http://bugs.winehq.org/show_bug.cgi?id=11716
--- Comment #2 from Andy Wettstein ajw1980@gmail.com 2008-02-26 07:57:12 --- (In reply to comment #1)
Is there a demo of this showing the same problem?
It doesn't appear that a demo of this game was ever released.
http://bugs.winehq.org/show_bug.cgi?id=11716
Timo-Heikki Mäkelä imaxfun@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |m.b.lankhorst@gmail.com
--- Comment #3 from Timo-Heikki Mäkelä imaxfun@gmail.com 2008-03-06 22:32:09 --- Adding Maarten to CC
http://bugs.winehq.org/show_bug.cgi?id=11716
Andy Wettstein ajw1980@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|star wars battlefront |star wars battlefront |crashes |crashes with sound enabled
--- Comment #4 from Andy Wettstein ajw1980@gmail.com 2008-03-07 07:38:44 --- I tested on 0.9.55 with "battlefront.exe /nosound" and it doesn't crash, so I'm pretty sure it is a dsound problem.
http://bugs.winehq.org/show_bug.cgi?id=11716
Lei Zhang thestig@google.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |0.9.49.
http://bugs.winehq.org/show_bug.cgi?id=11716
--- Comment #5 from Maarten Lankhorst m.b.lankhorst@gmail.com 2008-07-11 12:56:57 --- Does it crash in wine code? If yes can you attach a backtrace as attachment?
http://bugs.winehq.org/show_bug.cgi?id=11716
--- Comment #6 from Andy Wettstein ajw1980@gmail.com 2008-07-12 08:07:28 --- How would I know if the crash is in wine code? And what do I need to do to create a backtrace if it is.
http://bugs.winehq.org/show_bug.cgi?id=11716
--- Comment #7 from Jesse Allen the3dfxdude@gmail.com 2008-12-21 13:21:12 --- Created an attachment (id=18108) --> (http://bugs.winehq.org/attachment.cgi?id=18108) reverses dsound change for 1.1.11
I cannot not compile the old git tree with the change at this time. I reversed the changes in 1.1.11 and can confirm the regression. As far as the question maarten asked, the crash is in the game code. I will look into the reason for the crash further.
http://bugs.winehq.org/show_bug.cgi?id=11716
--- Comment #8 from Jesse Allen the3dfxdude@gmail.com 2008-12-21 22:02:58 --- Created an attachment (id=18115) --> (http://bugs.winehq.org/attachment.cgi?id=18115) Potential Format Checking Fix
Problem area: if (pwfxe->Format.cbSize > (sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX))) { WARN("Too big a cbSize %u\n", pwfxe->Format.cbSize); return DSERR_CONTROLUNAVAIL; }
if (!IsEqualGUID(&pwfxe->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM))
The game uses WAVEFORMATEXTENSIBLE with the SubFormat KSDATAFORMAT_SUBTYPE_PCM. However for whatever reason, the size is not expected with this type of subformat. cbSize is bigger than "sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX)", and then the return is not handled properly causing a crash.
Looking at the dsound tests, there are actually no tests with KSDATAFORMAT_SUBTYPE_PCM explicit (correct me if wrong). Therefore I think the size check "sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX)" might be a little misleading when actually dealing with subformats. More tests might need to be done.
So the code for WAVEFORMATEXTENSIBLE in CreateSoundBuffer checks the cbSize before it even looks at the SubFormat. My feeling is that if we are going to use the special formats, then we ought to know what the SubFormat is before any size check. Therefore I rearranged the code so the SubFormat check is first, but also still attempt to do a size check. This is the best compromise I can see without diving deeper into handling more formats. This still passes the same dsound tests.
http://bugs.winehq.org/show_bug.cgi?id=11716
Jesse Allen the3dfxdude@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |patch
--- Comment #9 from Jesse Allen the3dfxdude@gmail.com 2008-12-21 22:06:04 --- Note when I say "dsound tests" I mean the dsound test program of the wine test suite.
http://bugs.winehq.org/show_bug.cgi?id=11716
donkyhotay donkjunk@softhome.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |donkjunk@softhome.net
--- Comment #10 from donkyhotay donkjunk@softhome.net 2009-02-06 11:47:26 --- I've been trying to fix a similar problem with another game (homeworld http://bugs.winehq.org/show_bug.cgi?id=11986) and although I don't have starwars battlefront I was interested in trying to use jesse allen's potential format fix as a solution to the problem I'm having with homeworld. Although I'm pretty familiar with compiling source code from git (and have compiled wine before) I'm not very familiar with the wine patching process. What exactly do I need to do to apply the patch posted above to the wine source code? Do I just do a save link as and then patch -p1 < name.patch in my wine directory or is there a different process instead?
http://bugs.winehq.org/show_bug.cgi?id=11716
--- Comment #11 from donkyhotay donkjunk@softhome.net 2009-02-07 01:33:57 --- I figured out the patching thing and tried it out. While I don't have starwars battlefront I was able to confirm there was no change with homeworld.
http://bugs.winehq.org/show_bug.cgi?id=11716
Jesse Allen the3dfxdude@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #18115|0 |1 is obsolete| |
http://bugs.winehq.org/show_bug.cgi?id=11716
--- Comment #12 from Jesse Allen the3dfxdude@gmail.com 2009-04-19 20:39:54 --- Created an attachment (id=20563) --> (http://bugs.winehq.org/attachment.cgi?id=20563) Fix with test cases
http://bugs.winehq.org/show_bug.cgi?id=11716
Jesse Allen the3dfxdude@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #13 from Jesse Allen the3dfxdude@gmail.com 2009-04-21 12:56:41 --- Patch accepted
commit b7f6c1e1031e34fefbf1ece44ac8a2f007acb31c Author: Jesse Allen the3dfxdude@gmail.com Date: Mon Apr 20 21:41:21 2009 -0700
dsound: Allow a special cbSize case in CreateSoundBuffer.
http://bugs.winehq.org/show_bug.cgi?id=11716
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #14 from Alexandre Julliard julliard@winehq.org 2009-04-24 12:01:59 --- Closing bugs fixed in 1.1.20.