Author: greatlrd
Date: Sun Jul 23 17:13:07 2006
New Revision: 23245
URL:
http://svn.reactos.org/svn/reactos?rev=23245&view=rev
Log:
Remove alot HAL and HEL split and make the split into startup.c instead.
it will save us the time to write same code twice. and it is extream
easy to adding HEL api. U can look at ddk and sdk how Dd* api works
and write then proper HEL for it.
1. I have break the HEL version of set display for we need it follow DdSetMode
and no code have been rewriten for it yet.
Modified:
trunk/reactos/dll/directx/ddraw/hal/ddraw_hal.c
trunk/reactos/dll/directx/ddraw/main/ddraw_main.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 17:13:07 2006
@@ -79,29 +79,7 @@
return mem.ddRVal;
}
-HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,HANDLE h)
-{
- IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
- DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData;
-
- if (!(This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags &
DDHAL_CB32_WAITFORVERTICALBLANK))
- {
- return DDERR_NODRIVERSUPPORT;
- }
-
- WaitVectorData.lpDD = &This->mDDrawGlobal;
- WaitVectorData.dwFlags = dwFlags;
- WaitVectorData.hEvent = (DWORD)h;
- WaitVectorData.ddRVal = DDERR_NOTPALETTIZED;
-
- if
(This->mDDrawGlobal.lpDDCBtmp->HALDD.WaitForVerticalBlank(&WaitVectorData) !=
DDHAL_DRIVER_HANDLED)
- {
- return DDERR_NODRIVERSUPPORT;
- }
-
- return WaitVectorData.ddRVal;
-}
HRESULT Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
{
@@ -151,32 +129,6 @@
-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;
-}
+
Modified: trunk/reactos/dll/directx/ddraw/main/ddraw_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main/ddr…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/main/ddraw_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/main/ddraw_main.c Sun Jul 23 17:13:07 2006
@@ -218,8 +218,8 @@
DX_WINDBG_trace();
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
- BOOL dummy = TRUE;
- DWORD ret;
+ BOOL dummy = TRUE;
+ //DDHAL_SETMODEDATA mode;
/* FIXME check the refresrate if it same if it not same do the mode switch */
if ((This->mDDrawGlobal.vmiData.dwDisplayHeight == dwHeight) &&
@@ -230,29 +230,30 @@
return DD_OK;
}
- /* Check use the Hal or Hel for SetMode */
- if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE)
+ if (This->mDdSetMode.SetMode == NULL )
{
- ret = Hal_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, dwRefreshRate,
dwFlags);
-
- }
- else
- {
- ret = Hel_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, dwRefreshRate,
dwFlags);
+ return DDERR_NODRIVERSUPPORT;
}
-
- if (ret == DD_OK)
+
+
+ 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;
+
+ 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 */
}
- //This->mDDrawGlobal.lpExclusiveOwner->hDC = (ULONG_PTR)GetDC(
(HWND)This->mDDrawGlobal.lpExclusiveOwner->hWnd);
-
-
-
-
- return ret;
+ return This->mDdSetMode.ddRVal;
}
@@ -751,12 +752,21 @@
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
- if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags &
DDHAL_CB32_WAITFORVERTICALBLANK)
- {
- return Hal_DirectDraw_WaitForVerticalBlank( iface, dwFlags, h);
- }
-
- return Hel_DirectDraw_WaitForVerticalBlank( iface, dwFlags, h);
+ if (This->mDdWaitForVerticalBlank.WaitForVerticalBlank == NULL)
+ {
+ return DDERR_NODRIVERSUPPORT;
+ }
+
+ This->mDdWaitForVerticalBlank.dwFlags = dwFlags;
+ This->mDdWaitForVerticalBlank.hEvent = (DWORD)h;
+ This->mDdWaitForVerticalBlank.ddRVal = DDERR_NOTPALETTIZED;
+
+ if
(This->mDdWaitForVerticalBlank.WaitForVerticalBlank(&This->mDdWaitForVerticalBlank)
!= DDHAL_DRIVER_HANDLED)
+ {
+ return DDERR_NODRIVERSUPPORT;
+ }
+
+ return This->mDdWaitForVerticalBlank.ddRVal;
}
HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2
ddscaps,
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 17:13:07 2006
@@ -68,9 +68,17 @@
/* internal counter */
ULONG ref;
- /* Callbacks info */
+ /* DD Callbacks info */
+ DDHAL_DESTROYDRIVERDATA mDdDestroyDriver;
DDHAL_CREATESURFACEDATA mDdCreateSurface;
- DDHAL_CANCREATESURFACEDATA mDdCanCreateSurface;
+ DDHAL_SETCOLORKEYDATA mDdSetColorKey;
+ DDHAL_SETMODEDATA mDdSetMode;
+ DDHAL_WAITFORVERTICALBLANKDATA mDdWaitForVerticalBlank;
+ DDHAL_CANCREATESURFACEDATA mDdCanCreateSurface;
+ DDHAL_CREATEPALETTEDATA mDdCreatePalette;
+ DDHAL_GETSCANLINEDATA mDdGetScanLine;
+ DDHAL_SETEXCLUSIVEMODEDATA mDdSetExclusiveMode;
+ DDHAL_FLIPTOGDISURFACEDATA mDdFlipToGDISurface;
/* Primarey surface we must reach it from every where */
DDRAWI_DDRAWSURFACE_GBL mPrimaryGlobal;
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 17:13:07 2006
@@ -25,6 +25,7 @@
UCHAR *pbmiData;
BITMAPINFO *pbmi;
DWORD *pMasks;
+ DWORD Flags;
DX_WINDBG_trace();
@@ -119,29 +120,88 @@
}
/*
- Try figout which api we shall use, first we try see if HAL exits
- if it does not we select HEL instead
+ Setup HEL or HAL for DD_CALLBACKS
*/
- if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags &
DDHAL_CB32_CANCREATESURFACE)
- {
- This->mDdCanCreateSurface.CanCreateSurface =
This->mCallbacks.HALDD.CanCreateSurface;
- }
- else
- {
- This->mDdCanCreateSurface.CanCreateSurface =
This->mCallbacks.HELDD.CanCreateSurface;
- }
-
- This->mDdCreateSurface.lpDD = &This->mDDrawGlobal;
-
- if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_CREATESURFACE)
- {
- This->mDdCreateSurface.CreateSurface =
This->mCallbacks.HALDD.CreateSurface;
- }
- else
- {
- This->mDdCreateSurface.CreateSurface =
This->mCallbacks.HELDD.CreateSurface;
- }
+ This->mDdCanCreateSurface.lpDD = &This->mDDrawGlobal;
+ This->mDdCreatePalette.lpDD = &This->mDDrawGlobal;
+ This->mDdCreateSurface.lpDD = &This->mDDrawGlobal;
+ This->mDdFlipToGDISurface.lpDD = &This->mDDrawGlobal;
+ This->mDdDestroyDriver.lpDD = &This->mDDrawGlobal;
+ This->mDdGetScanLine.lpDD = &This->mDDrawGlobal;
+ This->mDdSetExclusiveMode.lpDD = &This->mDDrawGlobal;
+ This->mDdSetMode.lpDD = &This->mDDrawGlobal;
+ This->mDdWaitForVerticalBlank.lpDD = &This->mDDrawGlobal;
+ This->mDdSetColorKey.lpDD = &This->mDDrawGlobal;
+
+ This->mDdCanCreateSurface.CanCreateSurface =
This->mCallbacks.HELDD.CanCreateSurface;
+ This->mDdCreatePalette.CreatePalette = This->mCallbacks.HELDD.CreatePalette;
+ This->mDdCreateSurface.CreateSurface = This->mCallbacks.HELDD.CreateSurface;
+ This->mDdDestroyDriver.DestroyDriver = This->mCallbacks.HELDD.DestroyDriver;
+ This->mDdFlipToGDISurface.FlipToGDISurface =
This->mCallbacks.HELDD.FlipToGDISurface;
+ This->mDdGetScanLine.GetScanLine = This->mCallbacks.HELDD.GetScanLine;
+ This->mDdSetExclusiveMode.SetExclusiveMode =
This->mCallbacks.HELDD.SetExclusiveMode;
+ This->mDdSetMode.SetMode = This->mCallbacks.HELDD.SetMode;
+ This->mDdWaitForVerticalBlank.WaitForVerticalBlank =
This->mCallbacks.HELDD.WaitForVerticalBlank;
+ // This->mDdSetColorKey.SetColorKey = This->mCallbacks.HELDD.SetColorKey;
+
+ Flags = This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags;
+
+ if (Flags & DDHAL_CB32_CANCREATESURFACE)
+ {
+ This->mDdCanCreateSurface.CanCreateSurface =
This->mCallbacks.HALDD.CanCreateSurface;
+ }
+
+ if (Flags & DDHAL_CB32_CREATEPALETTE)
+ {
+ This->mDdCreatePalette.CreatePalette = This->mCallbacks.HALDD.CreatePalette;
+ }
+
+ if (Flags & DDHAL_CB32_CREATESURFACE)
+ {
+ This->mDdCreateSurface.CreateSurface = This->mCallbacks.HALDD.CreateSurface;
+ }
+
+ if (Flags & DDHAL_CB32_DESTROYDRIVER)
+ {
+ This->mDdDestroyDriver.DestroyDriver = This->mCallbacks.HALDD.DestroyDriver;
+ }
+
+ if (Flags & DDHAL_CB32_FLIPTOGDISURFACE)
+ {
+ This->mDdFlipToGDISurface.FlipToGDISurface =
This->mCallbacks.HALDD.FlipToGDISurface;
+ }
+
+ if (Flags & DDHAL_CB32_GETSCANLINE)
+ {
+ This->mDdGetScanLine.GetScanLine = This->mCallbacks.HALDD.GetScanLine;
+ }
+
+ if (Flags & DDHAL_CB32_SETEXCLUSIVEMODE)
+ {
+ This->mDdSetExclusiveMode.SetExclusiveMode =
This->mCallbacks.HALDD.SetExclusiveMode;
+ }
+
+ if (Flags & DDHAL_CB32_SETMODE)
+ {
+ This->mDdSetMode.SetMode = This->mCallbacks.HALDD.SetMode;
+ }
+
+ if (Flags & DDHAL_CB32_WAITFORVERTICALBLANK)
+ {
+ This->mDdWaitForVerticalBlank.WaitForVerticalBlank =
This->mCallbacks.HALDD.WaitForVerticalBlank;
+ }
+
+ if (Flags & DDHAL_CB32_SETCOLORKEY)
+ {
+ // This->mDdSetColorKey.SetColorKey = This->mCallbacks.HALDD.SetColorKey;
+ }
+
+ /*
+ Setup HEL or HAL for SURFACE CALLBACK
+ */
+
+ // FIXME
/* Setup calback struct so we do not need refill same info again */
This->mDdCreateSurface.lpDD = &This->mDDrawGlobal;