Author: mbosma
Date: Tue May 15 20:18:30 2007
New Revision: 26793
URL:
http://svn.reactos.org/svn/reactos?rev=26793&view=rev
Log:
Some formatting and implement SetDisplayMode.
Modified:
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c
trunk/reactos/dll/directx/ddraw/Surface/callbacks_surf_hel.c
trunk/reactos/dll/directx/ddraw/Surface/createsurface.c
trunk/reactos/dll/directx/ddraw/Surface/surface_main.c
trunk/reactos/dll/directx/ddraw/Surface/surface_stubs.c
trunk/reactos/dll/directx/ddraw/startup.c
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/dd…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c Tue May 15 20:18:30 2007
@@ -9,7 +9,7 @@
*/
-#include "../rosdraw.h"
+#include "rosdraw.h"
HRESULT
WINAPI
@@ -117,6 +117,65 @@
return DD_OK;
}
+HRESULT WINAPI
+Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight,
+ DWORD dwBPP, DWORD
dwRefreshRate, DWORD dwFlags)
+{
+ LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
+ DX_WINDBG_trace();
+
+ // FIXME: Check primary if surface is locked / busy etc.
+
+ // Check Parameter
+ if(dwFlags != 0)
+ {
+ return DDERR_INVALIDPARAMS;
+ }
+
+ if ((!dwHeight || This->lpLcl->lpGbl->vmiData.dwDisplayHeight == dwHeight)
&&
+ (!dwWidth || This->lpLcl->lpGbl->vmiData.dwDisplayWidth == dwWidth)
&&
+ (!dwBPP || This->lpLcl->lpGbl->vmiData.ddpfDisplay.dwRGBBitCount ==
dwBPP) &&
+ (!dwRefreshRate || This->lpLcl->lpGbl->dwMonitorFrequency ==
dwRefreshRate))
+ {
+ return DD_OK; // nothing to do here for us
+ }
+
+ // Here we go
+ DEVMODE DevMode;
+ DevMode.dmFields = 0;
+ if(dwHeight)
+ DevMode.dmFields |= DM_PELSHEIGHT;
+ if(dwWidth)
+ DevMode.dmFields |= DM_PELSWIDTH;
+ if(dwBPP)
+ DevMode.dmFields |= DM_BITSPERPEL;
+ if(dwRefreshRate)
+ DevMode.dmFields |= DM_DISPLAYFREQUENCY;
+
+ DevMode.dmPelsHeight = dwHeight;
+ DevMode.dmPelsWidth = dwWidth;
+ DevMode.dmBitsPerPel = dwBPP;
+ DevMode.dmDisplayFrequency = dwRefreshRate;
+
+ LONG retval = ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN /* | CDS_SET_PRIMARY
? */);
+ DbgPrint("%d\n", retval);
+
+ if(retval == DISP_CHANGE_BADMODE)
+ {
+ return DDERR_UNSUPPORTED;
+ }
+ else if(retval != DISP_CHANGE_SUCCESSFUL)
+ {
+ return DDERR_GENERIC;
+ }
+
+ // Update Interals
+ BOOL ModeChanged;
+ DdReenableDirectDrawObject(This->lpLcl->lpGbl, &ModeChanged);
+ StartDirectDraw((LPDIRECTDRAW)iface, 0, TRUE);
+
+ return DD_OK;
+}
/*
*/
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 Tue May 15 20:18:30 2007
@@ -8,7 +8,7 @@
*
*/
-#include "../rosdraw.h"
+#include "rosdraw.h"
/*
* Status: Implentation removed due to rewrite
@@ -148,17 +148,6 @@
* Status: Implentation removed due to rewrite
*/
HRESULT WINAPI
-Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight,
- DWORD dwBPP, DWORD
dwRefreshRate, DWORD dwFlags)
-{
- DX_WINDBG_trace();
- DX_STUB;
-}
-
-/*
- * Status: Implentation removed due to rewrite
- */
-HRESULT WINAPI
Main_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
HANDLE h)
{
Modified: trunk/reactos/dll/directx/ddraw/Surface/callbacks_surf_hel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Surface/…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Surface/callbacks_surf_hel.c (original)
+++ trunk/reactos/dll/directx/ddraw/Surface/callbacks_surf_hel.c Tue May 15 20:18:30 2007
@@ -8,11 +8,7 @@
*
*/
-#include <windows.h>
#include "rosdraw.h"
-#include "d3dhal.h"
-#include "ddrawgdi.h"
-
DWORD CALLBACK HelDdSurfAddAttachedSurface(LPDDHAL_ADDATTACHEDSURFACEDATA
lpDestroySurface)
{
Modified: trunk/reactos/dll/directx/ddraw/Surface/createsurface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Surface/…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Surface/createsurface.c (original)
+++ trunk/reactos/dll/directx/ddraw/Surface/createsurface.c Tue May 15 20:18:30 2007
@@ -93,7 +93,6 @@
RtlCopyMemory(dst_pDesc,src_pDesc,sizeof(DDSURFACEDESC));
dst_pDesc->dwSize = sizeof(DDSURFACEDESC2);
}
-
HRESULT
CreatePrimarySurface(LPDDRAWI_DIRECTDRAW_INT This,
Modified: trunk/reactos/dll/directx/ddraw/Surface/surface_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Surface/…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Surface/surface_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/Surface/surface_main.c Tue May 15 20:18:30 2007
@@ -8,7 +8,7 @@
*
*/
-#include "../rosdraw.h"
+#include "rosdraw.h"
/* FIXME adding hal and hel stub
Modified: trunk/reactos/dll/directx/ddraw/Surface/surface_stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Surface/…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Surface/surface_stubs.c (original)
+++ trunk/reactos/dll/directx/ddraw/Surface/surface_stubs.c Tue May 15 20:18:30 2007
@@ -8,7 +8,7 @@
*
*/
-#include "../rosdraw.h"
+#include "rosdraw.h"
HRESULT WINAPI
Main_DDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
Modified: trunk/reactos/dll/directx/ddraw/startup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/startup.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/startup.c (original)
+++ trunk/reactos/dll/directx/ddraw/startup.c Tue May 15 20:18:30 2007
@@ -358,7 +358,6 @@
StartDirectDrawHal(LPDIRECTDRAW* iface, BOOL reenable)
{
-
LPDWORD mpFourCC;
DDHALINFO mHALInfo;
BOOL newmode = FALSE;
@@ -367,6 +366,8 @@
D3DHAL_GLOBALDRIVERDATA mD3dDriverData;
DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks;
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
+
+ DX_WINDBG_trace();
RtlZeroMemory(&mHALInfo, sizeof(DDHALINFO));
RtlZeroMemory(&mD3dCallbacks, sizeof(D3DHAL_CALLBACKS));