Move hel SetDisplayMode to hel and write a stub for hal SetDisplayMode. Hel SetDisplayMode is already implmenet by DrFred Modified: trunk/reactos/lib/ddraw/hal/ddraw.c Modified: trunk/reactos/lib/ddraw/main/ddraw.c Modified: trunk/reactos/lib/ddraw/rosdraw.h Modified: trunk/reactos/lib/ddraw/soft/ddraw.c _____
Modified: trunk/reactos/lib/ddraw/hal/ddraw.c --- trunk/reactos/lib/ddraw/hal/ddraw.c 2005-10-30 09:21:03 UTC (rev 18873) +++ trunk/reactos/lib/ddraw/hal/ddraw.c 2005-10-30 09:45:10 UTC (rev 18874) @@ -454,5 +454,35 @@
} /* FIXME where should FlipGdi.dwToGDI be fill in */ - return FlipGdi.ddRVal; + return FlipGdi.ddRVal; } + +HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight, + DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) +{ + DDHAL_SETMODEDATA mode; + + IDirectDrawImpl* This = (IDirectDrawImpl*)iface; + + if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE)) + { + return DDERR_NODRIVERSUPPORT; + } + + mode.lpDD = &This->DirectDrawGlobal; + mode.ddRVal = DDERR_NODRIVERSUPPORT; + + /* FIXME : add search for which mode.ModeIndex we should use */ + /* FIXME : fill the mode.inexcl; */ + /* FIXME : fill the mode.useRefreshRate; */ + + /* + if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetMode(&mode) != DDHAL_DRIVER_HANDLED) + { + return DDERR_NODRIVERSUPPORT; + } + */ + + DX_STUB; + /* return mode.ddRVal */ +} _____
Modified: trunk/reactos/lib/ddraw/main/ddraw.c --- trunk/reactos/lib/ddraw/main/ddraw.c 2005-10-30 09:21:03 UTC (rev 18873) +++ trunk/reactos/lib/ddraw/main/ddraw.c 2005-10-30 09:45:10 UTC (rev 18874) @@ -85,6 +85,21 @@
HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight,
DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) { + DWORD ret; + if((ret = Hal_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, + dwBPP, dwRefreshRate, dwFlags)) == DD_OK) + { + return ret; + } + + if((ret = Hel_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, + dwBPP, dwRefreshRate, dwFlags)) == DD_OK) + { + return ret; + } + + return DDERR_NOTINITIALIZED; + IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
// this only for exclusive mode _____
Modified: trunk/reactos/lib/ddraw/rosdraw.h --- trunk/reactos/lib/ddraw/rosdraw.h 2005-10-30 09:21:03 UTC (rev 18873) +++ trunk/reactos/lib/ddraw/rosdraw.h 2005-10-30 09:45:10 UTC (rev 18874) @@ -96,10 +96,13 @@
HRESULT Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine); HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface); +HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight, + DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags);
+ HRESULT Hel_DirectDraw_Initialize (LPDIRECTDRAW7 iface); HRESULT Hel_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface); VOID Hel_DirectDraw_Release (LPDIRECTDRAW7 iface); @@ -112,6 +115,8 @@
HRESULT Hel_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine); HRESULT Hel_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface); +HRESULT Hel_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight, + DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags);
/*********** Macros ***********/ _____
Modified: trunk/reactos/lib/ddraw/soft/ddraw.c --- trunk/reactos/lib/ddraw/soft/ddraw.c 2005-10-30 09:21:03 UTC (rev 18873) +++ trunk/reactos/lib/ddraw/soft/ddraw.c 2005-10-30 09:45:10 UTC (rev 18874) @@ -48,3 +48,49 @@
DX_STUB; }
+HRESULT Hel_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight, + DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) +{ + IDirectDrawImpl* This = (IDirectDrawImpl*)iface; + + // this only for exclusive mode + if(!(This->cooperative_level & DDSCL_EXCLUSIVE)) + return DDERR_NOEXCLUSIVEMODE; + + // change the resolution using normal WinAPI function + DEVMODE mode; + mode.dmSize = sizeof(mode); + mode.dmPelsWidth = dwWidth; + mode.dmPelsHeight = dwHeight; + mode.dmBitsPerPel = dwBPP; + mode.dmDisplayFrequency = dwRefreshRate; + mode.dmFields = 0; + + if(dwWidth) + mode.dmFields |= DM_PELSWIDTH; + if(dwHeight) + mode.dmFields |= DM_PELSHEIGHT; + if(dwBPP) + mode.dmFields |= DM_BITSPERPEL; + if(dwRefreshRate) + mode.dmFields |= DM_DISPLAYFREQUENCY; + + if (ChangeDisplaySettings(&mode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) + return DDERR_UNSUPPORTEDMODE; + + // TODO: reactivate ddraw object, maximize window, set it in foreground + // and set excluive mode (if implemented by the driver) + + /* FIXME fill the DirectDrawGlobal right the modeindex old and new */ + + if(dwWidth) + This->Height = dwWidth; + if(dwHeight) + This->Width = dwHeight; + if(dwBPP) + This->Bpp = dwBPP; + + return DD_OK; +} + +