From eea85cc4845d946a1c0cbbec6a453cafddc193dc Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sat, 8 Dec 2007 13:40:07 +0000 Subject: [PATCH] Fixed a werid case when setdisplay mode does not working. tested with ati hd2400 that does not official support 256 color in windows. with the official drv I have svn path=/trunk/; revision=31077 --- .../dll/directx/ddraw/Ddraw/ddraw_displaymode.c | 15 ++++++++++++++- reactos/dll/directx/ddraw/rosdraw.h | 16 ++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c b/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c index 8fe11dd30e3..085eb51a255 100644 --- a/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c +++ b/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c @@ -205,6 +205,8 @@ Main_DirectDraw_EnumDisplayModes4(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags, HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP) { + DX_WINDBG_trace(); + return Main_DirectDraw_SetDisplayMode2 (This, dwWidth, dwHeight, dwBPP, 0, 0 ); } @@ -255,12 +257,23 @@ Main_DirectDraw_SetDisplayMode2 (LPDDRAWI_DIRECTDRAW_INT This, DWORD dwWidth, DW DevMode.dmBitsPerPel = dwBPP; DevMode.dmDisplayFrequency = dwRefreshRate; + DX_WINDBG_trace_res(dwHeight, dwWidth, dwBPP, dwRefreshRate); + retval = ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN); /* FIXME: Are we supposed to set CDS_SET_PRIMARY as well ? */ if(retval == DISP_CHANGE_BADMODE) { - ret = DDERR_UNSUPPORTED; + /* Note : it seam ms ddraw ignore this and try using the bad mode any case. + * tested with Ati HD2400 that only support 16 and 32 Bpp in windows + */ + DX_STUB_str("Warning ChangeDisplaySettings return DISP_CHANGE_BADMODE, but ddraw.dll ignore it\n"); + + //ret = DDERR_UNSUPPORTED; + BOOL ModeChanged; + This->lpLcl->lpGbl->hDD = This->lpLcl->hDD; + DdReenableDirectDrawObject(This->lpLcl->lpGbl, &ModeChanged); + StartDirectDraw((LPDIRECTDRAW)This, 0, TRUE); } else if(retval != DISP_CHANGE_SUCCESSFUL) { diff --git a/reactos/dll/directx/ddraw/rosdraw.h b/reactos/dll/directx/ddraw/rosdraw.h index da58d48bee8..deff02f3966 100644 --- a/reactos/dll/directx/ddraw/rosdraw.h +++ b/reactos/dll/directx/ddraw/rosdraw.h @@ -257,14 +257,14 @@ VOID Hal_DirectDraw_Release (LPDIRECTDRAW7); #define DX_WINDBG_trace_res(width,height,bpp, freq) \ - static BOOL firstcallxx = TRUE; \ - if (firstcallxx) \ - { \ - char buffer[1024]; \ - sprintf ( buffer, "Setmode have been req width=%d, height=%d bpp=%d freq = %d\n",width,height,bpp, freq); \ - OutputDebugStringA(buffer); \ - firstcallxx = FALSE; \ - } + static BOOL firstcallxx = TRUE; \ + if (firstcallxx) \ + { \ + char buffer[1024]; \ + sprintf ( buffer, "Setmode have been req width=%d, height=%d bpp=%d freq = %d\n",width,height,bpp, freq); \ + OutputDebugStringA(buffer); \ + firstcallxx = TRUE; \ + } #else #define DX_WINDBG_trace() // #define DX_WINDBG_trace_res(width,height,bpp, freq) \\