Author: greatlrd
Date: Sun Jul 23 23:03:41 2006
New Revision: 23252
URL:
http://svn.reactos.org/svn/reactos?rev=23252&view=rev
Log:
1. Implement check for DDCREATE_HARDWAREONLY and DDCREATE_EMULATIONONLY in CreateDraw and
CreateDrawEx
2. Implement activate of DDCREATE_HARDWAREONLY and DDCREATE_EMULATIONONLY in
StartupDirectDraw
3. Fix correct return value when pUnkOuter is not NULL in CreateDraw and CreateDrawEx
Now we can activate deactive HAL or HEL and use one of thuse interface.
Modified:
trunk/reactos/dll/directx/ddraw/main.c
trunk/reactos/dll/directx/ddraw/startup.c
Modified: trunk/reactos/dll/directx/ddraw/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main.c?r…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/main.c (original)
+++ trunk/reactos/dll/directx/ddraw/main.c Sun Jul 23 23:03:41 2006
@@ -28,8 +28,8 @@
/* check see if pUnkOuter is null or not */
if (pUnkOuter)
{
- /* we do not use same error code as MS, ms use 0x8004110 */
- return DDERR_INVALIDPARAMS;
+ /* we do not use same error code as MS, ms use CLASS_E_NOAGGREGATION */
+ return CLASS_E_NOAGGREGATION;
}
return Create_DirectDraw (lpGUID, lplpDD, &IID_IDirectDraw, FALSE);
@@ -50,8 +50,8 @@
/* check see if pUnkOuter is null or not */
if (pUnkOuter)
{
- /* we do not use same error code as MS, ms use 0x8004110 */
- return DDERR_INVALIDPARAMS;
+ /* we do not use same error code as MS, ms use CLASS_E_NOAGGREGATION */
+ return CLASS_E_NOAGGREGATION;
}
/* Is it a DirectDraw 7 Request or not */
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 23:03:41 2006
@@ -133,68 +133,74 @@
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;
+
+ if (This->devicetype!=1)
+ {
+ /* both or only hel */
+ 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;
+ }
+
+ if (This->devicetype!=2)
+ {
+ 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;
+ }
}
/*
@@ -413,7 +419,9 @@
DX_WINDBG_trace();
if (This == NULL)
+ {
return E_OUTOFMEMORY;
+ }
ZeroMemory(This,sizeof(IDirectDrawImpl));
@@ -424,6 +432,18 @@
*pIface = (LPDIRECTDRAW)This;
+ This->devicetype = 0;
+
+ if (pGUID == (LPGUID) DDCREATE_HARDWAREONLY)
+ {
+ This->devicetype = 1; /* hal only */
+ }
+
+ if (pGUID == (LPGUID) DDCREATE_EMULATIONONLY)
+ {
+ This->devicetype = 2; /* hel only */
+ }
+
if(This->lpVtbl->QueryInterface ((LPDIRECTDRAW7)This, id, (void**)&pIface) !=
S_OK)
{
return DDERR_INVALIDPARAMS;