Author: greatlrd Date: Sat Dec 8 16:40:07 2007 New Revision: 31077
URL: http://svn.reactos.org/svn/reactos?rev=31077&view=rev Log: 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
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c trunk/reactos/dll/directx/ddraw/rosdraw.h
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/ddr... ============================================================================== --- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c (original) +++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_displaymode.c Sat Dec 8 16:40:07 2007 @@ -205,6 +205,8 @@ 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 @@ 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) {
Modified: trunk/reactos/dll/directx/ddraw/rosdraw.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/rosdraw.h... ============================================================================== --- trunk/reactos/dll/directx/ddraw/rosdraw.h (original) +++ trunk/reactos/dll/directx/ddraw/rosdraw.h Sat Dec 8 16:40:07 2007 @@ -257,14 +257,14 @@
#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) \