Author: greatlrd
Date: Tue Jul 25 01:00:01 2006
New Revision: 23270
URL:
http://svn.reactos.org/svn/reactos?rev=23270&view=rev
Log:
Kill more of the old design.
Modified:
trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c
trunk/reactos/dll/directx/ddraw/main/ddraw_main.c
trunk/reactos/dll/directx/ddraw/soft/ddraw_hel.c
trunk/reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c
Modified: trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/hal/ddra…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c (original)
+++ trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c Tue Jul 25 01:00:01 2006
@@ -69,32 +69,6 @@
}
-HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD
dwHeight,
- DWORD dwBPP, DWORD dwRefreshRate,
DWORD dwFlags)
-{
- IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
- DDHAL_SETMODEDATA mode;
-
- if (!(This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE))
- {
- return DDERR_NODRIVERSUPPORT;
- }
-
- mode.lpDD = &This->mDDrawGlobal;
- 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->mDDrawGlobal.lpDDCBtmp->HALDD.SetMode(&mode) !=
DDHAL_DRIVER_HANDLED)
- {
- return DDERR_NODRIVERSUPPORT;
- }
-
- return mode.ddRVal;
-}
+
Modified: trunk/reactos/dll/directx/ddraw/main/ddraw_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main/ddr…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/main/ddraw_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/main/ddraw_main.c Tue Jul 25 01:00:01 2006
@@ -1022,7 +1022,11 @@
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
BOOL dummy = TRUE;
- DWORD ret;
+ DEVMODE DevMode;
+ int iMode=0;
+ int Width=0;
+ int Height=0;
+ int BPP=0;
/* FIXME check the refresrate if it same if it not same do the mode switch */
if ((This->mDDrawGlobal.vmiData.dwDisplayHeight == dwHeight) &&
@@ -1033,29 +1037,49 @@
return DD_OK;
}
+ if (This->mDdSetMode.SetMode == NULL)
+ {
+ return DDERR_NODRIVERSUPPORT;
+ }
+
/* Check use the Hal or Hel for SetMode */
- if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE)
- {
- ret = Hal_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, dwRefreshRate,
dwFlags);
-
- }
- else
- {
- ret = Hel_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, dwRefreshRate,
dwFlags);
- }
-
- if (ret == DD_OK)
- {
- DdReenableDirectDrawObject(&This->mDDrawGlobal, &dummy);
- /* FIXME fill the This->DirectDrawGlobal.vmiData right */
- }
-
- //This->mDDrawGlobal.lpExclusiveOwner->hDC = (ULONG_PTR)GetDC(
(HWND)This->mDDrawGlobal.lpExclusiveOwner->hWnd);
-
-
-
-
- return ret;
+ // this only for exclusive mode
+ if(!(This->cooperative_level & DDSCL_EXCLUSIVE))
+ {
+ return DDERR_NOEXCLUSIVEMODE;
+ }
+
+ DevMode.dmSize = (WORD)sizeof(DEVMODE);
+ DevMode.dmDriverExtra = 0;
+
+ while (EnumDisplaySettingsEx(NULL, iMode, &DevMode, 0 ) != 0)
+ {
+
+ if ((dwWidth == DevMode.dmPelsWidth) && (dwHeight == DevMode.dmPelsHeight)
&& ( dwBPP == DevMode.dmBitsPerPel))
+ {
+ Width = DevMode.dmPelsWidth;
+ Height = DevMode.dmPelsHeight;
+ BPP = DevMode.dmBitsPerPel;
+ break;
+ }
+ iMode++;
+ }
+
+ if ((dwWidth != DevMode.dmPelsWidth) || (dwHeight != DevMode.dmPelsHeight) || ( dwBPP !=
DevMode.dmBitsPerPel))
+ {
+ return DDERR_UNSUPPORTEDMODE;
+ }
+
+ This->mDdSetMode.ddRVal = DDERR_NOTPALETTIZED;
+
+ This->mDdSetMode.dwModeIndex = iMode;
+ This->mDdSetMode.SetMode(&This->mDdSetMode);
+
+ DdReenableDirectDrawObject(&This->mDDrawGlobal, &dummy);
+
+ /* FIXME fill the This->DirectDrawGlobal.vmiData right */
+ //This->mDDrawGlobal.lpExclusiveOwner->hDC = (ULONG_PTR)GetDC(
(HWND)This->mDDrawGlobal.lpExclusiveOwner->hWnd);
+ return This->mDdSetMode.ddRVal;
}
Modified: trunk/reactos/dll/directx/ddraw/soft/ddraw_hel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/soft/ddr…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/soft/ddraw_hel.c (original)
+++ trunk/reactos/dll/directx/ddraw/soft/ddraw_hel.c Tue Jul 25 01:00:01 2006
@@ -29,56 +29,3 @@
-
-
-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;
-
- DX_STUB_str("in hel");
-
- 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;
-}
-
-
Modified: trunk/reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/soft/sur…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c (original)
+++ trunk/reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c Tue Jul 25 01:00:01 2006
@@ -36,8 +36,33 @@
*/
DWORD CALLBACK HelDdSetMode(LPDDHAL_SETMODEDATA SetMode)
-{
- DX_STUB;
+{
+ DEVMODE DevMode;
+
+ DX_STUB_str("in hel");
+
+ DevMode.dmSize = (WORD)sizeof(DEVMODE);
+ DevMode.dmDriverExtra = 0;
+
+ SetMode->ddRVal = DDERR_UNSUPPORTEDMODE;
+
+ if (EnumDisplaySettingsEx(NULL, SetMode->dwModeIndex, &DevMode, 0 ) != 0)
+ {
+ DX_WINDBG_trace_res((int)DevMode.dmPelsWidth, (int)DevMode.dmPelsHeight,
(int)DevMode.dmBitsPerPel );
+
+ if (ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN) !=
DISP_CHANGE_SUCCESSFUL)
+ {
+ DX_STUB_str("FAIL");
+ SetMode->ddRVal = DDERR_UNSUPPORTEDMODE;
+ }
+ else
+ {
+ DX_STUB_str("OK");
+ SetMode->ddRVal = DD_OK;
+ }
+ }
+
+ return DDHAL_DRIVER_HANDLED;
}
DWORD CALLBACK HelDdWaitForVerticalBlank(LPDDHAL_WAITFORVERTICALBLANKDATA
lpWaitForVerticalBlank)