Author: mbosma
Date: Mon May 21 16:01:07 2007
New Revision: 26849
URL:
http://svn.reactos.org/svn/reactos?rev=26849&view=rev
Log:
Implement IDirectDraw7::EnumDisplayModes and IDirectDraw7::RestoreDisplayMode
Modified:
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/dd…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c Mon May 21 16:01:07 2007
@@ -11,6 +11,68 @@
#include "rosdraw.h"
+HRESULT WINAPI
+Main_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
+ LPDDSURFACEDESC2 pDDSD, LPVOID pContext,
LPDDENUMMODESCALLBACK2 pCallback)
+{
+ LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
+ DX_WINDBG_trace();
+
+ if(!pCallback)
+ return DDERR_INVALIDPARAMS;
+
+ // FIXME: Process DDEDM_STANDARDVGAMODES flag
+
+ int i;
+ for (i=0; i<This->lpLcl->lpGbl->dwNumModes; i++)
+ {
+ DDSURFACEDESC2 SurfaceDesc;
+
+ // FIXME: do we need to set/test more sturcture members ?
+ SurfaceDesc.dwSize = sizeof (DDSURFACEDESC2);
+ SurfaceDesc.dwFlags = DDSD_HEIGHT | DDSD_WIDTH | DDSD_REFRESHRATE | DDSD_WIDTH |
DDSD_PIXELFORMAT;
+ SurfaceDesc.dwHeight = This->lpLcl->lpGbl->lpModeInfo[i].dwWidth;
+ SurfaceDesc.dwWidth = This->lpLcl->lpGbl->lpModeInfo[i].dwHeight;
+ SurfaceDesc.lPitch = This->lpLcl->lpGbl->lpModeInfo[i].lPitch;
+ SurfaceDesc.dwRefreshRate =
This->lpLcl->lpGbl->lpModeInfo[i].wRefreshRate;
+
+ SurfaceDesc.ddpfPixelFormat.dwSize = sizeof (DDPIXELFORMAT);
+ SurfaceDesc.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ SurfaceDesc.ddpfPixelFormat.dwRBitMask =
This->lpLcl->lpGbl->lpModeInfo[i].dwRBitMask;
+ SurfaceDesc.ddpfPixelFormat.dwGBitMask =
This->lpLcl->lpGbl->lpModeInfo[i].dwGBitMask;
+ SurfaceDesc.ddpfPixelFormat.dwBBitMask =
This->lpLcl->lpGbl->lpModeInfo[i].dwBBitMask;
+ SurfaceDesc.ddpfPixelFormat.dwRGBAlphaBitMask =
This->lpLcl->lpGbl->lpModeInfo[i].dwAlphaBitMask;
+ SurfaceDesc.ddpfPixelFormat.dwRGBBitCount =
This->lpLcl->lpGbl->lpModeInfo[i].dwBPP;
+
+ if(dwFlags & DDEDM_REFRESHRATES && SurfaceDesc.dwRefreshRate !=
This->lpLcl->lpGbl->dwMonitorFrequency)
+ {
+ continue;
+ }
+
+ if(pDDSD)
+ {
+ if(pDDSD->dwFlags & DDSD_HEIGHT && pDDSD->dwHeight !=
SurfaceDesc.dwHeight)
+ continue;
+
+ else if(pDDSD->dwFlags & DDSD_WIDTH && pDDSD->dwWidth !=
SurfaceDesc.dwWidth)
+ continue;
+
+ else if(pDDSD->dwFlags & DDSD_PITCH && pDDSD->lPitch !=
SurfaceDesc.lPitch)
+ continue;
+
+ else if(pDDSD->dwFlags & DDSD_REFRESHRATE &&
pDDSD->dwRefreshRate != SurfaceDesc.dwRefreshRate)
+ continue;
+
+ else if(pDDSD->dwFlags & DDSD_PIXELFORMAT &&
pDDSD->ddpfPixelFormat.dwRGBBitCount != SurfaceDesc.ddpfPixelFormat.dwRGBBitCount)
+ continue; // FIXME: test for the other members of ddpfPixelFormat as
well
+ }
+
+ (*pCallback)(&SurfaceDesc, pContext);
+ }
+
+ return DD_OK;
+}
+
HRESULT WINAPI
Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight,
DWORD dwBPP, DWORD
dwRefreshRate, DWORD dwFlags)
@@ -20,7 +82,7 @@
// FIXME: Check primary if surface is locked / busy etc.
- // Check Parameter
+ // Check Parameters
if(dwFlags != 0)
{
return DDERR_INVALIDPARAMS;
@@ -71,6 +133,22 @@
}
HRESULT WINAPI
+Main_DirectDraw_RestoreDisplayMode (LPDIRECTDRAW7 iface)
+{
+ LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
+ DX_WINDBG_trace();
+
+ ChangeDisplaySettings(NULL, 0);
+
+ // Update Interals
+ BOOL ModeChanged;
+ DdReenableDirectDrawObject(This->lpLcl->lpGbl, &ModeChanged);
+ StartDirectDraw((LPDIRECTDRAW)iface, 0, TRUE);
+
+ return DD_OK;
+}
+
+HRESULT WINAPI
Main_DirectDraw_GetMonitorFrequency (LPDIRECTDRAW7 iface, LPDWORD lpFreq)
{
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
@@ -96,6 +174,8 @@
if (pDDSD->dwSize != sizeof(LPDDSURFACEDESC2))
return DDERR_INVALIDPARAMS;
+ // FIXME: More stucture members might need to be filled
+
pDDSD->dwFlags |= DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | DDSD_PITCH |
DDSD_REFRESHRATE;
pDDSD->dwHeight = This->lpLcl->lpGbl->vmiData.dwDisplayWidth;
pDDSD->dwWidth = This->lpLcl->lpGbl->vmiData.dwDisplayHeight;
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/dd…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c Mon May 21 16:01:07 2007
@@ -33,16 +33,6 @@
HRESULT WINAPI Main_DirectDraw_DuplicateSurface(LPDIRECTDRAW7 iface, LPDIRECTDRAWSURFACE7
src,
LPDIRECTDRAWSURFACE7* dst)
-{
- DX_WINDBG_trace();
- DX_STUB;
-}
-
-/*
- * Status: Implentation removed due to rewrite
- */
-HRESULT WINAPI Main_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
- LPDDSURFACEDESC2 pDDSD, LPVOID context, LPDDENUMMODESCALLBACK2
callback)
{
DX_WINDBG_trace();
DX_STUB;
@@ -111,16 +101,6 @@
* Status: Implentation removed due to rewrite
*/
HRESULT WINAPI
-Main_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface)
-{
- DX_WINDBG_trace();
- DX_STUB;
-}
-
-/*
- * Status: Implentation removed due to rewrite
- */
-HRESULT WINAPI
Main_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
HANDLE h)
{