Kill more of the old design.

svn path=/trunk/; revision=23270
This commit is contained in:
Magnus Olsen 2006-07-24 21:00:01 +00:00
parent af150158bb
commit 36b80aa9b3
4 changed files with 71 additions and 101 deletions

View file

@ -69,32 +69,6 @@ HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,H
}
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;
}

View file

@ -1022,7 +1022,11 @@ HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidt
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 @@ HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidt
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)
// this only for exclusive mode
if(!(This->cooperative_level & DDSCL_EXCLUSIVE))
{
ret = Hal_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, dwRefreshRate, dwFlags);
}
else
{
ret = Hel_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, dwRefreshRate, dwFlags);
return DDERR_NOEXCLUSIVEMODE;
}
if (ret == DD_OK)
{
DdReenableDirectDrawObject(&This->mDDrawGlobal, &dummy);
/* FIXME fill the This->DirectDrawGlobal.vmiData right */
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->mDDrawGlobal.lpExclusiveOwner->hDC = (ULONG_PTR)GetDC( (HWND)This->mDDrawGlobal.lpExclusiveOwner->hWnd);
This->mDdSetMode.ddRVal = DDERR_NOTPALETTIZED;
This->mDdSetMode.dwModeIndex = iMode;
This->mDdSetMode.SetMode(&This->mDdSetMode);
DdReenableDirectDrawObject(&This->mDDrawGlobal, &dummy);
return ret;
/* FIXME fill the This->DirectDrawGlobal.vmiData right */
//This->mDDrawGlobal.lpExclusiveOwner->hDC = (ULONG_PTR)GetDC( (HWND)This->mDDrawGlobal.lpExclusiveOwner->hWnd);
return This->mDdSetMode.ddRVal;
}

View file

@ -29,56 +29,3 @@ HRESULT Hel_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,H
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;
}

View file

@ -36,8 +36,33 @@ DWORD CALLBACK HelDdSetColorKey(LPDDHAL_SETCOLORKEYDATA lpSetColorKey)
*/
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)