mirror of
https://github.com/reactos/reactos.git
synced 2024-07-03 19:24:20 +00:00
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 svn path=/trunk/; revision=31070
This commit is contained in:
parent
b227bebec5
commit
f8072187ba
|
@ -45,6 +45,14 @@ Main_DirectDraw_DuplicateSurface(
|
|||
|
||||
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,
|
||||
|
|
|
@ -16,6 +16,100 @@
|
|||
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_EnumDisplayModes(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags,
|
||||
LPDDSURFACEDESC pDDSD, LPVOID pContext, LPDDENUMMODESCALLBACK pCallback)
|
||||
{
|
||||
HRESULT ret = DD_OK;
|
||||
INT iMode = 0;
|
||||
DEVMODE DevMode;
|
||||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
ZeroMemory(&DevMode, sizeof(DEVMODE));
|
||||
|
||||
_SEH_TRY
|
||||
{
|
||||
|
||||
if
|
||||
((!IsBadReadPtr(pCallback,sizeof(LPDDENUMMODESCALLBACK))) ||
|
||||
(!IsBadWritePtr(pCallback,sizeof(LPDDENUMMODESCALLBACK))) ||
|
||||
(!IsBadReadPtr(pDDSD,sizeof(DDSURFACEDESC))) ||
|
||||
(!IsBadWritePtr(pDDSD,sizeof(DDSURFACEDESC))))
|
||||
{
|
||||
ret = DDERR_INVALIDPARAMS;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
DevMode.dmSize = sizeof(DEVMODE);
|
||||
|
||||
while (EnumDisplaySettingsEx(NULL, iMode, &DevMode, 0) == TRUE)
|
||||
{
|
||||
DDSURFACEDESC SurfaceDesc;
|
||||
|
||||
ZeroMemory(&SurfaceDesc, sizeof(DDSURFACEDESC));
|
||||
|
||||
iMode++;
|
||||
|
||||
SurfaceDesc.dwSize = sizeof (DDSURFACEDESC);
|
||||
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_EnumDisplayModes4(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags,
|
||||
LPDDSURFACEDESC2 pDDSD, LPVOID pContext, LPDDENUMMODESCALLBACK2 pCallback)
|
||||
{
|
||||
HRESULT ret = DD_OK;
|
||||
|
|
|
@ -70,7 +70,7 @@ HRESULT WINAPI
|
|||
Main_DirectDraw_EnumSurfaces(
|
||||
LPDIRECTDRAW2 iface,
|
||||
DWORD dwFlags,
|
||||
LPDDSURFACEDESC2 lpDDSD,
|
||||
LPDDSURFACEDESC lpDDSD,
|
||||
LPVOID context,
|
||||
LPDDENUMSURFACESCALLBACK callback);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ Main_DirectDraw_DuplicateSurface(
|
|||
LPDIRECTDRAWSURFACE4* dst);
|
||||
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_EnumDisplayModes(
|
||||
Main_DirectDraw_EnumDisplayModes4(
|
||||
LPDIRECTDRAW4 iface,
|
||||
DWORD dwFlags,
|
||||
LPDDSURFACEDESC2 pDDSD,
|
||||
|
@ -182,7 +182,7 @@ IDirectDraw4Vtbl DirectDraw4_Vtable =
|
|||
Main_DirectDraw_CreatePalette,
|
||||
Main_DirectDraw_CreateSurface4,
|
||||
Main_DirectDraw_DuplicateSurface,
|
||||
Main_DirectDraw_EnumDisplayModes,
|
||||
Main_DirectDraw_EnumDisplayModes4,
|
||||
Main_DirectDraw_EnumSurfaces,
|
||||
Main_DirectDraw_FlipToGDISurface,
|
||||
Main_DirectDraw_GetCaps,
|
||||
|
|
|
@ -63,7 +63,7 @@ Main_DirectDraw_DuplicateSurface(
|
|||
LPDIRECTDRAWSURFACE7* dst);
|
||||
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_EnumDisplayModes(
|
||||
Main_DirectDraw_EnumDisplayModes4(
|
||||
LPDIRECTDRAW7 iface,
|
||||
DWORD dwFlags,
|
||||
LPDDSURFACEDESC2 pDDSD,
|
||||
|
@ -197,7 +197,7 @@ IDirectDraw7Vtbl DirectDraw7_Vtable =
|
|||
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) */
|
||||
|
|
|
@ -70,9 +70,9 @@ HRESULT WINAPI
|
|||
Main_DirectDraw_EnumSurfaces(
|
||||
LPDIRECTDRAW iface,
|
||||
DWORD dwFlags,
|
||||
LPDDSURFACEDESC2 lpDDSD2,
|
||||
LPDDSURFACEDESC lpDDSD2,
|
||||
LPVOID context,
|
||||
LPDDENUMSURFACESCALLBACK7 callback);
|
||||
LPDDENUMSURFACESCALLBACK callback);
|
||||
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW iface);
|
||||
|
|
Loading…
Reference in a new issue