patch from Kamil Hornicek tykef at atlas dot cz (irc nick : Pigglesworth)

Fixed Main_DirectDraw_GetDisplayMode for dx1, dx2 
Fixed some compile warnings 







svn path=/trunk/; revision=31120
This commit is contained in:
Magnus Olsen
2007-12-10 07:34:54 +00:00
parent ce09f0b1a4
commit 13dc179a11
5 changed files with 54 additions and 10 deletions
+6
View File
@@ -78,6 +78,11 @@ Main_DirectDraw_GetCaps(
HRESULT WINAPI
Main_DirectDraw_GetDisplayMode (
LPDDRAWI_DIRECTDRAW_INT This,
LPDDSURFACEDESC pDDSD);
HRESULT WINAPI
Main_DirectDraw_GetDisplayMode4 (
LPDDRAWI_DIRECTDRAW_INT This,
LPDDSURFACEDESC2 pDDSD);
@@ -203,3 +208,4 @@ DWORD CALLBACK HelDdSurfSetPalette(LPDDHAL_SETPALETTEDATA lpSetPaletteData);
DWORD CALLBACK HelDdSurfUnlock(LPDDHAL_UNLOCKDATA lpUnLockData);
DWORD CALLBACK HelDdSurfUpdateOverlay(LPDDHAL_UPDATEOVERLAYDATA lpUpDateOveryLayData);
@@ -37,7 +37,7 @@ Main_DirectDraw_EnumDisplayModes(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags,
}
}
if (IsBadCodePtr(pCallback))
if (IsBadCodePtr((LPVOID)pCallback))
{
ret = DDERR_INVALIDPARAMS;
}
@@ -135,7 +135,7 @@ Main_DirectDraw_EnumDisplayModes4(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags,
}
}
if (IsBadCodePtr(pCallback))
if (IsBadCodePtr((LPVOID)pCallback))
{
ret = DDERR_INVALIDPARAMS;
}
@@ -265,7 +265,7 @@ Main_DirectDraw_SetDisplayMode2 (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwWidth, DW
DevMode.dmBitsPerPel = dwBPP;
DevMode.dmDisplayFrequency = dwRefreshRate;
DX_WINDBG_trace_res(dwHeight, dwWidth, dwBPP, dwRefreshRate);
DX_WINDBG_trace_res(dwWidth, dwHeight,dwBPP, dwRefreshRate);
retval = ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN);
/* FIXME: Are we supposed to set CDS_SET_PRIMARY as well ? */
@@ -367,14 +367,50 @@ Main_DirectDraw_GetMonitorFrequency (LPDDRAWI_DIRECTDRAW_INT This, LPDWORD lpFre
}
HRESULT WINAPI
Main_DirectDraw_GetDisplayMode (LPDDRAWI_DIRECTDRAW_INT This, LPDDSURFACEDESC2 pDDSD)
Main_DirectDraw_GetDisplayMode (LPDDRAWI_DIRECTDRAW_INT This, LPDDSURFACEDESC pDDSD)
{
HRESULT retVal = DD_OK;
DX_WINDBG_trace();
_SEH_TRY
{
if(IsBadWritePtr(pDDSD,sizeof(LPDWORD)))
if(IsBadWritePtr(pDDSD,sizeof(LPDDSURFACEDESC)))
{
retVal = DDERR_INVALIDPARAMS;
}
else if (pDDSD->dwSize != sizeof(DDSURFACEDESC))
{
retVal = DDERR_INVALIDPARAMS;
}
else
{
// 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.dwDisplayHeight;
pDDSD->dwWidth = This->lpLcl->lpGbl->vmiData.dwDisplayWidth;
pDDSD->ddpfPixelFormat = This->lpLcl->lpGbl->vmiData.ddpfDisplay;
pDDSD->dwRefreshRate = This->lpLcl->lpGbl->dwMonitorFrequency;
pDDSD->lPitch = This->lpLcl->lpGbl->vmiData.lDisplayPitch;
}
}
_SEH_HANDLE
{
}
_SEH_END;
return retVal;
}
HRESULT WINAPI
Main_DirectDraw_GetDisplayMode4 (LPDDRAWI_DIRECTDRAW_INT This, LPDDSURFACEDESC2 pDDSD)
{
HRESULT retVal = DD_OK;
DX_WINDBG_trace();
_SEH_TRY
{
if(IsBadWritePtr(pDDSD,sizeof(LPDDSURFACEDESC2)))
{
retVal = DDERR_INVALIDPARAMS;
}
@@ -165,7 +165,7 @@ Internal_CreateSurface( LPDDRAWI_DIRECTDRAW_INT pDDraw, LPDDSURFACEDESC2 pDDSD,
/* FIXME ThisSurfaceMore->dmiDDrawReserved7.wMonitorsAttachedToDesktop */
ThisSurfaceMore->dmiDDrawReserved7.wMonitorsAttachedToDesktop = 1;
pDDraw->lpLcl->lpPrimary = ThisSurfInt;
Main_DirectDraw_AddRef((LPDIRECTDRAW7)pDDraw);
Main_DirectDraw_AddRef(pDDraw);
}
else
{
@@ -246,3 +246,4 @@ void CopyDDSurfDescToDDSurfDesc2(LPDDSURFACEDESC2 dst_pDesc, LPDDSURFACEDESC src
}
@@ -84,7 +84,7 @@ Main_DirectDraw_GetCaps(
LPDDCAPS pHELCaps);
HRESULT WINAPI
Main_DirectDraw_GetDisplayMode (
Main_DirectDraw_GetDisplayMode4 (
LPDIRECTDRAW4 iface,
LPDDSURFACEDESC2 pDDSD);
@@ -186,7 +186,7 @@ IDirectDraw4Vtbl DirectDraw4_Vtable =
Main_DirectDraw_EnumSurfaces,
Main_DirectDraw_FlipToGDISurface,
Main_DirectDraw_GetCaps,
Main_DirectDraw_GetDisplayMode,
Main_DirectDraw_GetDisplayMode4,
Main_DirectDraw_GetFourCCCodes,
Main_DirectDraw_GetGDISurface,
Main_DirectDraw_GetMonitorFrequency,
@@ -88,7 +88,7 @@ Main_DirectDraw_GetCaps(
LPDDCAPS pHELCaps);
HRESULT WINAPI
Main_DirectDraw_GetDisplayMode (
Main_DirectDraw_GetDisplayMode4 (
LPDIRECTDRAW7 iface,
LPDDSURFACEDESC2 pDDSD);
@@ -201,7 +201,7 @@ IDirectDraw7Vtbl DirectDraw7_Vtable =
Main_DirectDraw_EnumSurfaces,
Main_DirectDraw_FlipToGDISurface,
Main_DirectDraw_GetCaps, /* (GetCaps done) */
Main_DirectDraw_GetDisplayMode, /* (GetDisplayMode testing / devloping) */
Main_DirectDraw_GetDisplayMode4, /* (GetDisplayMode testing / devloping) */
Main_DirectDraw_GetFourCCCodes, /* (GetFourCCCodes done) */
Main_DirectDraw_GetGDISurface,
Main_DirectDraw_GetMonitorFrequency, /* (GetMonitorFrequency done) */
@@ -221,3 +221,4 @@ IDirectDraw7Vtbl DirectDraw7_Vtable =
Main_DirectDraw_EvaluateMode
};