Author: greatlrd
Date: Sat Dec 8 16:00:55 2007
New Revision: 31070
URL:
http://svn.reactos.org/svn/reactos?rev=31070&view=rev
Log:
fixed bug with EnumDisplayModes for dx 1,2 it use wrong size of Surface and callbacks.
we need two diffrent version of EnumDisplayModes to solv it
Modified:
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw.h
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c
trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw2_Vtable.c
trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw4_Vtable.c
trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw7_Vtable.c
trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw_Vtable.c
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/dd…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw.h (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw.h Sat Dec 8 16:00:55 2007
@@ -45,6 +45,14 @@
HRESULT WINAPI
Main_DirectDraw_EnumDisplayModes(
+ LPDDRAWI_DIRECTDRAW_INT This,
+ DWORD dwFlags,
+ LPDDSURFACEDESC pDDSD,
+ LPVOID pContext,
+ LPDDENUMMODESCALLBACK pCallback);
+
+HRESULT WINAPI
+Main_DirectDraw_EnumDisplayModes4(
LPDDRAWI_DIRECTDRAW_INT This,
DWORD dwFlags,
LPDDSURFACEDESC2 pDDSD,
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 Sat Dec 8 16:00:55 2007
@@ -16,7 +16,7 @@
HRESULT WINAPI
Main_DirectDraw_EnumDisplayModes(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags,
- LPDDSURFACEDESC2 pDDSD, LPVOID pContext,
LPDDENUMMODESCALLBACK2 pCallback)
+ LPDDSURFACEDESC pDDSD, LPVOID pContext,
LPDDENUMMODESCALLBACK pCallback)
{
HRESULT ret = DD_OK;
INT iMode = 0;
@@ -30,10 +30,10 @@
{
if
- ((!IsBadReadPtr(pCallback,sizeof(LPDDENUMMODESCALLBACK2))) ||
- (!IsBadWritePtr(pCallback,sizeof(LPDDENUMMODESCALLBACK2))) ||
- (!IsBadReadPtr(pDDSD,sizeof(DDSURFACEDESC2))) ||
- (!IsBadWritePtr(pDDSD,sizeof(DDSURFACEDESC2))))
+ ((!IsBadReadPtr(pCallback,sizeof(LPDDENUMMODESCALLBACK))) ||
+ (!IsBadWritePtr(pCallback,sizeof(LPDDENUMMODESCALLBACK))) ||
+ (!IsBadReadPtr(pDDSD,sizeof(DDSURFACEDESC))) ||
+ (!IsBadWritePtr(pDDSD,sizeof(DDSURFACEDESC))))
{
ret = DDERR_INVALIDPARAMS;
}
@@ -44,13 +44,13 @@
while (EnumDisplaySettingsEx(NULL, iMode, &DevMode, 0) == TRUE)
{
- DDSURFACEDESC2 SurfaceDesc;
-
- ZeroMemory(&SurfaceDesc, sizeof(DDSURFACEDESC2));
+ DDSURFACEDESC SurfaceDesc;
+
+ ZeroMemory(&SurfaceDesc, sizeof(DDSURFACEDESC));
iMode++;
- SurfaceDesc.dwSize = sizeof (DDSURFACEDESC2);
+ SurfaceDesc.dwSize = sizeof (DDSURFACEDESC);
SurfaceDesc.dwFlags = DDSD_HEIGHT | DDSD_WIDTH | DDSD_REFRESHRATE |
DDSD_WIDTH | DDSD_PIXELFORMAT;
SurfaceDesc.dwHeight = DevMode.dmPelsHeight;
SurfaceDesc.dwWidth = DevMode.dmPelsWidth;
@@ -109,6 +109,100 @@
}
HRESULT WINAPI
+Main_DirectDraw_EnumDisplayModes4(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags,
+ LPDDSURFACEDESC2 pDDSD, LPVOID pContext,
LPDDENUMMODESCALLBACK2 pCallback)
+{
+ HRESULT ret = DD_OK;
+ INT iMode = 0;
+ DEVMODE DevMode;
+
+ DX_WINDBG_trace();
+
+ ZeroMemory(&DevMode, sizeof(DEVMODE));
+
+ _SEH_TRY
+ {
+
+ if
+ ((!IsBadReadPtr(pCallback,sizeof(LPDDENUMMODESCALLBACK2))) ||
+ (!IsBadWritePtr(pCallback,sizeof(LPDDENUMMODESCALLBACK2))) ||
+ (!IsBadReadPtr(pDDSD,sizeof(DDSURFACEDESC2))) ||
+ (!IsBadWritePtr(pDDSD,sizeof(DDSURFACEDESC2))))
+ {
+ ret = DDERR_INVALIDPARAMS;
+ }
+ else
+ {
+
+ DevMode.dmSize = sizeof(DEVMODE);
+
+ while (EnumDisplaySettingsEx(NULL, iMode, &DevMode, 0) == TRUE)
+ {
+ DDSURFACEDESC2 SurfaceDesc;
+
+ ZeroMemory(&SurfaceDesc, sizeof(DDSURFACEDESC2));
+
+ iMode++;
+
+ SurfaceDesc.dwSize = sizeof (DDSURFACEDESC2);
+ SurfaceDesc.dwFlags = DDSD_HEIGHT | DDSD_WIDTH | DDSD_REFRESHRATE |
DDSD_WIDTH | DDSD_PIXELFORMAT;
+ SurfaceDesc.dwHeight = DevMode.dmPelsHeight;
+ SurfaceDesc.dwWidth = DevMode.dmPelsWidth;
+ SurfaceDesc.lPitch = DevMode.dmPelsWidth * DevMode.dmBitsPerPel / 8;
+ SurfaceDesc.dwRefreshRate = DevMode.dmDisplayFrequency;
+
+ SurfaceDesc.ddpfPixelFormat.dwSize = sizeof (DDPIXELFORMAT);
+ SurfaceDesc.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ // FIXME: get these
+ /*
+ SurfaceDesc.ddpfPixelFormat.dwRBitMask =
+ SurfaceDesc.ddpfPixelFormat.dwGBitMask =
+ SurfaceDesc.ddpfPixelFormat.dwBBitMask =
+ SurfaceDesc.ddpfPixelFormat.dwRGBAlphaBitMask =
+ */
+ SurfaceDesc.ddpfPixelFormat.dwRGBBitCount = DevMode.dmBitsPerPel;
+
+ // FIXME1: This->lpLcl->lpGbl->dwMonitorFrequency is not set !
+ if(dwFlags & DDEDM_REFRESHRATES && SurfaceDesc.dwRefreshRate
!= This->lpLcl->lpGbl->dwMonitorFrequency)
+ {
+ //continue; // FIXME2: what is SurfaceDesc.dwRefreshRate supposed to
be set to ?
+ }
+
+ // FIXME: Take case when DDEDM_STANDARDVGAMODES flag is not set in
account
+
+ 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
+ }
+
+ if((*pCallback)(&SurfaceDesc, pContext) == DDENUMRET_CANCEL)
+ break;
+ }
+ }
+
+ }
+ _SEH_HANDLE
+ {
+ }
+ _SEH_END;
+
+ return ret;
+}
+
+HRESULT WINAPI
Main_DirectDraw_SetDisplayMode (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwWidth, DWORD
dwHeight, DWORD dwBPP)
{
return Main_DirectDraw_SetDisplayMode2 (This, dwWidth, dwHeight, dwBPP, 0, 0 );
Modified: trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw2_Vtable.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Vtable/D…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw2_Vtable.c (original)
+++ trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw2_Vtable.c Sat Dec 8 16:00:55 2007
@@ -70,7 +70,7 @@
Main_DirectDraw_EnumSurfaces(
LPDIRECTDRAW2 iface,
DWORD dwFlags,
- LPDDSURFACEDESC2 lpDDSD,
+ LPDDSURFACEDESC lpDDSD,
LPVOID context,
LPDDENUMSURFACESCALLBACK callback);
Modified: trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw4_Vtable.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Vtable/D…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw4_Vtable.c (original)
+++ trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw4_Vtable.c Sat Dec 8 16:00:55 2007
@@ -59,7 +59,7 @@
LPDIRECTDRAWSURFACE4* dst);
HRESULT WINAPI
-Main_DirectDraw_EnumDisplayModes(
+Main_DirectDraw_EnumDisplayModes4(
LPDIRECTDRAW4 iface,
DWORD dwFlags,
LPDDSURFACEDESC2 pDDSD,
@@ -182,7 +182,7 @@
Main_DirectDraw_CreatePalette,
Main_DirectDraw_CreateSurface4,
Main_DirectDraw_DuplicateSurface,
- Main_DirectDraw_EnumDisplayModes,
+ Main_DirectDraw_EnumDisplayModes4,
Main_DirectDraw_EnumSurfaces,
Main_DirectDraw_FlipToGDISurface,
Main_DirectDraw_GetCaps,
Modified: trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw7_Vtable.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Vtable/D…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw7_Vtable.c (original)
+++ trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw7_Vtable.c Sat Dec 8 16:00:55 2007
@@ -63,7 +63,7 @@
LPDIRECTDRAWSURFACE7* dst);
HRESULT WINAPI
-Main_DirectDraw_EnumDisplayModes(
+Main_DirectDraw_EnumDisplayModes4(
LPDIRECTDRAW7 iface,
DWORD dwFlags,
LPDDSURFACEDESC2 pDDSD,
@@ -197,7 +197,7 @@
Main_DirectDraw_CreatePalette,
Main_DirectDraw_CreateSurface4, /* (CreateSurface4 testing / devloping)
*/
Main_DirectDraw_DuplicateSurface,
- Main_DirectDraw_EnumDisplayModes, /* (EnumDisplayModes testing / devloping)
*/
+ Main_DirectDraw_EnumDisplayModes4, /* (EnumDisplayModes testing /
devloping) */
Main_DirectDraw_EnumSurfaces,
Main_DirectDraw_FlipToGDISurface,
Main_DirectDraw_GetCaps, /* (GetCaps done) */
Modified: trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw_Vtable.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Vtable/D…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw_Vtable.c (original)
+++ trunk/reactos/dll/directx/ddraw/Vtable/DirectDraw_Vtable.c Sat Dec 8 16:00:55 2007
@@ -70,9 +70,9 @@
Main_DirectDraw_EnumSurfaces(
LPDIRECTDRAW iface,
DWORD dwFlags,
- LPDDSURFACEDESC2 lpDDSD2,
+ LPDDSURFACEDESC lpDDSD2,
LPVOID context,
- LPDDENUMSURFACESCALLBACK7 callback);
+ LPDDENUMSURFACESCALLBACK callback);
HRESULT WINAPI
Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW iface);