Implement HELDdSetmode

1. it is hacked, this small hack need be rewriten later. 
   But lest we got back same compatible we had with our ddraw.dll
   in windows. 

svn path=/trunk/; revision=23246
This commit is contained in:
Magnus Olsen 2006-07-23 15:09:06 +00:00
parent 5bd92faae5
commit a845d3f67d
2 changed files with 294 additions and 18 deletions

View file

@ -218,9 +218,9 @@ HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidt
DX_WINDBG_trace();
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
BOOL dummy = TRUE;
//DDHAL_SETMODEDATA mode;
//BOOL dummy = TRUE;
DX_WINDBG_trace_res((int)dwWidth, (int)dwHeight, (int)dwBPP );
/* FIXME check the refresrate if it same if it not same do the mode switch */
if ((This->mDDrawGlobal.vmiData.dwDisplayHeight == dwHeight) &&
(This->mDDrawGlobal.vmiData.dwDisplayWidth == dwWidth) &&
@ -238,22 +238,127 @@ HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidt
This->mDdSetMode.ddRVal = DDERR_NODRIVERSUPPORT;
// FIXME : add search for which mode.ModeIndex we should use
// FIXME : fill the mode.inexcl;
// FIXME : fill the mode.useRefreshRate;
/* FIXME
we hardcoding modIndex list we should
try getting it from ReactOS instead and compare it
for now a small hack for do, using VBE 3.0 mode
index table todo it.
*/
if (This->mDdSetMode.SetMode(&This->mDdSetMode)!=DDHAL_DRIVER_HANDLED);
/* 320x200 15, 16, 32 */
if ((dwHeight == 200) && (dwWidth == 320) && (dwBPP == 15))
{
This->mDdSetMode.dwModeIndex = 0x10d;
}
if ((dwHeight == 200) && (dwWidth == 320) && (dwBPP == 16))
{
This->mDdSetMode.dwModeIndex = 0x10e;
}
if ((dwHeight == 200) && (dwWidth == 320) && (dwBPP == 32))
{
This->mDdSetMode.dwModeIndex = 0x10f;
}
/* 640x400 8 */
if ((dwHeight == 400) && (dwWidth == 640) && (dwBPP == 8))
{
This->mDdSetMode.dwModeIndex = 0x100;
}
/* 640x480 8, 15, 16 , 32*/
if ((dwHeight == 480) && (dwWidth == 640) && (dwBPP == 8))
{
This->mDdSetMode.dwModeIndex = 0x101;
}
if ((dwHeight == 480) && (dwWidth == 640) && (dwBPP == 15))
{
This->mDdSetMode.dwModeIndex = 0x110;
}
if ((dwHeight == 480) && (dwWidth == 640) && (dwBPP == 16))
{
This->mDdSetMode.dwModeIndex = 0x111;
}
if ((dwHeight == 480) && (dwWidth == 640) && (dwBPP == 32))
{
This->mDdSetMode.dwModeIndex = 0x112;
}
/* 800x600 4, 8, 15, 16 , 32*/
if ((dwHeight == 600) && (dwWidth == 800) && (dwBPP == 4))
{
This->mDdSetMode.dwModeIndex = 0x102;
}
if ((dwHeight == 600) && (dwWidth == 800) && (dwBPP == 8))
{
This->mDdSetMode.dwModeIndex = 0x103;
}
if ((dwHeight == 600) && (dwWidth == 800) && (dwBPP == 15))
{
This->mDdSetMode.dwModeIndex = 0x113;
}
if ((dwHeight == 600) && (dwWidth == 800) && (dwBPP == 16))
{
This->mDdSetMode.dwModeIndex = 0x114;
}
if ((dwHeight == 600) && (dwWidth == 800) && (dwBPP == 32))
{
This->mDdSetMode.dwModeIndex = 0x115;
}
/* 1024x768 8, 15, 16 , 32*/
if ((dwHeight == 768) && (dwWidth == 1024) && (dwBPP == 4))
{
This->mDdSetMode.dwModeIndex = 0x104;
}
if ((dwHeight == 768) && (dwWidth == 1024) && (dwBPP == 8))
{
This->mDdSetMode.dwModeIndex = 0x105;
}
if ((dwHeight == 768) && (dwWidth == 1024) && (dwBPP == 15))
{
This->mDdSetMode.dwModeIndex = 0x116;
}
if ((dwHeight == 768) && (dwWidth == 1024) && (dwBPP == 16))
{
This->mDdSetMode.dwModeIndex = 0x117;
}
if ((dwHeight == 768) && (dwWidth == 1024) && (dwBPP == 32))
{
This->mDdSetMode.dwModeIndex = 0x118;
}
/* not coding for 1280x1024 */
if (This->mDdSetMode.SetMode(&This->mDdSetMode)==DDHAL_DRIVER_HANDLED);
{
This->mDdSetMode.ddRVal = DDERR_NODRIVERSUPPORT;
//if (This->mDdSetMode.ddRVal == DD_OK)
//{
// // DdReenableDirectDrawObject(&This->mDDrawGlobal, &dummy);
// /* FIXME fill the This->DirectDrawGlobal.vmiData right */
//}
return This->mDdSetMode.ddRVal;
}
if (This->mDdSetMode.ddRVal == DD_OK)
{
DdReenableDirectDrawObject(&This->mDDrawGlobal, &dummy);
/* FIXME fill the This->DirectDrawGlobal.vmiData right */
}
return This->mDdSetMode.ddRVal;
return DDERR_NODRIVERSUPPORT;
}

