Move hel SetDisplayMode to hel and write a stub for hal SetDisplayMode.

Hel SetDisplayMode is already implmenet by DrFred

svn path=/trunk/; revision=18874
This commit is contained in:
Magnus Olsen 2005-10-30 09:45:10 +00:00
parent 97e6b6a100
commit 29de9009cd
4 changed files with 97 additions and 1 deletions

View 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 */
}

View 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

View 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 ***********/

View 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;
}