ddraw/main.c patch

Ove Kaaven ovehk at ping.uio.no
Mon Apr 16 17:59:41 CDT 2001


This diff is manually edited to remove most of the 3D stuff and leave the
2D stuff, but ought to apply cleanly (tested with patch --dry-run)...

Log:
Ove Kaaven <ovek at transgaming.com>
Fill in some of the ddraw HAL fields.
Call the set_exclusive_mode callback when necessary.
Added a Main_DirectDraw_GetCaps method.
Removed references to obsolete DIBTexture surface class.

Index: wine/dlls/ddraw/ddraw/main.c
diff -u wine/dlls/ddraw/ddraw/main.c:1.1.1.6 wine/dlls/ddraw/ddraw/main.c:1.34
--- wine/dlls/ddraw/ddraw/main.c:1.1.1.6	Fri Mar  2 03:32:04 2001
+++ wine/dlls/ddraw/ddraw/main.c	Mon Apr  9 08:24:02 2001
@@ -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 +32,6 @@
 #include "dsurface/main.h"
 #include "dsurface/dib.h"
 #include "dsurface/fakezbuffer.h"
-#include "dsurface/dibtexture.h"
 
 DEFAULT_DEBUG_CHANNEL(ddraw);
 
@@ -54,6 +58,9 @@
     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 +106,12 @@
     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 +303,7 @@
 {
     assert(pOuter == NULL);
 
-    return DIBTexture_DirectDrawSurface_Create(This, pDDSD, ppSurf, pOuter);
+    return DIB_DirectDrawSurface_Create(This, pDDSD, ppSurf, pOuter);
 }
 
 HRESULT
@@ -312,6 +366,7 @@
 	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 +817,19 @@
     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 +958,26 @@
     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);
Index: wine/dlls/ddraw/ddraw/main.h
diff -u wine/dlls/ddraw/ddraw/main.h:1.1.1.1 wine/dlls/ddraw/ddraw/main.h:1.7
--- wine/dlls/ddraw/ddraw/main.h:1.1.1.1	Thu Jan  4 23:58:30 2001
+++ wine/dlls/ddraw/ddraw/main.h	Mon Apr  9 07:21:30 2001
@@ -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_RemoveClipper(IDirectDrawImpl* This,
 				   IDirectDrawClipperImpl* clipper);
 void Main_DirectDraw_AddPalette(IDirectDrawImpl* This,
-				IDirectDrawPaletteImpl* surface);
+				IDirectDrawPaletteImpl* palette);
 void Main_DirectDraw_RemovePalette(IDirectDrawImpl* This,
 				   IDirectDrawPaletteImpl* palette);
 
@@ -62,6 +62,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);





More information about the wine-patches mailing list