From fb0192236b182b8e83808d4a9029dfbba80c9907 Mon Sep 17 00:00:00 2001
From: Marcus Meissner <marcus@jet.franken.de>
Date: Sun, 14 Feb 1999 09:25:37 +0000
Subject: [PATCH] Some ddraw/d3d bugfixes, updated Diablo/WC4 ddraw status.

---
 documentation/status/directdraw | 38 +++++++++++++++++----------------
 graphics/d3dviewport.c          |  4 ++--
 graphics/ddraw.c                |  9 ++++++++
 include/d3d.h                   | 15 ++++++-------
 multimedia/dplay.c              |  2 +-
 5 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/documentation/status/directdraw b/documentation/status/directdraw
index ae69d70f444..02752b1d5c2 100644
--- a/documentation/status/directdraw
+++ b/documentation/status/directdraw
@@ -6,17 +6,20 @@ layer is represented by the functions in the Win32 DLL ddraw.dll and the
 IDirectDraw* interfaces (that can be created using the API functions). 
 
 WINE currently implements a very basic set of the DirectDraw functionality
-in graphics/ddraw.c. This implementation uses the XFree86-DGA extension 
+in graphics/ddraw.c. This implementation uses either the XFree86-DGA extension 
 to get very fast access to the graphics card framebuffer and doublebuffering
-features. It is as fast as the MS equivalent for the stuff that is implemented.
+features or Xlib, which is slower.
+The implementation using XFree86-DGA is as fast as the MS equivalent for the
+stuff that is implemented.
+
 Several applications already work, see below.
 Problems of the implementation using XFree86-DGA:
 
-	- XFree86 cannot switch resolution nor depth on the fly.
+	- XFree86 cannot switch depth on the fly.
 	  This is a problem with X and unavoidable.
 	  Current solution is to pop up a MessageBox with an error for 
 	  mismatched parameters and advice the user to restart the X server
-	  with the specified depth and/or screensize.
+	  with the specified depth.
 	- The rest of the functionality that has to be implemented will have
 	  to be done in software and will be very slow.
 	- This requires WINE to be run as root user so XF86DGA can mmap the
@@ -25,10 +28,7 @@ Problems of the implementation using XFree86-DGA:
 
 Status:
    - Diablo [640x480x8]:
