Setup the hal inisate bit more. and commect the code. We still does not insate hal right yet. Modified: trunk/reactos/lib/ddraw/hal/ddraw.c _____
Modified: trunk/reactos/lib/ddraw/hal/ddraw.c --- trunk/reactos/lib/ddraw/hal/ddraw.c 2005-10-29 16:00:00 UTC (rev 18853) +++ trunk/reactos/lib/ddraw/hal/ddraw.c 2005-10-29 18:57:45 UTC (rev 18854) @@ -23,9 +23,7 @@
if(!DdCreateDirectDrawObject (&This->DirectDrawGlobal, This->hdc)) return DDERR_INVALIDPARAMS;
- - - + /* alloc all the space */ This->DirectDrawGlobal.lpDDCBtmp = (LPDDHAL_CALLBACKS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DDHAL_CALLBACKS)); This->DirectDrawGlobal.lpD3DHALCallbacks = (ULONG_PTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY, sizeof(D3DHAL_CALLBACKS)); @@ -40,6 +38,7 @@ This->HalInfo.lpDDPaletteCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDDPalette; This->HalInfo.lpDDSurfaceCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDDSurface;
+ /* FIXME The insate is not right we need the info that the three NULL return */ /* query all kinds of infos from the driver */ if(!DdQueryDirectDrawObject ( @@ -59,7 +58,11 @@ return 1; }
- /* ms wants us to call that function twice */ + /* FIXME The insate is not right we need the info that the three NULL return and use it here*/ + + /* Fixme shall we selected the pixel type before we call the DdQueryDirectDrawObject second time + and fill in more info ?? */ + This->HalInfo.vmiData.pvmList = HeapAlloc(GetProcessHeap(), 0, sizeof(VIDMEM) * This->HalInfo.vmiData.dwNumHeaps); This->DirectDrawGlobal.lpdwFourCC = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * This->HalInfo.ddCaps.dwNumFourCCCodes); This->DirectDrawGlobal.lpZPixelFormats = HeapAlloc(GetProcessHeap(), 0, sizeof(DDPIXELFORMAT) * This->DirectDrawGlobal.dwNumZPixelFormats); @@ -83,33 +86,27 @@ return 1; } - /* Copy HalInfo to DirectDrawGlobal */ - - /* have not check where it should go into yet - LPDDHAL_DDCALLBACKS lpDDCallbacks; - LPDDHAL_DDSURFACECALLBACKS lpDDSurfaceCallbacks; - LPDDHAL_DDPALETTECALLBACKS lpDDPaletteCallbacks; - */ - + /* Copy HalInfo to DirectDrawGlobal (Not complete)*/ +
RtlCopyMemory(&This->DirectDrawGlobal.vmiData,&This->HalInfo.vmiData,siz eof(VIDMEMINFO));
RtlCopyMemory(&This->DirectDrawGlobal.ddCaps,&This->HalInfo.ddCaps,sizeo f(DDCORECAPS)); This->DirectDrawGlobal.dwMonitorFrequency = This->HalInfo.dwMonitorFrequency;
/* have not check where it should go into yet - LPDDHAL_GETDRIVERINFO GetDriverInfo; + This->HalInfo.GetDriverInfo datatype LPDDHAL_GETDRIVERINFO */
This->DirectDrawGlobal.dwModeIndex = This->HalInfo.dwModeIndex;
/* have not check where it should go into yet - LPDWORD lpdwFourCC; + This->HalInfo.lpdwFourCC datatype LPDWORD */
This->DirectDrawGlobal.dwNumModes = This->HalInfo.dwNumModes; This->DirectDrawGlobal.lpModeInfo = This->HalInfo.lpModeInfo;
/* have not check where it should go into yet - DWORD dwFlags; + This->HalInfo.dwFlags data type DWORD */
/* Unsure which of these two for lpPDevice @@ -120,18 +117,189 @@ This->DirectDrawGlobal.hInstance = This->HalInfo.hInstance;
/* have not check where it should go into yet - ULONG_PTR lpD3DGlobalDriverData; - ULONG_PTR lpD3DHALCallbacks; - LPDDHAL_DDEXEBUFCALLBACKS lpDDExeBufCallbacks; + This->lpD3DGlobalDriverData datatype ULONG_PTR + This->lpD3DHALCallbacks datatype ULONG_PTR */ + RtlCopyMemory(&This->DirectDrawGlobal.lpDDCBtmp->HALDDExeBuf,&This->HalI nfo.lpDDExeBufCallbacks,sizeof(DDHAL_DDEXEBUFCALLBACKS)); + + + /*********************************************************************** */ + /* Set up the rest of the callbacks all callbacks we get back from */ + /* gdi32.dll is user mode */ + /*********************************************************************** */
+ /* Todo add a check see if HalInfo.GetDriverInfo is supported or not */ + + DDHAL_GETDRIVERINFODATA DriverInfo; + memset(&DriverInfo,0, sizeof(DDHAL_GETDRIVERINFODATA)); + DriverInfo.dwSize = sizeof(DDHAL_GETDRIVERINFODATA); + + /* Get ColorControlCallbacks */ + DriverInfo.guidInfo = GUID_ColorControlCallbacks; + DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDColorControl; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDCOLORCONTROLCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + - This->DirectDrawGlobal.lpDDCBtmp->HALDD = This->DirectDrawGlobal.lpDDCBtmp->cbDDCallbacks; - This->DirectDrawGlobal.lpDDCBtmp->HALDDSurface = This->DirectDrawGlobal.lpDDCBtmp->cbDDSurfaceCallbacks; - This->DirectDrawGlobal.lpDDCBtmp->HALDDExeBuf = This->DirectDrawGlobal.lpDDCBtmp->cbDDExeBufCallbacks; - This->DirectDrawGlobal.lpDDCBtmp->HALDDPalette = This->DirectDrawGlobal.lpDDCBtmp->cbDDPaletteCallbacks; + /* Get the GUID_D3DCallbacks callback */
+ /* Problem with include files + DDHAL_DDMISCELLANEOUSCALLBACKS misc; + DriverInfo.guidInfo = GUID_D3DCallbacks; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo);*/ + + /* Get the D3DCallbacks2 */ + /* do we need alloc memmory for This->DirectDrawGlobal.lpD3DHALCallbacks2 */ + DriverInfo.guidInfo = GUID_D3DCallbacks2; + DriverInfo.lpvData = &This->DirectDrawGlobal.lpD3DHALCallbacks2; + DriverInfo.dwExpectedSize = sizeof(D3DHAL_CALLBACKS2); + This->HalInfo.GetDriverInfo( &DriverInfo); + + + /* Get the D3DCallbacks3 */ + /* + DriverInfo.guidInfo = GUID_D3DCallbacks3; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + /* Get the misc callback */ + /* Problem with include files + DriverInfo.guidInfo = GUID_D3DCaps; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + /* Get the D3DExtendedCaps */ + /* + DriverInfo.guidInfo = GUID_D3DExtendedCaps; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + /* Get the D3DParseUnknownCommandCallback */ + /* + DriverInfo.guidInfo = GUID_D3DParseUnknownCommandCallback; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + /* Get the GetHeapAlignment */ + /* + DriverInfo.guidInfo = GUID_GetHeapAlignment; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + /* Get the KernelCallbacks */ + DriverInfo.guidInfo = GUID_KernelCallbacks; + DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDKernel; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDKERNELCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + + + /* Get the KernelCaps */ + /* + DriverInfo.guidInfo = GUID_KernelCaps; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + /* Get the MiscellaneousCallbacks */ + DriverInfo.guidInfo = GUID_MiscellaneousCallbacks; + DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + + + /* Get the Miscellaneous2Callbacks */ + /* + DriverInfo.guidInfo = GUID_Miscellaneous2Callbacks; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + /* Get the MotionCompCallbacks */ + + DriverInfo.guidInfo = GUID_MotionCompCallbacks; + DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDMotionComp; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMOTIONCOMPCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + + + /* Get the NonLocalVidMemCaps */ + /* + DriverInfo.guidInfo = GUID_NonLocalVidMemCaps; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + /* Get the NTCallbacks */ + /* + DriverInfo.guidInfo = GUID_NTCallbacks; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + /* Get the NTPrivateDriverCaps */ + /* + DriverInfo.guidInfo = GUID_NTPrivateDriverCaps; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + /* Get the UpdateNonLocalHeap */ + /* + DriverInfo.guidInfo = GUID_UpdateNonLocalHeap; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + /* Get the VideoPortCallbacks */ + /* Problem with include files + DriverInfo.guidInfo = GUID_VideoPortCallbacks; + DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDVideoPort; + DriverInfo.dwExpectedSize = sizeof(HALDDVideoPort); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + + /* Get the VideoPortCaps */ + /* + DriverInfo.guidInfo = GUID_VideoPortCaps; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + /* Get the ZPixelFormats */ + /* + DriverInfo.guidInfo = GUID_ZPixelFormats; + DriverInfo.lpvData = &misc; + DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS); + This->HalInfo.GetDriverInfo( &DriverInfo); + */ + + + /* FIXME add setup for one call ot get memmory */ + + + /* now all insate of HAL is done and we hopply do not have forget anything*/ + return DD_OK; }