Hi Stefan, I did put together a test for this and DirectX does indeed return DDERR_INVALIDPARMS.
Here is a snippet that encapsulates what I tried:
======================== IDirectDraw * pDD = NULL; IDirectDrawSurface * pDDSPrimary = NULL; DDSURFACEDESC ddsd;
...<initialisation etc>...
memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_HEIGHT | DDSD_WIDTH; ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER; ddsd.dwHeight = 600; ddsd.dwWidth = 800; ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
hr = pDD->CreateSurface(&ddsd, &pDDSPrimary, NULL); ========================
DirectX returns DDERR_INVALIDPARAMS from CreateSurface. I have tried to recreate as much a possible the graphical situation as it would be in The Sims at this point. Fullscreen, with 800x600 video mode.
I assume that if the caller specifies DDSCAPS_ZBUFFER, the you must also specify some PIXEL format information. DDSD_PIXELFORMAT is present, but there are no format flags.
I have to admit that I am a bit of a novice when it comes to DirectX so any guidance here would be helpful. I see that the lpSurface is NULL, which I thought was an error. However, I see that this is optional if the caller wishes the system to manage the surface memory.
Any error returned by this function the Sims at this point to causes it to crash. Therefore, it seems to me that if it succeeds in Windows, it must have passed something different. If only we could see the source :D Cheers, Ralph
From: Stefan Dösinger stefandoesinger@gmx.at To: wine-devel@winehq.org; Ralph Little littlesincanada@yahoo.co.uk Sent: Tuesday, January 31, 2012 12:08:51 PM Subject: Re: Profiing windows apps
Am Dienstag, 31. Januar 2012, 17:29:23 schrieb Ralph Little:
Hi, I'm looking at bug #9672 again in the The Sims. The app crashes early on during initialisation in DirectDraw. The problem occurs after CreateSurface returns an error, since it would appear that the DDSURFACEDESC passed into the call is foobar. This would lead me to conclude that something on the lead up to that call is precipitating that rogue call.
From looking at the bug report(ddsurfacedesc.ddpfPixelFormat.dwFlags = 0) I think it's worth writing a test to see how Windows responds to the CreateSurface call before spending too much time debugging this. It is quite possible that Windows creates the surface just fine.