diff --git a/dlls/ddraw/ddraw/main.c b/dlls/ddraw/ddraw/main.c index 7d8da3c0e33..99c6a8f7506 100644 --- a/dlls/ddraw/ddraw/main.c +++ b/dlls/ddraw/ddraw/main.c @@ -2,7 +2,7 @@ * * Copyright 1997-2000 Marcus Meissner * Copyright 1998-2000 Lionel Ulmer (most of Direct3D stuff) - * Copyright 2000 TransGaming Technologies Inc. + * Copyright 2000-2001 TransGaming Technologies Inc. */ /* @@ -30,7 +30,6 @@ #include "dsurface/main.h" #include "dsurface/dib.h" #include "dsurface/fakezbuffer.h" -#include "dsurface/dibtexture.h" DEFAULT_DEBUG_CHANNEL(ddraw); @@ -54,6 +53,9 @@ HRESULT Main_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex) This->ref = 1; This->ex = ex; + if (ex) This->local.dwLocalFlags |= DDRAWILCL_DIRECTDRAW7; + This->local.dwProcessId = GetCurrentProcessId(); + This->final_release = Main_DirectDraw_final_release; This->create_palette = Main_DirectDrawPalette_Create; @@ -84,6 +86,12 @@ void Main_DirectDraw_final_release(IDirectDrawImpl* This) Main_DirectDraw_DeleteSurfaces(This); Main_DirectDraw_DeleteClippers(This); Main_DirectDraw_DeletePalettes(This); + if (This->local.lpGbl && This->local.lpGbl->lpExclusiveOwner == &This->local) + { + This->local.lpGbl->lpExclusiveOwner = NULL; + if (This->set_exclusive_mode) + This->set_exclusive_mode(This, FALSE); + } } /* There is no Main_DirectDraw_Create. */ @@ -249,7 +257,7 @@ Main_create_texture(IDirectDrawImpl* This, const DDSURFACEDESC2* pDDSD, { assert(pOuter == NULL); - return DIBTexture_DirectDrawSurface_Create(This, pDDSD, ppSurf, pOuter); + return DIB_DirectDrawSurface_Create(This, pDDSD, ppSurf, pOuter); } HRESULT @@ -312,6 +320,7 @@ create_texture(IDirectDrawImpl* This, const DDSURFACEDESC2 *pDDSD, prev_mipmap = *ppSurf; IDirectDrawSurface7_AddRef(prev_mipmap); mipmap_surface_desc = ddsd; + mipmap_surface_desc.ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL; while (more_mipmaps(&mipmap_surface_desc)) { @@ -762,6 +771,19 @@ Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface) return DD_OK; } +HRESULT WINAPI +Main_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps, + LPDDCAPS pHELCaps) +{ + ICOM_THIS(IDirectDrawImpl,iface); + TRACE("(%p,%p,%p), stub\n",This,pDriverCaps,pHELCaps); + if (pDriverCaps != NULL) + DD_STRUCT_COPY_BYSIZE(pDriverCaps,&This->caps); + if (pHELCaps != NULL) + DD_STRUCT_COPY_BYSIZE(pHELCaps,&This->caps); + return DD_OK; +} + /* GetCaps */ /* GetDeviceIdentifier */ /* GetDIsplayMode */ @@ -890,6 +912,26 @@ Main_DirectDraw_SetCooperativeLevel(LPDIRECTDRAW7 iface, HWND hwnd, This->window = hwnd; This->cooperative_level = cooplevel; + This->local.hWnd = hwnd; + This->local.dwLocalFlags |= DDRAWILCL_SETCOOPCALLED; + /* not entirely sure about these */ + if (cooplevel & DDSCL_EXCLUSIVE) This->local.dwLocalFlags |= DDRAWILCL_HASEXCLUSIVEMODE; + if (cooplevel & DDSCL_FULLSCREEN) This->local.dwLocalFlags |= DDRAWILCL_ISFULLSCREEN; + if (cooplevel & DDSCL_ALLOWMODEX) This->local.dwLocalFlags |= DDRAWILCL_ALLOWMODEX; + if (cooplevel & DDSCL_MULTITHREADED) This->local.dwLocalFlags |= DDRAWILCL_MULTITHREADED; + if (cooplevel & DDSCL_FPUSETUP) This->local.dwLocalFlags |= DDRAWILCL_FPUSETUP; + if (cooplevel & DDSCL_FPUPRESERVE) This->local.dwLocalFlags |= DDRAWILCL_FPUPRESERVE; + + if (This->local.lpGbl) { + /* assume that this app is the active app (in wine, there's + * probably only one app per global ddraw object anyway) */ + if (cooplevel & DDSCL_EXCLUSIVE) This->local.lpGbl->lpExclusiveOwner = &This->local; + else if (This->local.lpGbl->lpExclusiveOwner == &This->local) + This->local.lpGbl->lpExclusiveOwner = NULL; + if (This->set_exclusive_mode) + This->set_exclusive_mode(This, (cooplevel & DDSCL_EXCLUSIVE) != 0); + } + ShowWindow(hwnd, SW_SHOW); DDRAW_SubclassWindow(This); diff --git a/dlls/ddraw/ddraw/main.h b/dlls/ddraw/ddraw/main.h index 1801d11f620..fe9413f6048 100644 --- a/dlls/ddraw/ddraw/main.h +++ b/dlls/ddraw/ddraw/main.h @@ -1,4 +1,4 @@ -/* Copyright 2000 TransGaming Technologies Inc. */ +/* Copyright 2000-2001 TransGaming Technologies Inc. */ #ifndef WINE_DDRAW_DDRAW_MAIN_H_INCLUDED #define WINE_DDRAW_DDRAW_MAIN_H_INCLUDED @@ -27,7 +27,7 @@ void Main_DirectDraw_AddClipper(IDirectDrawImpl* This, void Main_DirectDraw_RemoveClipper(IDirectDrawImpl* This, IDirectDrawClipperImpl* clipper); void Main_DirectDraw_AddPalette(IDirectDrawImpl* This, - IDirectDrawPaletteImpl* surface); + IDirectDrawPaletteImpl* palette); void Main_DirectDraw_RemovePalette(IDirectDrawImpl* This, IDirectDrawPaletteImpl* palette); @@ -63,6 +63,9 @@ HRESULT WINAPI Main_DirectDraw_EvaluateMode(LPDIRECTDRAW7 iface,DWORD a,DWORD* b); HRESULT WINAPI Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface); HRESULT WINAPI +Main_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps, + LPDDCAPS pHELCaps); +HRESULT WINAPI Main_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD pNumCodes, LPDWORD pCodes); HRESULT WINAPI