View file

@ -28,16 +28,187 @@ DWORD CALLBACK HelDdCreateSurface(LPDDHAL_CREATESURFACEDATA lpCreateSurface)
DX_STUB;
}
/*
DWORD CALLBACK HelDdSetColorKey(LPDDHAL_SETCOLORKEYDATA lpSetColorKey)
{
DX_STUB;
}
*/
DWORD CALLBACK HelDdSetMode(LPDDHAL_SETMODEDATA SetMode)
{
DX_STUB;
{
// change the resolution using normal WinAPI function
DEVMODE mode;
mode.dmSize = sizeof(DEVMODE);
mode.dmPelsWidth = 0;
mode.dmPelsHeight = 0;
mode.dmBitsPerPel = 0;
/* FIXME use emuate display to get the res */
/* 320x200 15, 16, 32 */
if (SetMode->dwModeIndex == 0x10d)
{
mode.dmPelsWidth = 320;
mode.dmPelsHeight = 200;
mode.dmBitsPerPel = 15;
}
if (SetMode->dwModeIndex == 0x10e)
{
mode.dmPelsWidth = 320;
mode.dmPelsHeight = 200;
mode.dmBitsPerPel = 16;
}
if (SetMode->dwModeIndex == 0x10f)
{
mode.dmPelsWidth = 320;
mode.dmPelsHeight = 200;
mode.dmBitsPerPel = 32;
}
/* 640x400 8 */
if (SetMode->dwModeIndex == 0x100)
{
mode.dmPelsWidth = 640;
mode.dmPelsHeight = 400;
mode.dmBitsPerPel = 8;
}
/* 640x480 8, 15, 16 , 32*/
if (SetMode->dwModeIndex == 0x101)
{
mode.dmPelsWidth = 640;
mode.dmPelsHeight = 480;
mode.dmBitsPerPel = 8;
}
if (SetMode->dwModeIndex == 0x110)
{
mode.dmPelsWidth = 640;
mode.dmPelsHeight = 480;
mode.dmBitsPerPel = 15;
}
if (SetMode->dwModeIndex == 0x111)
{
mode.dmPelsWidth = 640;
mode.dmPelsHeight = 480;
mode.dmBitsPerPel = 16;
}
if (SetMode->dwModeIndex == 0x112)
{
mode.dmPelsWidth = 640;
mode.dmPelsHeight = 480;
mode.dmBitsPerPel = 32;
}
/* 800x600 4, 8, 15, 16 , 32*/
if (SetMode->dwModeIndex == 0x102)
{
mode.dmPelsWidth = 800;
mode.dmPelsHeight = 600;
mode.dmBitsPerPel = 4;
}
if (SetMode->dwModeIndex == 0x103)
{
mode.dmPelsWidth = 800;
mode.dmPelsHeight = 600;
mode.dmBitsPerPel = 8;
}
if (SetMode->dwModeIndex == 0x113)
{
mode.dmPelsWidth = 800;
mode.dmPelsHeight = 600;
mode.dmBitsPerPel = 15;
}
if (SetMode->dwModeIndex == 0x114)
{
mode.dmPelsWidth = 800;
mode.dmPelsHeight = 600;
mode.dmBitsPerPel = 16;
}
if (SetMode->dwModeIndex == 0x115)
{
mode.dmPelsWidth = 800;
mode.dmPelsHeight = 600;
mode.dmBitsPerPel = 32;
}
/* 1024x768 8, 15, 16 , 32*/
if (SetMode->dwModeIndex == 0x104)
{
mode.dmPelsWidth = 1024;
mode.dmPelsHeight = 768;
mode.dmBitsPerPel = 4;
}
if (SetMode->dwModeIndex == 0x105)
{
mode.dmPelsWidth = 1024;
mode.dmPelsHeight = 768;
mode.dmBitsPerPel = 8;
}
if (SetMode->dwModeIndex == 0x116)
{
mode.dmPelsWidth = 1024;
mode.dmPelsHeight = 768;
mode.dmBitsPerPel = 15;
}
if (SetMode->dwModeIndex == 0x117)
{
mode.dmPelsWidth = 1024;
mode.dmPelsHeight = 768;
mode.dmBitsPerPel = 16;
}
if (SetMode->dwModeIndex == 0x118)
{
mode.dmPelsWidth = 1024;
mode.dmPelsHeight = 768;
mode.dmBitsPerPel = 32;
}
//mode.dmDisplayFrequency = dwRefreshRate;
mode.dmFields = 0;
DX_STUB_str("in hel");
if(mode.dmPelsWidth != 0)
mode.dmFields |= DM_PELSWIDTH;
if(mode.dmPelsHeight != 0)
mode.dmFields |= DM_PELSHEIGHT;
if( mode.dmBitsPerPel != 0)
mode.dmFields |= DM_BITSPERPEL;
/*
if(dwRefreshRate)
mode.dmFields |= DM_DISPLAYFREQUENCY;
*/
DX_WINDBG_trace_res((int)mode.dmPelsWidth, (int)mode.dmPelsHeight, (int)mode.dmBitsPerPel );
if (ChangeDisplaySettings(&mode, 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)