-     The movies play with speed comparable to the MS DDRAW one.
-     The game doesn't work, it somehow tries to write into 2 lines _BEFORE_
-     the start of the surface. I have tried to investigate this, but it is
-     in code that is automatically generated.
+     No longer works. Unclear why. [WINE-990131, Marcus Meissner]
   
    - WingCommander 4 / Win95 Patch [640x480x8]:
      The intromovie plays, in 8 bit mode (to reconfigure wc4, run wine
@@ -36,23 +36,25 @@ Status:
      this is due to the unusual colorweight (565 rgb) of the Mystique in 16bit
      mode. [Specifying it in DDPIXELFORMAT didn't help.]
 
-     Requires to be run in 640x480xdepth mode (doesn't seem to heed
-     DDSURFACEDESC.lPitch).
-     You can even fly the first mission with Maniac (ignore the weird sounds),
-     but it crashes as soon as you arrive at Blue Point Station...
-  
+     Keyboard input does not work. This seems to be a problem with the 
+     cooperative window and USER input handling in general.
+
+     -> Unable to test Gameplay.
+
+     The display is slower as before. Reason is unknown, but I suspect the 
+     communication between winserver,dsoundmixerthread,mainthread takes
+     up too much time.
+
+     [WINE-990131, Marcus Meissner]
+
    - Monkey Island 3 [640x480x8]:
-     WINE-CVS-981116: 
+     WINE-CVS-981116:
      	Works, using DGA and Xlib. (Mousecontrol is a bit off in windowed mode.)
    
    - DiscWorld 2 [640x480x8]:
      Plays through nearly all intro movies. Sound and animation skip a lot of
      stuff (possible DirectSound asynchronization problem).
    
-   - XvT [640x480x16]:
-     Shows the splash screen, then fails with missing Joystick. I have
-     investigated but failed to find a reason for this.
-  
    - Tomb Raider 2 Demo (using 8 bit renderer) [640x480x8]:
      I have played nearly all of the DEMO level using Keyboard Controls.
      Sound is a bit weird. Keyboard/Mouse handling too due to incomplete
diff --git a/graphics/d3dviewport.c b/graphics/d3dviewport.c
index 654773d41f7..da90c8ecc5c 100644
--- a/graphics/d3dviewport.c
+++ b/graphics/d3dviewport.c
@@ -194,7 +194,7 @@ static HRESULT WINAPI IDirect3DViewport2_SetBackground(LPDIRECT3DVIEWPORT2 this,
 
 static HRESULT WINAPI IDirect3DViewport2_GetBackground(LPDIRECT3DVIEWPORT2 this,
 						       LPD3DMATERIALHANDLE lphMat,
-						       LPBOOL lpValid)
+						       LPBOOL32 lpValid)
 {
   FIXME(ddraw, "(%p)->(%p,%p): stub\n", this, lphMat, lpValid);
   
@@ -211,7 +211,7 @@ static HRESULT WINAPI IDirect3DViewport2_SetBackgroundDepth(LPDIRECT3DVIEWPORT2
 
 static HRESULT WINAPI IDirect3DViewport2_GetBackgroundDepth(LPDIRECT3DVIEWPORT2 this,
 							    LPDIRECTDRAWSURFACE* lplpDDSurface,
-							    LPBOOL lpValid)
+							    LPBOOL32 lpValid)
 {
   FIXME(ddraw, "(%p)->(%p,%p): stub\n", this, lplpDDSurface, lpValid);
   
diff --git a/graphics/ddraw.c b/graphics/ddraw.c
index 2fcde7f1f80..fdf2f968002 100644
--- a/graphics/ddraw.c
+++ b/graphics/ddraw.c
@@ -402,6 +402,15 @@ static int _getpixelformat(LPDIRECTDRAW2 ddraw,LPDDPIXELFORMAT pf) {
 		pf->xy.dwRGBAlphaBitMask= 0;
 		return 0;
 	}
+	if (ddraw->d.depth==24) {
+		pf->dwFlags       	= DDPF_RGB;
+		pf->x.dwRGBBitCount	= 24;
+		pf->y.dwRBitMask	= vi[0].red_mask;
+		pf->z.dwGBitMask	= vi[0].green_mask;
+		pf->xx.dwBBitMask	= vi[0].blue_mask;
+		pf->xy.dwRGBAlphaBitMask= 0;
+		return 0;
+	}
 	FIXME(ddraw,"_getpixelformat:unknown depth %ld?\n",ddraw->d.depth);
 	return DDERR_GENERIC;
 }
diff --git a/include/d3d.h b/include/d3d.h
index 2fd64985eee..18306a6c94e 100644
--- a/include/d3d.h
+++ b/include/d3d.h
@@ -6,9 +6,6 @@
 /* This is needed for GL_LIGHT */
 #include "wine_gl.h"
 
-typedef BOOL32 *LPBOOL;
-typedef BOOL32 BOOL;
-
 DEFINE_GUID(IID_IDirect3D,		0x3BBA0080,0x2421,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 );
 DEFINE_GUID(IID_IDirect3D2,		0x6aae1ec1,0x662a,0x11d0,0x88,0x9d,0x00,0xaa,0x00,0xbb,0xb7,0x6a);
 
@@ -1109,7 +1106,7 @@ typedef struct _D3DTEXTURELOAD {
 typedef struct _D3DBRANCH { 
   DWORD dwMask; 
   DWORD dwValue; 
-  BOOL  bNegate; 
+  BOOL32  bNegate; 
   DWORD dwOffset; 
 } D3DBRANCH, *LPD3DBRANCH; 
 
@@ -1347,9 +1344,9 @@ typedef struct IDirect3Viewport_VTable {
   STDMETHOD(TransformVertices) (THIS_ DWORD, LPD3DTRANSFORMDATA, DWORD, LPDWORD) PURE;
   STDMETHOD(LightElements) (THIS_ DWORD, LPD3DLIGHTDATA) PURE;
   STDMETHOD(SetBackground) (THIS_ D3DMATERIALHANDLE) PURE;
-  STDMETHOD(GetBackground) (THIS_ LPD3DMATERIALHANDLE, LPBOOL) PURE;
+  STDMETHOD(GetBackground) (THIS_ LPD3DMATERIALHANDLE, LPBOOL32) PURE;
   STDMETHOD(SetBackgroundDepth) (THIS_ LPDIRECTDRAWSURFACE) PURE;
-  STDMETHOD(GetBackgroundDepth) (THIS_ LPDIRECTDRAWSURFACE*, LPBOOL) PURE;
+  STDMETHOD(GetBackgroundDepth) (THIS_ LPDIRECTDRAWSURFACE*, LPBOOL32) PURE;
   STDMETHOD(Clear) (THIS_ DWORD, LPD3DRECT, DWORD) PURE;
   STDMETHOD(AddLight) (THIS_ LPDIRECT3DLIGHT) PURE;
   STDMETHOD(DeleteLight) (THIS_ LPDIRECT3DLIGHT) PURE;
@@ -1375,9 +1372,9 @@ typedef struct IDirect3Viewport2_VTable {
   STDMETHOD(TransformVertices) (THIS_ DWORD, LPD3DTRANSFORMDATA, DWORD, LPDWORD) PURE;
   STDMETHOD(LightElements) (THIS_ DWORD, LPD3DLIGHTDATA) PURE;
   STDMETHOD(SetBackground) (THIS_ D3DMATERIALHANDLE) PURE;
-  STDMETHOD(GetBackground) (THIS_ LPD3DMATERIALHANDLE, LPBOOL) PURE;
+  STDMETHOD(GetBackground) (THIS_ LPD3DMATERIALHANDLE, LPBOOL32) PURE;
   STDMETHOD(SetBackgroundDepth) (THIS_ LPDIRECTDRAWSURFACE) PURE;
-  STDMETHOD(GetBackgroundDepth) (THIS_ LPDIRECTDRAWSURFACE*, LPBOOL) PURE;
+  STDMETHOD(GetBackgroundDepth) (THIS_ LPDIRECTDRAWSURFACE*, LPBOOL32) PURE;
   STDMETHOD(Clear) (THIS_ DWORD, LPD3DRECT, DWORD) PURE;
   STDMETHOD(AddLight) (THIS_ LPDIRECT3DLIGHT) PURE;
   STDMETHOD(DeleteLight) (THIS_ LPDIRECT3DLIGHT) PURE;
@@ -1459,7 +1456,7 @@ struct IDirect3DExecuteBuffer {
 
   /* This flags is set to TRUE if we allocated ourselves the
      data buffer */
-  BOOL need_free;
+  BOOL32 need_free;
 
   void (*execute)(LPDIRECT3DEXECUTEBUFFER this,
 		  LPDIRECT3DDEVICE dev,
diff --git a/multimedia/dplay.c b/multimedia/dplay.c
index 7d180aa7ca5..f92bcf55a84 100644
--- a/multimedia/dplay.c
+++ b/multimedia/dplay.c
@@ -415,7 +415,7 @@ static HRESULT WINAPI IDirectPlayLobby2W_Connect
      return DPERR_INVALIDPARAMS;
   }
 
-  if( ( createRC = DirectPlayCreate( &IID_IDirectPlayLobby2, lplpDP, pUnk ) ) != DP_OK )
+  if( ( createRC = DirectPlayCreate( (LPGUID)&IID_IDirectPlayLobby2, lplpDP, pUnk ) ) != DP_OK )
   {
      ERR( dplay, "error creating Direct Play 2W interface. Return Code = %ld.\n", createRC );
      return createRC;
-- 
GitLab