Commit 329d017d authored by Oliver Stieber's avatar Oliver Stieber Committed by Alexandre Julliard

Start to implement TestCooperativeLevel.

parent 5173234e
......@@ -5844,8 +5844,27 @@ BOOL WINAPI IWineD3DDeviceImpl_ShowCursor(IWineD3DDevice* iface, BOOL bShow
HRESULT WINAPI IWineD3DDeviceImpl_TestCooperativeLevel(IWineD3DDevice* iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
FIXME("(%p) : stub\n", This); /* No way of notifying yet! */
return D3D_OK;
TRACE("(%p) : state (%lu)\n", This, This->state);
/* TODO: Implement wrapping of the WndProc so that mimimize and maxamise can be monitored and the states adjusted. */
switch (This->state) {
case D3D_OK:
return D3D_OK;
case D3DERR_DEVICELOST:
{
ResourceList *resourceList = This->resources;
while (NULL != resourceList) {
if (((IWineD3DResourceImpl *)resourceList->resource)->resource.pool == D3DPOOL_DEFAULT /* TODO: IWineD3DResource_GetPool(resourceList->resource)*/)
return D3DERR_DEVICENOTRESET;
resourceList = resourceList->next;
}
return D3DERR_DEVICELOST;
}
case D3DERR_DRIVERINTERNALERROR:
return D3DERR_DRIVERINTERNALERROR;
}
/* Unknown state */
return D3DERR_DRIVERINTERNALERROR;
}
......
......@@ -1639,6 +1639,9 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
IWineD3D_AddRef(object->wineD3D);
object->parent = parent;
/* Set the state up as invalid until the device is fully created */
object->state = D3DERR_DRIVERINTERNALERROR;
TRACE("(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)\n", This, Adapter, DeviceType,
hFocusWindow, BehaviourFlags, pPresentationParameters, ppReturnedDeviceInterface);
TRACE("(%p)->(DepthStencil:(%u,%s), BackBufferFormat:(%u,%s))\n", This,
......@@ -1736,8 +1739,15 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
}
/* set the state of the device to valid */
object->state = D3D_OK;
return D3D_OK;
create_device_error:
/* Set the device state to error */
object->state = D3DERR_DRIVERINTERNALERROR;
if (object->updateStateBlock != NULL) {
IWineD3DStateBlock_Release((IWineD3DStateBlock *)object->updateStateBlock);
object->updateStateBlock = NULL;
......
......@@ -536,6 +536,9 @@ typedef struct IWineD3DDeviceImpl
/* Debug stream management */
BOOL debug;
/* Device state management */
HRESULT state;
/* Screen buffer resources */
glContext contextCache[CONTEXT_CACHE];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment