[Bug 2905] Kings Quest 8 crashes while loading a saved game

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Apr 27 10:01:18 CDT 2011


http://bugs.winehq.org/show_bug.cgi?id=2905

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |focht at gmx.net
          Component|-unknown                    |directx-ddraw
            Version|unspecified                 |20050419

--- Comment #19 from Anastasius Focht <focht at gmx.net> 2011-04-27 10:01:16 CDT ---
Hello,

--- quote ---
Crashes for me on start in 1.3.17.
--- quote ---

yep, there is an initial crash preventing the game to load which needs to be
fixed first.

IDirect3D3::EnumDevices calls the app supplied callback two times.

It seems the game doesn't like IID_IDirect3DRGBDevice and resets some internal
data structures - one of them is a pointer to an internal device string
"D3D-display".
When the enumeration callback is called a second time for
IID_IDirect3DHALDevice, the app code tries to do some search/replace on that
string - but the pointer member was reset by the first callback call (NULL).

--- snip dlls/ddraw/ddraw.c ---
static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface,
LPD3DENUMDEVICESCALLBACK callback, void *context)
{
    static CHAR wined3d_description[] = "Wine D3DDevice using WineD3D and
OpenGL";

    IDirectDrawImpl *This = impl_from_IDirect3D3(iface);
    D3DDEVICEDESC device_desc1, hal_desc, hel_desc;
    D3DDEVICEDESC7 device_desc7;
    HRESULT hr; 
...
    if (This->d3dversion != 1)
    {
        static CHAR reference_description[] = "RGB Direct3D emulation";

        TRACE("Enumerating WineD3D D3DDevice interface.\n");
        hal_desc = device_desc1;
        hel_desc = device_desc1;
        /* The rgb device has the pow2 flag set in the hel caps, but not in the
hal caps. */
        hal_desc.dpcLineCaps.dwTextureCaps &= ~(D3DPTEXTURECAPS_POW2
                | D3DPTEXTURECAPS_NONPOW2CONDITIONAL |
D3DPTEXTURECAPS_PERSPECTIVE);
        hal_desc.dpcTriCaps.dwTextureCaps &= ~(D3DPTEXTURECAPS_POW2
                | D3DPTEXTURECAPS_NONPOW2CONDITIONAL |
D3DPTEXTURECAPS_PERSPECTIVE);
        hr = callback((GUID *)&IID_IDirect3DRGBDevice, reference_description,
                device_name, &hal_desc, &hel_desc, context);
        if (hr != D3DENUMRET_OK)
        {
            TRACE("Application cancelled the enumeration.\n");
            LeaveCriticalSection(&ddraw_cs);
            return D3D_OK;
        }
    } 
...
  TRACE("Enumerating HAL Direct3D device.\n");
    hal_desc = device_desc1;
    hel_desc = device_desc1;
    /* The hal device does not have the pow2 flag set in hel, but in hal. */
    hel_desc.dpcLineCaps.dwTextureCaps &= ~(D3DPTEXTURECAPS_POW2
            | D3DPTEXTURECAPS_NONPOW2CONDITIONAL |
D3DPTEXTURECAPS_PERSPECTIVE);
    hel_desc.dpcTriCaps.dwTextureCaps &= ~(D3DPTEXTURECAPS_POW2
            | D3DPTEXTURECAPS_NONPOW2CONDITIONAL |
D3DPTEXTURECAPS_PERSPECTIVE);
    hr = callback((GUID *)&IID_IDirect3DHALDevice, wined3d_description,
            device_name, &hal_desc, &hel_desc, context);
    if (hr != D3DENUMRET_OK)
    {
        TRACE("Application cancelled the enumeration.\n");
        LeaveCriticalSection(&ddraw_cs);
        return D3D_OK;
    } 
    TRACE("End of enumeration.\n");

    LeaveCriticalSection(&ddraw_cs);
    return D3D_OK;
} 
--- snip dlls/ddraw/ddraw.c ---

If you reverse the order of callback calls (IID_IDirect3DHALDevice first,
IID_IDirect3DRGBDevice second), the game starts successfully and seems playable
again.
Though it crashes at exit (which seems to be another bug) and the load savegame
bug of course.

Regards

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list