http://bugs.winehq.org/show_bug.cgi?id=30586
Bug #: 30586 Summary: Kings Quest 8 crashes on startup Product: Wine Version: 1.1.24 Platform: x86 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: directx-d3d AssignedTo: wine-bugs@winehq.org ReportedBy: focht@gmx.net Classification: Unclassified
Hello,
this issue is split off from bug 2905
It was first mentioned in http://bugs.winehq.org/show_bug.cgi?id=2905#c16
Copied over my analysis from: http://bugs.winehq.org/show_bug.cgi?id=2905#c19
--- 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.
--- quote ---
Regards