Author: greatlrd
Date: Wed Nov 29 00:28:12 2006
New Revision: 24950
URL:
http://svn.reactos.org/svn/reactos?rev=24950&view=rev
Log:
fixing some of the mix betwin hel and hal. (still not complete)
Modified:
trunk/reactos/dll/directx/ddraw/startup.c
Modified: trunk/reactos/dll/directx/ddraw/startup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/startup.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/startup.c (original)
+++ trunk/reactos/dll/directx/ddraw/startup.c Wed Nov 29 00:28:12 2006
@@ -175,318 +175,106 @@
if (This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_CANCREATESURFACE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags = DDHAL_CB32_CANCREATESURFACE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CANCREATESURFACE;
This->lpLcl->lpDDCB->cbDDCallbacks.CanCreateSurface =
This->lpLcl->lpDDCB->HALDD.CanCreateSurface;
}
else if (This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_CANCREATESURFACE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags =
DDHAL_CB32_CANCREATESURFACE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |=
DDHAL_CB32_CANCREATESURFACE;
This->lpLcl->lpDDCB->cbDDCallbacks.CanCreateSurface =
This->lpLcl->lpDDCB->HELDD.CanCreateSurface;
}
if (This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_CREATESURFACE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags = DDHAL_CB32_CREATESURFACE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CREATESURFACE;
This->lpLcl->lpDDCB->cbDDCallbacks.CreateSurface =
This->lpLcl->lpDDCB->HALDD.CreateSurface;
}
else if (This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_CREATESURFACE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags =
DDHAL_CB32_CREATESURFACE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |=
DDHAL_CB32_CREATESURFACE;
This->lpLcl->lpDDCB->cbDDCallbacks.CreateSurface =
This->lpLcl->lpDDCB->HELDD.CreateSurface;
}
if (This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_CREATEPALETTE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags = DDHAL_CB32_CREATEPALETTE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_CREATEPALETTE;
This->lpLcl->lpDDCB->cbDDCallbacks.CreatePalette =
This->lpLcl->lpDDCB->HALDD.CreatePalette;
}
else if (This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_CREATEPALETTE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags =
DDHAL_CB32_CREATEPALETTE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |=
DDHAL_CB32_CREATEPALETTE;
This->lpLcl->lpDDCB->cbDDCallbacks.CreatePalette =
This->lpLcl->lpDDCB->HELDD.CreatePalette;
}
if (This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_DESTROYDRIVER)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags = DDHAL_CB32_DESTROYDRIVER;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_DESTROYDRIVER;
This->lpLcl->lpDDCB->cbDDCallbacks.DestroyDriver =
This->lpLcl->lpDDCB->HALDD.DestroyDriver;
}
else if (This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_DESTROYDRIVER)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags =
DDHAL_CB32_DESTROYDRIVER;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |=
DDHAL_CB32_DESTROYDRIVER;
This->lpLcl->lpDDCB->cbDDCallbacks.DestroyDriver =
This->lpLcl->lpDDCB->HELDD.DestroyDriver;
}
if (This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags =
DDHAL_CB32_FLIPTOGDISURFACE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |=
DDHAL_CB32_FLIPTOGDISURFACE;
This->lpLcl->lpDDCB->cbDDCallbacks.FlipToGDISurface =
This->lpLcl->lpDDCB->HALDD.FlipToGDISurface;
}
else if (This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags =
DDHAL_CB32_FLIPTOGDISURFACE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |=
DDHAL_CB32_FLIPTOGDISURFACE;
This->lpLcl->lpDDCB->cbDDCallbacks.FlipToGDISurface =
This->lpLcl->lpDDCB->HELDD.FlipToGDISurface;
}
if (This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags = DDHAL_CB32_GETSCANLINE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_GETSCANLINE;
This->lpLcl->lpDDCB->cbDDCallbacks.GetScanLine =
This->lpLcl->lpDDCB->HALDD.GetScanLine;
}
else if (This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_GETSCANLINE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags =
DDHAL_CB32_GETSCANLINE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |=
DDHAL_CB32_GETSCANLINE;
This->lpLcl->lpDDCB->cbDDCallbacks.GetScanLine =
This->lpLcl->lpDDCB->HELDD.GetScanLine;
}
if (This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_SETCOLORKEY)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags = DDHAL_CB32_SETCOLORKEY;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETCOLORKEY;
This->lpLcl->lpDDCB->cbDDCallbacks.SetColorKey =
This->lpLcl->lpDDCB->HALDD.SetColorKey;
}
else if (This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_SETCOLORKEY)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags =
DDHAL_CB32_SETCOLORKEY;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |=
DDHAL_CB32_SETCOLORKEY;
This->lpLcl->lpDDCB->cbDDCallbacks.SetColorKey =
This->lpLcl->lpDDCB->HELDD.SetColorKey;
}
if (This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags =
DDHAL_CB32_SETEXCLUSIVEMODE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |=
DDHAL_CB32_SETEXCLUSIVEMODE;
This->lpLcl->lpDDCB->cbDDCallbacks.SetExclusiveMode =
This->lpLcl->lpDDCB->HALDD.SetExclusiveMode;
}
else if (This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags =
DDHAL_CB32_SETEXCLUSIVEMODE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |=
DDHAL_CB32_SETEXCLUSIVEMODE;
This->lpLcl->lpDDCB->cbDDCallbacks.SetExclusiveMode =
This->lpLcl->lpDDCB->HELDD.SetExclusiveMode;
}
if (This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_SETMODE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags = DDHAL_CB32_SETMODE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETMODE;
This->lpLcl->lpDDCB->cbDDCallbacks.SetMode =
This->lpLcl->lpDDCB->HALDD.SetMode;
}
else if (This->lpLcl->lpDDCB->HELDD.dwFlags & DDHAL_CB32_SETMODE)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags = DDHAL_CB32_SETMODE;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |= DDHAL_CB32_SETMODE;
This->lpLcl->lpDDCB->cbDDCallbacks.SetMode =
This->lpLcl->lpDDCB->HELDD.SetMode;
}
if (This->lpLcl->lpDDCB->HALDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags =
DDHAL_CB32_WAITFORVERTICALBLANK;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |=
DDHAL_CB32_WAITFORVERTICALBLANK;
This->lpLcl->lpDDCB->cbDDCallbacks.WaitForVerticalBlank =
This->lpLcl->lpDDCB->HALDD.WaitForVerticalBlank;
}
else if (This->lpLcl->lpDDCB->HELDD.dwFlags &
DDHAL_CB32_WAITFORVERTICALBLANK)
{
- This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags =
DDHAL_CB32_WAITFORVERTICALBLANK;
+ This->lpLcl->lpDDCB->cbDDCallbacks.dwFlags |=
DDHAL_CB32_WAITFORVERTICALBLANK;
This->lpLcl->lpDDCB->cbDDCallbacks.WaitForVerticalBlank =
This->lpLcl->lpDDCB->HELDD.WaitForVerticalBlank;
}
-
-
-
-
-
-
-
-
-
- /* Fill some basic info for Surface */
- ddSurfGbl.lpDD = &ddgbl;
-
-
- return DD_OK;
-}
-
-
-HRESULT WINAPI
-StartDirectDrawHal(LPDIRECTDRAW* iface)
-{
- LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
- DDHAL_GETDRIVERINFODATA DriverInfo;
-
- DDHALINFO mHALInfo;
- DDHAL_CALLBACKS mCallbacks;
- DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks;
- D3DHAL_CALLBACKS mD3dCallbacks;
- D3DHAL_GLOBALDRIVERDATA mD3dDriverData;
- UINT mcvmList;
- VIDMEM *mpvmList;
-
- UINT mcFourCC;
- DWORD *mpFourCC;
- UINT mcTextures;
- DDSURFACEDESC *mpTextures;
-
- /* HAL Startup process */
- BOOL newmode = FALSE;
-
-
- RtlZeroMemory(&mHALInfo, sizeof(DDHALINFO));
- RtlZeroMemory(&mCallbacks, sizeof(DDHAL_CALLBACKS));
-
- /*
- Startup DX HAL step one of three
- */
- if (!DdCreateDirectDrawObject(This->lpLcl->lpGbl, (HDC)This->lpLcl->hDC))
- {
- DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
- DeleteDC((HDC)This->lpLcl->hDC);
- return DD_FALSE;
- }
-
- // Do not relase HDC it have been map in kernel mode
- // DeleteDC(hdc);
-
- if (!DdReenableDirectDrawObject(This->lpLcl->lpGbl, &newmode))
- {
- DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
- DeleteDC((HDC)This->lpLcl->hDC);
- return DD_FALSE;
- }
-
-
- /*
- Startup DX HAL step two of three
- */
-
- if (!DdQueryDirectDrawObject(This->lpLcl->lpGbl,
- &mHALInfo,
- &mCallbacks.HALDD,
- &mCallbacks.HALDDSurface,
- &mCallbacks.HALDDPalette,
- &mD3dCallbacks,
- &mD3dDriverData,
- &mD3dBufferCallbacks,
- NULL,
- NULL,
- NULL))
- {
- DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
- DeleteDC((HDC)This->lpLcl->hDC);
- // FIXME Close DX fristcall and second call
- return DD_FALSE;
- }
-
- mcvmList = mHALInfo.vmiData.dwNumHeaps;
- mpvmList = (VIDMEM*) DxHeapMemAlloc(sizeof(VIDMEM) * mcvmList);
- if (mpvmList == NULL)
- {
- DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
- DeleteDC((HDC)This->lpLcl->hDC);
- // FIXME Close DX fristcall and second call
- return DD_FALSE;
- }
-
- mcFourCC = mHALInfo.ddCaps.dwNumFourCCCodes;
- mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * mcFourCC);
- if (mpFourCC == NULL)
- {
- DxHeapMemFree(mpvmList);
- DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
- DeleteDC((HDC)This->lpLcl->hDC);
- // FIXME Close DX fristcall and second call
- return DD_FALSE;
- }
-
- mcTextures = mD3dDriverData.dwNumTextureFormats;
- mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) * mcTextures);
- if (mpTextures == NULL)
- {
- DxHeapMemFree( mpFourCC);
- DxHeapMemFree( mpvmList);
- DxHeapMemFree( This->lpLcl->lpGbl->lpModeInfo);
- DeleteDC((HDC)This->lpLcl->hDC);
- // FIXME Close DX fristcall and second call
- return DD_FALSE;
- }
-
- mHALInfo.vmiData.pvmList = mpvmList;
- mHALInfo.lpdwFourCC = mpFourCC;
- mD3dDriverData.lpTextureFormats = (DDSURFACEDESC*) mpTextures;
-
- if (!DdQueryDirectDrawObject(
- This->lpLcl->lpGbl,
- &mHALInfo,
- &mCallbacks.HALDD,
- &mCallbacks.HALDDSurface,
- &mCallbacks.HALDDPalette,
- &mD3dCallbacks,
- &mD3dDriverData,
- &mCallbacks.HALDDExeBuf,
- (DDSURFACEDESC*)mpTextures,
- mpFourCC,
- mpvmList))
-
- {
- DxHeapMemFree(mpTextures);
- DxHeapMemFree(mpFourCC);
- DxHeapMemFree(mpvmList);
- DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
- DeleteDC((HDC)This->lpLcl->hDC);
- // FIXME Close DX fristcall and second call
- return DD_FALSE;
- }
-
- /*
- Copy over from HalInfo to DirectDrawGlobal
- */
-
- // this is wrong, cDriverName need be in ASC code not UNICODE
- //memcpy(mDDrawGlobal.cDriverName, mDisplayAdapter, sizeof(wchar)*MAX_DRIVER_NAME);
-
- memcpy(&ddgbl.vmiData, &mHALInfo.vmiData,sizeof(VIDMEMINFO));
- memcpy(&ddgbl.ddCaps, &mHALInfo.ddCaps,sizeof(DDCORECAPS));
-
- mHALInfo.dwNumModes = 1;
- mHALInfo.lpModeInfo = This->lpLcl->lpGbl->lpModeInfo;
- mHALInfo.dwMonitorFrequency = This->lpLcl->lpGbl->lpModeInfo[0].wRefreshRate;
-
- This->lpLcl->lpGbl->dwMonitorFrequency = mHALInfo.dwMonitorFrequency;
- This->lpLcl->lpGbl->dwModeIndex = mHALInfo.dwModeIndex;
- This->lpLcl->lpGbl->dwNumModes = mHALInfo.dwNumModes;
- This->lpLcl->lpGbl->lpModeInfo = mHALInfo.lpModeInfo;
- This->lpLcl->lpGbl->hInstance = mHALInfo.hInstance;
-
- This->lpLcl->lpGbl->lp16DD = This->lpLcl->lpGbl;
-
-
- memset(&DriverInfo,0, sizeof(DDHAL_GETDRIVERINFODATA));
- DriverInfo.dwSize = sizeof(DDHAL_GETDRIVERINFODATA);
- DriverInfo.dwContext = This->lpLcl->lpGbl->hDD;
-
- /* Get the MiscellaneousCallbacks */
- DriverInfo.guidInfo = GUID_MiscellaneousCallbacks;
- DriverInfo.lpvData = &ddgbl.lpDDCBtmp->HALDDMiscellaneous;
- DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS);
- mHALInfo.GetDriverInfo(&DriverInfo);
-
-
- return DD_OK;
-}
-
-HRESULT WINAPI
-StartDirectDrawHel(LPDIRECTDRAW* iface)
-{
- LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
-
- This->lpLcl->lpDDCB->HELDD.CanCreateSurface = HelDdCanCreateSurface;
- This->lpLcl->lpDDCB->HELDD.CreateSurface = HelDdCreateSurface;
- This->lpLcl->lpDDCB->HELDD.CreatePalette = HelDdCreatePalette;
- This->lpLcl->lpDDCB->HELDD.DestroyDriver = HelDdDestroyDriver;
- //This->lpLcl->lpDDCB->HELDD.FlipToGDISurface = HelDdFlipToGDISurface
- This->lpLcl->lpDDCB->HELDD.GetScanLine = HelDdGetScanLine;
- // This->lpLcl->lpDDCB->HELDD.SetColorKey = HelDdSetColorKey;
- This->lpLcl->lpDDCB->HELDD.SetExclusiveMode = HelDdSetExclusiveMode;
- This->lpLcl->lpDDCB->HELDD.SetMode = HelDdSetMode;
- This->lpLcl->lpDDCB->HELDD.WaitForVerticalBlank = HelDdWaitForVerticalBlank;
-
- This->lpLcl->lpDDCB->HELDD.dwFlags = DDHAL_CB32_CANCREATESURFACE |
- DDHAL_CB32_CREATESURFACE |
- DDHAL_CB32_CREATEPALETTE |
- DDHAL_CB32_DESTROYDRIVER |
- // DDHAL_CB32_FLIPTOGDISURFACE |
- DDHAL_CB32_GETSCANLINE |
- // DDHAL_CB32_SETCOLORKEY |
- DDHAL_CB32_SETEXCLUSIVEMODE |
- DDHAL_CB32_SETMODE |
- DDHAL_CB32_WAITFORVERTICALBLANK ;
-
-
- This->lpLcl->lpDDCB->HELDD.dwSize =
sizeof(This->lpLcl->lpDDCB->HELDD);
-
+
/*
This->lpLcl->lpDDCB->HELDDSurface.AddAttachedSurface =
HelDdSurfAddAttachedSurface;
This->lpLcl->lpDDCB->HELDDSurface.Blt = HelDdSurfBlt;
@@ -510,6 +298,298 @@
This->lpLcl->lpDDCB->HELDDPalette.dwSize =
sizeof(This->lpLcl->lpDDCB->HELDDPalette);
*/
+ if (This->lpLcl->lpDDCB->HALDDSurface.dwFlags &
DDHAL_EXEBUFCB32_CANCREATEEXEBUF)
+ {
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.CanCreateExecuteBuffer =
+ This->lpLcl->lpDDCB->HALDDExeBuf.CanCreateExecuteBuffer;
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |=
DDHAL_EXEBUFCB32_CANCREATEEXEBUF;
+ }
+ else if (This->lpLcl->lpDDCB->HELDDSurface.dwFlags &
DDHAL_EXEBUFCB32_CANCREATEEXEBUF)
+ {
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.CanCreateExecuteBuffer =
+ This->lpLcl->lpDDCB->HELDDExeBuf.CanCreateExecuteBuffer;
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |=
DDHAL_EXEBUFCB32_CANCREATEEXEBUF;
+ }
+
+ if (This->lpLcl->lpDDCB->HALDDSurface.dwFlags &
DDHAL_EXEBUFCB32_CREATEEXEBUF)
+ {
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.CreateExecuteBuffer =
+ This->lpLcl->lpDDCB->HALDDExeBuf.CreateExecuteBuffer;
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |=
DDHAL_EXEBUFCB32_CREATEEXEBUF;
+ }
+ else if (This->lpLcl->lpDDCB->HELDDSurface.dwFlags &
DDHAL_EXEBUFCB32_CREATEEXEBUF)
+ {
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.CreateExecuteBuffer =
+ This->lpLcl->lpDDCB->HELDDExeBuf.CreateExecuteBuffer;
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |=
DDHAL_EXEBUFCB32_CREATEEXEBUF;
+ }
+
+ if (This->lpLcl->lpDDCB->HALDDSurface.dwFlags &
DDHAL_EXEBUFCB32_DESTROYEXEBUF)
+ {
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.DestroyExecuteBuffer =
+ This->lpLcl->lpDDCB->HALDDExeBuf.DestroyExecuteBuffer;
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |=
DDHAL_EXEBUFCB32_DESTROYEXEBUF;
+ }
+ else if (This->lpLcl->lpDDCB->HELDDSurface.dwFlags &
DDHAL_EXEBUFCB32_DESTROYEXEBUF)
+ {
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.DestroyExecuteBuffer =
+ This->lpLcl->lpDDCB->HELDDExeBuf.DestroyExecuteBuffer;
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |=
DDHAL_EXEBUFCB32_DESTROYEXEBUF;
+ }
+
+ if (This->lpLcl->lpDDCB->HALDDSurface.dwFlags &
DDHAL_EXEBUFCB32_LOCKEXEBUF)
+ {
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.LockExecuteBuffer =
+ This->lpLcl->lpDDCB->HALDDExeBuf.LockExecuteBuffer;
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |=
DDHAL_EXEBUFCB32_LOCKEXEBUF;
+ }
+ else if (This->lpLcl->lpDDCB->HELDDSurface.dwFlags &
DDHAL_EXEBUFCB32_LOCKEXEBUF)
+ {
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.LockExecuteBuffer =
+ This->lpLcl->lpDDCB->HELDDExeBuf.LockExecuteBuffer;
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |=
DDHAL_EXEBUFCB32_LOCKEXEBUF;
+ }
+
+ if (This->lpLcl->lpDDCB->HALDDSurface.dwFlags &
DDHAL_EXEBUFCB32_UNLOCKEXEBUF)
+ {
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.UnlockExecuteBuffer =
+ This->lpLcl->lpDDCB->HALDDExeBuf.UnlockExecuteBuffer;
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |=
DDHAL_EXEBUFCB32_UNLOCKEXEBUF;
+ }
+ else if (This->lpLcl->lpDDCB->HELDDSurface.dwFlags &
DDHAL_EXEBUFCB32_UNLOCKEXEBUF)
+ {
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.UnlockExecuteBuffer =
+ This->lpLcl->lpDDCB->HELDDExeBuf.UnlockExecuteBuffer;
+ This->lpLcl->lpDDCB->cbDDExeBufCallbacks.dwFlags |=
DDHAL_EXEBUFCB32_UNLOCKEXEBUF;
+ }
+
+ /* Fill some basic info for Surface */
+ ddSurfGbl.lpDD = &ddgbl;
+
+
+ return DD_OK;
+}
+
+
+HRESULT WINAPI
+StartDirectDrawHal(LPDIRECTDRAW* iface)
+{
+ LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
+ DDHAL_GETDRIVERINFODATA DriverInfo;
+
+ DDHALINFO mHALInfo;
+ DDHAL_CALLBACKS mCallbacks;
+ DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks;
+ D3DHAL_CALLBACKS mD3dCallbacks;
+ D3DHAL_GLOBALDRIVERDATA mD3dDriverData;
+ UINT mcvmList;
+ VIDMEM *mpvmList;
+
+ UINT mcFourCC;
+ DWORD *mpFourCC;
+ UINT mcTextures;
+ DDSURFACEDESC *mpTextures;
+
+ /* HAL Startup process */
+ BOOL newmode = FALSE;
+
+
+ RtlZeroMemory(&mHALInfo, sizeof(DDHALINFO));
+ RtlZeroMemory(&mCallbacks, sizeof(DDHAL_CALLBACKS));
+
+ /*
+ Startup DX HAL step one of three
+ */
+ if (!DdCreateDirectDrawObject(This->lpLcl->lpGbl, (HDC)This->lpLcl->hDC))
+ {
+ DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
+ DeleteDC((HDC)This->lpLcl->hDC);
+ return DD_FALSE;
+ }
+
+ // Do not relase HDC it have been map in kernel mode
+ // DeleteDC(hdc);
+
+ if (!DdReenableDirectDrawObject(This->lpLcl->lpGbl, &newmode))
+ {
+ DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
+ DeleteDC((HDC)This->lpLcl->hDC);
+ return DD_FALSE;
+ }
+
+
+ /*
+ Startup DX HAL step two of three
+ */
+
+ if (!DdQueryDirectDrawObject(This->lpLcl->lpGbl,
+ &mHALInfo,
+ &mCallbacks.HALDD,
+ &mCallbacks.HALDDSurface,
+ &mCallbacks.HALDDPalette,
+ &mD3dCallbacks,
+ &mD3dDriverData,
+ &mD3dBufferCallbacks,
+ NULL,
+ NULL,
+ NULL))
+ {
+ DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
+ DeleteDC((HDC)This->lpLcl->hDC);
+ // FIXME Close DX fristcall and second call
+ return DD_FALSE;
+ }
+
+ mcvmList = mHALInfo.vmiData.dwNumHeaps;
+ mpvmList = (VIDMEM*) DxHeapMemAlloc(sizeof(VIDMEM) * mcvmList);
+ if (mpvmList == NULL)
+ {
+ DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
+ DeleteDC((HDC)This->lpLcl->hDC);
+ // FIXME Close DX fristcall and second call
+ return DD_FALSE;
+ }
+
+ mcFourCC = mHALInfo.ddCaps.dwNumFourCCCodes;
+ mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * mcFourCC);
+ if (mpFourCC == NULL)
+ {
+ DxHeapMemFree(mpvmList);
+ DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
+ DeleteDC((HDC)This->lpLcl->hDC);
+ // FIXME Close DX fristcall and second call
+ return DD_FALSE;
+ }
+
+ mcTextures = mD3dDriverData.dwNumTextureFormats;
+ mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) * mcTextures);
+ if (mpTextures == NULL)
+ {
+ DxHeapMemFree( mpFourCC);
+ DxHeapMemFree( mpvmList);
+ DxHeapMemFree( This->lpLcl->lpGbl->lpModeInfo);
+ DeleteDC((HDC)This->lpLcl->hDC);
+ // FIXME Close DX fristcall and second call
+ return DD_FALSE;
+ }
+
+ mHALInfo.vmiData.pvmList = mpvmList;
+ mHALInfo.lpdwFourCC = mpFourCC;
+ mD3dDriverData.lpTextureFormats = (DDSURFACEDESC*) mpTextures;
+
+ if (!DdQueryDirectDrawObject(
+ This->lpLcl->lpGbl,
+ &mHALInfo,
+ &mCallbacks.HALDD,
+ &mCallbacks.HALDDSurface,
+ &mCallbacks.HALDDPalette,
+ &mD3dCallbacks,
+ &mD3dDriverData,
+ &mCallbacks.HALDDExeBuf,
+ (DDSURFACEDESC*)mpTextures,
+ mpFourCC,
+ mpvmList))
+
+ {
+ DxHeapMemFree(mpTextures);
+ DxHeapMemFree(mpFourCC);
+ DxHeapMemFree(mpvmList);
+ DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
+ DeleteDC((HDC)This->lpLcl->hDC);
+ // FIXME Close DX fristcall and second call
+ return DD_FALSE;
+ }
+
+ /*
+ Copy over from HalInfo to DirectDrawGlobal
+ */
+
+ // this is wrong, cDriverName need be in ASC code not UNICODE
+ //memcpy(mDDrawGlobal.cDriverName, mDisplayAdapter, sizeof(wchar)*MAX_DRIVER_NAME);
+
+ memcpy(&ddgbl.vmiData, &mHALInfo.vmiData,sizeof(VIDMEMINFO));
+ memcpy(&ddgbl.ddCaps, &mHALInfo.ddCaps,sizeof(DDCORECAPS));
+
+ mHALInfo.dwNumModes = 1;
+ mHALInfo.lpModeInfo = This->lpLcl->lpGbl->lpModeInfo;
+ mHALInfo.dwMonitorFrequency = This->lpLcl->lpGbl->lpModeInfo[0].wRefreshRate;
+
+ This->lpLcl->lpGbl->dwMonitorFrequency = mHALInfo.dwMonitorFrequency;
+ This->lpLcl->lpGbl->dwModeIndex = mHALInfo.dwModeIndex;
+ This->lpLcl->lpGbl->dwNumModes = mHALInfo.dwNumModes;
+ This->lpLcl->lpGbl->lpModeInfo = mHALInfo.lpModeInfo;
+ This->lpLcl->lpGbl->hInstance = mHALInfo.hInstance;
+
+ This->lpLcl->lpGbl->lp16DD = This->lpLcl->lpGbl;
+
+
+ memset(&DriverInfo,0, sizeof(DDHAL_GETDRIVERINFODATA));
+ DriverInfo.dwSize = sizeof(DDHAL_GETDRIVERINFODATA);
+ DriverInfo.dwContext = This->lpLcl->lpGbl->hDD;
+
+ /* Get the MiscellaneousCallbacks */
+ DriverInfo.guidInfo = GUID_MiscellaneousCallbacks;
+ DriverInfo.lpvData = &ddgbl.lpDDCBtmp->HALDDMiscellaneous;
+ DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS);
+ mHALInfo.GetDriverInfo(&DriverInfo);
+
+
+ return DD_OK;
+}
+
+HRESULT WINAPI
+StartDirectDrawHel(LPDIRECTDRAW* iface)
+{
+ LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
+
+ This->lpLcl->lpDDCB->HELDD.CanCreateSurface = HelDdCanCreateSurface;
+ This->lpLcl->lpDDCB->HELDD.CreateSurface = HelDdCreateSurface;
+ This->lpLcl->lpDDCB->HELDD.CreatePalette = HelDdCreatePalette;
+ This->lpLcl->lpDDCB->HELDD.DestroyDriver = HelDdDestroyDriver;
+ //This->lpLcl->lpDDCB->HELDD.FlipToGDISurface = HelDdFlipToGDISurface
+ This->lpLcl->lpDDCB->HELDD.GetScanLine = HelDdGetScanLine;
+ // This->lpLcl->lpDDCB->HELDD.SetColorKey = HelDdSetColorKey;
+ This->lpLcl->lpDDCB->HELDD.SetExclusiveMode = HelDdSetExclusiveMode;
+ This->lpLcl->lpDDCB->HELDD.SetMode = HelDdSetMode;
+ This->lpLcl->lpDDCB->HELDD.WaitForVerticalBlank = HelDdWaitForVerticalBlank;
+
+ This->lpLcl->lpDDCB->HELDD.dwFlags = DDHAL_CB32_CANCREATESURFACE |
+ DDHAL_CB32_CREATESURFACE |
+ DDHAL_CB32_CREATEPALETTE |
+ DDHAL_CB32_DESTROYDRIVER |
+ // DDHAL_CB32_FLIPTOGDISURFACE |
+ DDHAL_CB32_GETSCANLINE |
+ // DDHAL_CB32_SETCOLORKEY |
+ DDHAL_CB32_SETEXCLUSIVEMODE |
+ DDHAL_CB32_SETMODE |
+ DDHAL_CB32_WAITFORVERTICALBLANK ;
+
+
+ This->lpLcl->lpDDCB->HELDD.dwSize =
sizeof(This->lpLcl->lpDDCB->HELDD);
+
+ /*
+ This->lpLcl->lpDDCB->HELDDSurface.AddAttachedSurface =
HelDdSurfAddAttachedSurface;
+ This->lpLcl->lpDDCB->HELDDSurface.Blt = HelDdSurfBlt;
+ This->lpLcl->lpDDCB->HELDDSurface.DestroySurface = HelDdSurfDestroySurface;
+ This->lpLcl->lpDDCB->HELDDSurface.Flip = HelDdSurfFlip;
+ This->lpLcl->lpDDCB->HELDDSurface.GetBltStatus = HelDdSurfGetBltStatus;
+ This->lpLcl->lpDDCB->HELDDSurface.GetFlipStatus = HelDdSurfGetFlipStatus;
+ This->lpLcl->lpDDCB->HELDDSurface.Lock = HelDdSurfLock;
+ This->lpLcl->lpDDCB->HELDDSurface.reserved4 = HelDdSurfreserved4;
+ This->lpLcl->lpDDCB->HELDDSurface.SetClipList = HelDdSurfSetClipList;
+ This->lpLcl->lpDDCB->HELDDSurface.SetColorKey = HelDdSurfSetColorKey;
+ This->lpLcl->lpDDCB->HELDDSurface.SetOverlayPosition =
HelDdSurfSetOverlayPosition;
+ This->lpLcl->lpDDCB->HELDDSurface.SetPalette = HelDdSurfSetPalette;
+ This->lpLcl->lpDDCB->HELDDSurface.Unlock = HelDdSurfUnlock;
+ This->lpLcl->lpDDCB->HELDDSurface.UpdateOverlay = HelDdSurfUpdateOverlay;
+ */
+
+ /*
+ This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette = HelDdPalDestroyPalette;
+ This->lpLcl->lpDDCB->HELDDPalette.SetEntries = HelDdPalSetEntries;
+ This->lpLcl->lpDDCB->HELDDPalette.dwSize =
sizeof(This->lpLcl->lpDDCB->HELDDPalette);
+ */
+
/*
This->lpLcl->lpDDCB->HELDDExeBuf.CanCreateExecuteBuffer =
HelDdExeCanCreateExecuteBuffer;
This->lpLcl->lpDDCB->HELDDExeBuf.CreateExecuteBuffer =
HelDdExeCreateExecuteBuffer;