Author: greatlrd
Date: Sun Jul 23 14:12:08 2006
New Revision: 23240
URL:
http://svn.reactos.org/svn/reactos?rev=23240&view=rev
Log:
move more code into startup.c
Modified:
trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c
trunk/reactos/dll/directx/ddraw/rosdraw.h
trunk/reactos/dll/directx/ddraw/startup.c
Modified: trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/hal/ddra…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c (original)
+++ trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c Sun Jul 23 14:12:08 2006
@@ -9,156 +9,6 @@
*/
#include "rosdraw.h"
-
-
-HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface)
-{
- IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
-
- /* HAL Startup process */
- BOOL newmode = FALSE;
-
-
- /*
- Startup DX HAL step one of three
- */
- if (!DdCreateDirectDrawObject(&This->mDDrawGlobal, This->hdc))
- {
- DxHeapMemFree(This->mpModeInfos);
- DeleteDC(This->hdc);
- return DD_FALSE;
- }
-
- // Do not relase HDC it have been map in kernel mode
- // DeleteDC(hdc);
-
- if (!DdReenableDirectDrawObject(&This->mDDrawGlobal, &newmode))
- {
- DxHeapMemFree(This->mpModeInfos);
- DeleteDC(This->hdc);
- return DD_FALSE;
- }
-
-
- /*
- Startup DX HAL step two of three
- */
-
- if (!DdQueryDirectDrawObject(&This->mDDrawGlobal,
- &This->mHALInfo,
- &This->mCallbacks.HALDD,
- &This->mCallbacks.HALDDSurface,
- &This->mCallbacks.HALDDPalette,
- &This->mD3dCallbacks,
- &This->mD3dDriverData,
- &This->mD3dBufferCallbacks,
- NULL,
- NULL,
- NULL))
- {
- DxHeapMemFree(This->mpModeInfos);
- DeleteDC(This->hdc);
- // FIXME Close DX fristcall and second call
- return DD_FALSE;
- }
-
- This->mcvmList = This->mHALInfo.vmiData.dwNumHeaps;
- This->mpvmList = (VIDMEM*) DxHeapMemAlloc(sizeof(VIDMEM) * This->mcvmList);
- if (This->mpvmList == NULL)
- {
- DxHeapMemFree(This->mpModeInfos);
- DeleteDC(This->hdc);
- // FIXME Close DX fristcall and second call
- return DD_FALSE;
- }
-
- This->mcFourCC = This->mHALInfo.ddCaps.dwNumFourCCCodes;
- This->mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * This->mcFourCC);
- if (This->mpFourCC == NULL)
- {
- DxHeapMemFree(This->mpvmList);
- DxHeapMemFree(This->mpModeInfos);
- DeleteDC(This->hdc);
- // FIXME Close DX fristcall and second call
- return DD_FALSE;
- }
-
- This->mcTextures = This->mD3dDriverData.dwNumTextureFormats;
- This->mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) *
This->mcTextures);
- if (This->mpTextures == NULL)
- {
- DxHeapMemFree( This->mpFourCC);
- DxHeapMemFree( This->mpvmList);
- DxHeapMemFree( This->mpModeInfos);
- DeleteDC(This->hdc);
- // FIXME Close DX fristcall and second call
- return DD_FALSE;
- }
-
- This->mHALInfo.vmiData.pvmList = This->mpvmList;
- This->mHALInfo.lpdwFourCC = This->mpFourCC;
- This->mD3dDriverData.lpTextureFormats = This->mpTextures;
-
- if (!DdQueryDirectDrawObject(
- &This->mDDrawGlobal,
- &This->mHALInfo,
- &This->mCallbacks.HALDD,
- &This->mCallbacks.HALDDSurface,
- &This->mCallbacks.HALDDPalette,
- &This->mD3dCallbacks,
- &This->mD3dDriverData,
- &This->mCallbacks.HALDDExeBuf,
- This->mpTextures,
- This->mpFourCC,
- This->mpvmList))
-
- {
- DxHeapMemFree(This->mpTextures);
- DxHeapMemFree(This->mpFourCC);
- DxHeapMemFree(This->mpvmList);
- DxHeapMemFree(This->mpModeInfos);
- DeleteDC(This->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(&This->mDDrawGlobal.vmiData,
&This->mHALInfo.vmiData,sizeof(VIDMEMINFO));
- memcpy(&This->mDDrawGlobal.ddCaps,
&This->mHALInfo.ddCaps,sizeof(DDCORECAPS));
-
- This->mHALInfo.dwNumModes = This->mcModeInfos;
- This->mHALInfo.lpModeInfo = This->mpModeInfos;
- This->mHALInfo.dwMonitorFrequency = This->mpModeInfos[0].wRefreshRate;
-
- This->mDDrawGlobal.dwMonitorFrequency = This->mHALInfo.dwMonitorFrequency;
- This->mDDrawGlobal.dwModeIndex = This->mHALInfo.dwModeIndex;
- This->mDDrawGlobal.dwNumModes = This->mHALInfo.dwNumModes;
- This->mDDrawGlobal.lpModeInfo = This->mHALInfo.lpModeInfo;
- This->mDDrawGlobal.hInstance = This->mHALInfo.hInstance;
-
- This->mDDrawGlobal.lp16DD = &This->mDDrawGlobal;
-
- //DeleteDC(This->hdc);
-
- DDHAL_GETDRIVERINFODATA DriverInfo;
- memset(&DriverInfo,0, sizeof(DDHAL_GETDRIVERINFODATA));
- DriverInfo.dwSize = sizeof(DDHAL_GETDRIVERINFODATA);
- DriverInfo.dwContext = This->mDDrawGlobal.hDD;
-
- /* Get the MiscellaneousCallbacks */
- DriverInfo.guidInfo = GUID_MiscellaneousCallbacks;
- DriverInfo.lpvData = &This->mDDrawGlobal.lpDDCBtmp->HALDDMiscellaneous;
- DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS);
- This->mHALInfo.GetDriverInfo(&DriverInfo);
-
- return DD_OK;
-}
VOID
Hal_DirectDraw_Release (LPDIRECTDRAW7 iface)
Modified: trunk/reactos/dll/directx/ddraw/rosdraw.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/rosdraw.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/rosdraw.h (original)
+++ trunk/reactos/dll/directx/ddraw/rosdraw.h Sun Jul 23 14:12:08 2006
@@ -10,9 +10,10 @@
#include <d3dhal.h>
#include <ddrawgdi.h>
+HRESULT WINAPI StartDirectDraw(LPDIRECTDRAW* iface);
+HRESULT WINAPI StartDirectDrawHal(LPDIRECTDRAW* iface);
HRESULT WINAPI Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, REFIID id, BOOL
ex);
-HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 );
HRESULT Hel_DirectDraw_Initialize (LPDIRECTDRAW7 );
/* own macro to alloc memmory */
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 Sun Jul 23 14:12:08 2006
@@ -110,7 +110,7 @@
This->mDDrawGlobal.lpDDCBtmp = &This->mCallbacks;
This->mDDrawGlobal.lpExclusiveOwner = &This->mDDrawLocal;
- hal_ret = Hal_DirectDraw_Initialize ((LPDIRECTDRAW7)iface);
+ hal_ret = StartDirectDrawHal(iface);
hel_ret = Hel_DirectDraw_Initialize ((LPDIRECTDRAW7)iface);
if ((hal_ret!=DD_OK) && (hel_ret!=DD_OK))
{
@@ -148,6 +148,157 @@
This->mDdCanCreateSurface.lpDD = &This->mDDrawGlobal;
return DD_OK;
+}
+
+
+HRESULT WINAPI
+StartDirectDrawHal(LPDIRECTDRAW* iface)
+{
+ IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+
+ /* HAL Startup process */
+ BOOL newmode = FALSE;
+
+
+ /*
+ Startup DX HAL step one of three
+ */
+ if (!DdCreateDirectDrawObject(&This->mDDrawGlobal, This->hdc))
+ {
+ DxHeapMemFree(This->mpModeInfos);
+ DeleteDC(This->hdc);
+ return DD_FALSE;
+ }
+
+ // Do not relase HDC it have been map in kernel mode
+ // DeleteDC(hdc);
+
+ if (!DdReenableDirectDrawObject(&This->mDDrawGlobal, &newmode))
+ {
+ DxHeapMemFree(This->mpModeInfos);
+ DeleteDC(This->hdc);
+ return DD_FALSE;
+ }
+
+
+ /*
+ Startup DX HAL step two of three
+ */
+
+ if (!DdQueryDirectDrawObject(&This->mDDrawGlobal,
+ &This->mHALInfo,
+ &This->mCallbacks.HALDD,
+ &This->mCallbacks.HALDDSurface,
+ &This->mCallbacks.HALDDPalette,
+ &This->mD3dCallbacks,
+ &This->mD3dDriverData,
+ &This->mD3dBufferCallbacks,
+ NULL,
+ NULL,
+ NULL))
+ {
+ DxHeapMemFree(This->mpModeInfos);
+ DeleteDC(This->hdc);
+ // FIXME Close DX fristcall and second call
+ return DD_FALSE;
+ }
+
+ This->mcvmList = This->mHALInfo.vmiData.dwNumHeaps;
+ This->mpvmList = (VIDMEM*) DxHeapMemAlloc(sizeof(VIDMEM) * This->mcvmList);
+ if (This->mpvmList == NULL)
+ {
+ DxHeapMemFree(This->mpModeInfos);
+ DeleteDC(This->hdc);
+ // FIXME Close DX fristcall and second call
+ return DD_FALSE;
+ }
+
+ This->mcFourCC = This->mHALInfo.ddCaps.dwNumFourCCCodes;
+ This->mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * This->mcFourCC);
+ if (This->mpFourCC == NULL)
+ {
+ DxHeapMemFree(This->mpvmList);
+ DxHeapMemFree(This->mpModeInfos);
+ DeleteDC(This->hdc);
+ // FIXME Close DX fristcall and second call
+ return DD_FALSE;
+ }
+
+ This->mcTextures = This->mD3dDriverData.dwNumTextureFormats;
+ This->mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) *
This->mcTextures);
+ if (This->mpTextures == NULL)
+ {
+ DxHeapMemFree( This->mpFourCC);
+ DxHeapMemFree( This->mpvmList);
+ DxHeapMemFree( This->mpModeInfos);
+ DeleteDC(This->hdc);
+ // FIXME Close DX fristcall and second call
+ return DD_FALSE;
+ }
+
+ This->mHALInfo.vmiData.pvmList = This->mpvmList;
+ This->mHALInfo.lpdwFourCC = This->mpFourCC;
+ This->mD3dDriverData.lpTextureFormats = This->mpTextures;
+
+ if (!DdQueryDirectDrawObject(
+ &This->mDDrawGlobal,
+ &This->mHALInfo,
+ &This->mCallbacks.HALDD,
+ &This->mCallbacks.HALDDSurface,
+ &This->mCallbacks.HALDDPalette,
+ &This->mD3dCallbacks,
+ &This->mD3dDriverData,
+ &This->mCallbacks.HALDDExeBuf,
+ This->mpTextures,
+ This->mpFourCC,
+ This->mpvmList))
+
+ {
+ DxHeapMemFree(This->mpTextures);
+ DxHeapMemFree(This->mpFourCC);
+ DxHeapMemFree(This->mpvmList);
+ DxHeapMemFree(This->mpModeInfos);
+ DeleteDC(This->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(&This->mDDrawGlobal.vmiData,
&This->mHALInfo.vmiData,sizeof(VIDMEMINFO));
+ memcpy(&This->mDDrawGlobal.ddCaps,
&This->mHALInfo.ddCaps,sizeof(DDCORECAPS));
+
+ This->mHALInfo.dwNumModes = This->mcModeInfos;
+ This->mHALInfo.lpModeInfo = This->mpModeInfos;
+ This->mHALInfo.dwMonitorFrequency = This->mpModeInfos[0].wRefreshRate;
+
+ This->mDDrawGlobal.dwMonitorFrequency = This->mHALInfo.dwMonitorFrequency;
+ This->mDDrawGlobal.dwModeIndex = This->mHALInfo.dwModeIndex;
+ This->mDDrawGlobal.dwNumModes = This->mHALInfo.dwNumModes;
+ This->mDDrawGlobal.lpModeInfo = This->mHALInfo.lpModeInfo;
+ This->mDDrawGlobal.hInstance = This->mHALInfo.hInstance;
+
+ This->mDDrawGlobal.lp16DD = &This->mDDrawGlobal;
+
+ //DeleteDC(This->hdc);
+
+ DDHAL_GETDRIVERINFODATA DriverInfo;
+ memset(&DriverInfo,0, sizeof(DDHAL_GETDRIVERINFODATA));
+ DriverInfo.dwSize = sizeof(DDHAL_GETDRIVERINFODATA);
+ DriverInfo.dwContext = This->mDDrawGlobal.hDD;
+
+ /* Get the MiscellaneousCallbacks */
+ DriverInfo.guidInfo = GUID_MiscellaneousCallbacks;
+ DriverInfo.lpvData = &This->mDDrawGlobal.lpDDCBtmp->HALDDMiscellaneous;
+ DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS);
+ This->mHALInfo.GetDriverInfo(&DriverInfo);
+
+ return DD_OK;
}
HRESULT