Move hel SetDisplayMode to hel and write a stub for hal SetDisplayMode.
authorMagnus Olsen <magnus@greatlord.com>
Sun, 30 Oct 2005 09:45:10 +0000 (09:45 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Sun, 30 Oct 2005 09:45:10 +0000 (09:45 +0000)
Hel SetDisplayMode is already implmenet by DrFred

svn path=/trunk/; revision=18874

reactos/lib/ddraw/hal/ddraw.c
reactos/lib/ddraw/main/ddraw.c
reactos/lib/ddraw/rosdraw.h
reactos/lib/ddraw/soft/ddraw.c

index a8e6c0e..d1ac6e5 100644 (file)
@@ -454,5 +454,35 @@ HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
        }
        
        /* 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 */
 }
index 4c5765f..dbbf5d3 100644 (file)
@@ -85,6 +85,21 @@ HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hw
 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
index e6eccbe..d19c522 100644 (file)
@@ -96,6 +96,9 @@ HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
 
 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);
+
 
 
 
@@ -112,6 +115,8 @@ HRESULT Hel_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
 
 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 ***********/
index 3172425..fe20977 100644 (file)
@@ -48,3 +48,49 @@ HRESULT Hel_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
        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;
+}
+
+