[Bug 9665] Mask of eternity crashes at startup

wine-bugs at winehq.org wine-bugs at winehq.org
Mon Sep 17 09:15:02 CDT 2007


--- Comment #14 from Martin Sand <deadlock at start.no>  2007-09-17 09:15:02 ---
Created an attachment (id=8117)
 --> (http://bugs.winehq.org/attachment.cgi?id=8117)
Patch to fix the bug which causes this to happen

apply with "git apply ddraw_kq_crash_fix.diff" to the latest git/cvs, since
it's the latest git version I used. The code should be pretty much the same in
earlier versions(down to the one mentioned in this bug report), though.

After debugging some more, I realized that the crash occurs when the function
is done with the if(This->d3dversion != 1) {...} function and continues on to
do the code below, because if(hr != D3DENUMRET_OK) is not applicable(hr is
equal to D3DENUMRET_OK). If it was applicable, the function would have returned

Anyway, after that, the function tries to get d1 to be equal to dref. This
deletes the result of what the if() above did(resulting in that d1 no longer
contains any usable data). Since the function doesn't add any new data to d1
after that, the game crashes when the Callback() function is called, because
it(the Callback function of the game) expects something usable to still be in
d1. I am not sure if official specifications of DirectDraw says that d1 is
supposed to still contain something usable when the Callback is called for the
second time, but at least that's what this game expects to happen.

What I did was, I commented out the code in two places where d1 and d2 is made
to be equal to dref. Instead I moved d1 = dref; and d2 = dref; above the if().
This seems to work for me. Just for safety, I left the declarations in,
commented out.

If anybody could have a look at this patch and try it out, to see if it causes
any other problems or perhaps they have any other reason for why this won't
work, please feel free to comment away.

Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.

More information about the wine-bugs mailing list