Author: greatlrd
Date: Sun Jun 17 19:19:59 2007
New Revision: 27216
URL:
http://svn.reactos.org/svn/reactos?rev=27216&view=rev
Log:
GetCaps are complete, not tested in all case but almost all
Added:
trunk/reactos/dll/directx/ddraw/Ddraw/GetCaps.c (with props)
Modified:
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
trunk/reactos/dll/directx/ddraw/ddraw.rbuild
Added: trunk/reactos/dll/directx/ddraw/Ddraw/GetCaps.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/Ge…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/GetCaps.c (added)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/GetCaps.c Sun Jun 17 19:19:59 2007
@@ -1,0 +1,269 @@
+/* $Id$
+ *
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS DirectX
+ * FILE: ddraw/ddraw/ddraw_main.c
+ * PURPOSE: IDirectDraw7 Implementation
+ * PROGRAMMER: Magnus Olsen
+ *
+ */
+
+/* TODO
+ * lpddNLVHELCaps and lpddNLVCaps
+ * Thouse two can be null or inviald in lpGBL
+ * we need add code in startup to detect if we have lpddNLVCaps set
+ * ms HEL does not support lpddNLVHELCaps shall we do that ?
+ * ms HEL does not support dwVidMemTotal and dwVidMemFree shall we implement a emulate of
them ?
+ */
+
+#include "rosdraw.h"
+
+#include <string.h>
+
+/* PSEH for SEH Support */
+#include <pseh/pseh.h>
+
+
+HRESULT WINAPI
+Main_DirectDraw_GetCaps( LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
+ LPDDCAPS pHELCaps)
+{
+ HRESULT retVal = DDERR_INVALIDPARAMS;
+ LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
+
+ DX_WINDBG_trace();
+
+ _SEH_TRY
+ {
+ if ((!pDriverCaps) && (!pHELCaps))
+ {
+ retVal = DDERR_INVALIDPARAMS;
+ _SEH_LEAVE;
+ }
+
+ if (pDriverCaps)
+ {
+ /* Setup hardware caps */
+ DDSCAPS2 ddscaps = { 0 };
+ LPDDCORECAPS CoreCaps =
(LPDDCORECAPS)&This->lpLcl->lpGbl->ddCaps;
+
+ DWORD dwTotal = 0;
+ DWORD dwFree = 0;
+
+ Main_DirectDraw_GetAvailableVidMem4(iface, &ddscaps, &dwTotal,
&dwFree);
+
+ switch (pDriverCaps->dwSize)
+ {
+ case sizeof(DDCAPS_DX1):
+ {
+ LPDDCAPS_DX1 myCaps = (LPDDCAPS_DX1) pDriverCaps;
+
+ if (CoreCaps->dwSize == sizeof(DDCORECAPS))
+ {
+ memcpy(myCaps, CoreCaps, sizeof(DDCAPS_DX1));
+ }
+
+ myCaps->dwVidMemFree = dwFree;
+ myCaps->dwVidMemTotal = dwTotal;
+ myCaps->dwSize = sizeof(DDCAPS_DX1);
+
+ retVal = DD_OK;
+ }
+ break;
+
+ case sizeof(DDCAPS_DX3):
+ {
+ LPDDCAPS_DX3 myCaps = (LPDDCAPS_DX3) pDriverCaps;
+
+ if (CoreCaps->dwSize == sizeof(DDCORECAPS))
+ {
+ memcpy(&myCaps->dwCaps, &CoreCaps->dwCaps,
sizeof(DDCAPS_DX3));
+ }
+
+ myCaps->dwVidMemFree = dwFree;
+ myCaps->dwVidMemTotal = dwTotal;
+ myCaps->dwSize = sizeof(DDCAPS_DX3);
+
+ retVal = DD_OK;
+ }
+ break;
+
+ case sizeof(DDCAPS_DX5):
+ {
+ LPDDCAPS_DX5 myCaps = (LPDDCAPS_DX5) pDriverCaps;
+
+ /* FIXME This->lpLcl->lpGbl->lpddNLVCaps are not set in
startup.c
+ if (This->lpLcl->lpGbl->lpddNLVCaps->dwSize ==
sizeof(DDNONLOCALVIDMEMCAPS))
+ {
+ memcpy(&myCaps->dwNLVBCaps,
This->lpLcl->lpGbl->lpddNLVCaps, sizeof(DDNONLOCALVIDMEMCAPS));
+ }
+ */
+ memset(myCaps->dwNLVBCaps,0,sizeof(DDNONLOCALVIDMEMCAPS));
+
+ if (CoreCaps->dwSize == sizeof(DDCORECAPS))
+ {
+ memcpy(&myCaps->dwCaps, &CoreCaps->dwCaps,
sizeof(DDCORECAPS));
+ }
+
+ myCaps->dwVidMemFree = dwFree;
+ myCaps->dwVidMemTotal = dwTotal;
+ myCaps->dwSize = sizeof(DDCAPS_DX5);
+
+ retVal = DD_OK;
+ }
+ break;
+
+ /* DDCAPS_DX6 is same as DDCAPS_DX7 */
+ case sizeof(DDCAPS_DX7):
+ {
+ LPDDCAPS_DX7 myCaps = (LPDDCAPS_DX7) pDriverCaps;
+
+ /* FIXME This->lpLcl->lpGbl->lpddNLVCaps are not set in
startup.c
+ if (This->lpLcl->lpGbl->lpddNLVCaps->dwSize ==
sizeof(DDNONLOCALVIDMEMCAPS))
+ {
+ memcpy(&myCaps->dwNLVBCaps,
This->lpLcl->lpGbl->lpddNLVCaps, sizeof(DDNONLOCALVIDMEMCAPS));
+ }
+ */
+ memset(myCaps->dwNLVBCaps,0,sizeof(DDNONLOCALVIDMEMCAPS));
+
+ if (CoreCaps->dwSize == sizeof(DDCORECAPS))
+ {
+ memcpy(&myCaps->dwCaps, &CoreCaps->dwCaps,
sizeof(DDCORECAPS));
+ }
+
+ myCaps->dwVidMemFree = dwFree;
+ myCaps->dwVidMemTotal = dwTotal;
+
+ myCaps->ddsCaps.dwCaps = myCaps->ddsOldCaps.dwCaps;
+ myCaps->ddsCaps.dwCaps2 = 0;
+ myCaps->ddsCaps.dwCaps3 = 0;
+ myCaps->ddsCaps.dwCaps4 = 0;
+ myCaps->dwSize = sizeof(DDCAPS_DX7);
+
+ }
+ break;
+
+ default:
+ retVal = DDERR_INVALIDPARAMS;
+ break;
+ }
+ }
+
+ if (pHELCaps)
+ {
+ /* Setup software caps */
+ DDSCAPS2 ddscaps = { 0 };
+ LPDDCORECAPS CoreCaps =
(LPDDCORECAPS)&This->lpLcl->lpGbl->ddHELCaps;
+
+ DWORD dwTotal = 0;
+ DWORD dwFree = 0;
+
+ Main_DirectDraw_GetAvailableVidMem4(iface, &ddscaps, &dwTotal,
&dwFree);
+
+ switch (pHELCaps->dwSize)
+ {
+ case sizeof(DDCAPS_DX1):
+ {
+ LPDDCAPS_DX1 myCaps = (LPDDCAPS_DX1) pHELCaps;
+
+ if (CoreCaps->dwSize == sizeof(DDCORECAPS))
+ {
+ memcpy(myCaps, CoreCaps, sizeof(DDCAPS_DX1));
+ }
+
+ myCaps->dwVidMemFree = dwFree;
+ myCaps->dwVidMemTotal = dwTotal;
+ myCaps->dwSize = sizeof(DDCAPS_DX1);
+
+ retVal = DD_OK;
+ }
+ break;
+
+ case sizeof(DDCAPS_DX3):
+ {
+ LPDDCAPS_DX3 myCaps = (LPDDCAPS_DX3) pHELCaps;
+
+ if (CoreCaps->dwSize == sizeof(DDCORECAPS))
+ {
+ memcpy(&myCaps->dwCaps, &CoreCaps->dwCaps,
sizeof(DDCAPS_DX3));
+ }
+
+ myCaps->dwVidMemFree = dwFree;
+ myCaps->dwVidMemTotal = dwTotal;
+ myCaps->dwSize = sizeof(DDCAPS_DX3);
+
+ retVal = DD_OK;
+ }
+ break;
+
+ case sizeof(DDCAPS_DX5):
+ {
+ LPDDCAPS_DX5 myCaps = (LPDDCAPS_DX5) pHELCaps;
+
+ /* FIXME This->lpLcl->lpGbl->lpddNLVHELCaps are not set in
startup.c
+ if (This->lpLcl->lpGbl->lpddNLVHELCaps->dwSize ==
sizeof(DDNONLOCALVIDMEMCAPS))
+ {
+ memcpy(&myCaps->dwNLVBCaps,
This->lpLcl->lpGbl->lpddNLVHELCaps, sizeof(DDNONLOCALVIDMEMCAPS));
+ }
+ */
+ memset(myCaps->dwNLVBCaps,0,sizeof(DDNONLOCALVIDMEMCAPS));
+
+ if (CoreCaps->dwSize == sizeof(DDCORECAPS))
+ {
+ memcpy(&myCaps->dwCaps, &CoreCaps->dwCaps,
sizeof(DDCORECAPS));
+ }
+
+ myCaps->dwVidMemFree = dwFree;
+ myCaps->dwVidMemTotal = dwTotal;
+ myCaps->dwSize = sizeof(DDCAPS_DX5);
+
+ retVal = DD_OK;
+ }
+ break;
+
+ /* DDCAPS_DX6 is same as DDCAPS_DX7 */
+ case sizeof(DDCAPS_DX7):
+ {
+ LPDDCAPS_DX7 myCaps = (LPDDCAPS_DX7) pHELCaps;
+
+ /* FIXME This->lpLcl->lpGbl->lpddNLVHELCaps are not set in
startup.c
+ if (This->lpLcl->lpGbl->lpddNLVHELCaps->dwSize ==
sizeof(DDNONLOCALVIDMEMCAPS))
+ {
+ memcpy(&myCaps->dwNLVBCaps,
This->lpLcl->lpGbl->lpddNLVHELCaps, sizeof(DDNONLOCALVIDMEMCAPS));
+ }
+ */
+ memset(myCaps->dwNLVBCaps,0,sizeof(DDNONLOCALVIDMEMCAPS));
+
+ if (CoreCaps->dwSize == sizeof(DDCORECAPS))
+ {
+ memcpy(&myCaps->dwCaps, &CoreCaps->dwCaps,
sizeof(DDCORECAPS));
+ }
+
+ myCaps->dwVidMemFree = dwFree;
+ myCaps->dwVidMemTotal = dwTotal;
+
+ myCaps->ddsCaps.dwCaps = myCaps->ddsOldCaps.dwCaps;
+ myCaps->ddsCaps.dwCaps2 = 0;
+ myCaps->ddsCaps.dwCaps3 = 0;
+ myCaps->ddsCaps.dwCaps4 = 0;
+ myCaps->dwSize = sizeof(DDCAPS_DX7);
+
+ }
+ break;
+
+ default:
+ retVal = DDERR_INVALIDPARAMS;
+ break;
+ }
+ }
+
+
+ }
+ _SEH_HANDLE
+ {
+ retVal = DD_FALSE;
+ }
+ _SEH_END;
+
+ return retVal;
+}
Propchange: trunk/reactos/dll/directx/ddraw/Ddraw/GetCaps.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/dll/directx/ddraw/Ddraw/GetCaps.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/dd…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c Sun Jun 17 19:19:59 2007
@@ -450,168 +450,6 @@
//LeaveCriticalSection(&ddcs);
return retVal;
}
-
-HRESULT WINAPI
-Main_DirectDraw_GetCaps( LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
- LPDDCAPS pHELCaps)
-{
- HRESULT retVal = DDERR_INVALIDPARAMS;
- LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
-
- DX_WINDBG_trace();
-
- _SEH_TRY
- {
- if ((!pDriverCaps) && (!pHELCaps))
- {
- retVal = DDERR_INVALIDPARAMS;
- _SEH_LEAVE;
- }
-
- if (pDriverCaps)
- {
- /* Setup hardware caps */
- DDSCAPS2 ddscaps = { 0 };
- LPDDCORECAPS CoreCaps =
(LPDDCORECAPS)&This->lpLcl->lpGbl->ddCaps;
-
- DWORD dwTotal = 0;
- DWORD dwFree = 0;
-
- Main_DirectDraw_GetAvailableVidMem4(iface, &ddscaps, &dwTotal,
&dwFree);
-
- switch (pDriverCaps->dwSize)
- {
- case sizeof(DDCAPS_DX1):
- {
- LPDDCAPS_DX1 myCaps = (LPDDCAPS_DX1) pDriverCaps;
-
- if (CoreCaps->dwSize == sizeof(DDCORECAPS))
- {
- memcpy(myCaps, CoreCaps, sizeof(DDCAPS_DX1));
- }
-
- myCaps->dwVidMemFree = dwFree;
- myCaps->dwVidMemTotal = dwTotal;
- myCaps->dwSize = sizeof(DDCAPS_DX1);
-
- retVal = DD_OK;
- }
- break;
-
- case sizeof(DDCAPS_DX3):
- {
- LPDDCAPS_DX3 myCaps = (LPDDCAPS_DX3) pDriverCaps;
-
- if (CoreCaps->dwSize == sizeof(DDCORECAPS))
- {
- memcpy(&myCaps->dwCaps, &CoreCaps->dwCaps,
sizeof(DDCAPS_DX3));
- }
-
- myCaps->dwVidMemFree = dwFree;
- myCaps->dwVidMemTotal = dwTotal;
- myCaps->dwSize = sizeof(DDCAPS_DX3);
-
- retVal = DD_OK;
- }
- break;
-
- case sizeof(DDCAPS_DX5):
- {
- LPDDCAPS_DX5 myCaps = (LPDDCAPS_DX5) pDriverCaps;
-
- /* FIXME This->lpLcl->lpGbl->lpddNLVCaps are not set in
startup.c
- if (This->lpLcl->lpGbl->lpddNLVCaps->dwSize ==
sizeof(DDNONLOCALVIDMEMCAPS))
- {
- memcpy(&myCaps->dwNLVBCaps,
This->lpLcl->lpGbl->lpddNLVCaps, sizeof(DDNONLOCALVIDMEMCAPS));
- }
- */
- memset(myCaps->dwNLVBCaps,0,sizeof(DDNONLOCALVIDMEMCAPS));
-
- if (CoreCaps->dwSize == sizeof(DDCORECAPS))
- {
- memcpy(&myCaps->dwCaps, &CoreCaps->dwCaps,
sizeof(DDCORECAPS));
- }
-
- myCaps->dwVidMemFree = dwFree;
- myCaps->dwVidMemTotal = dwTotal;
- myCaps->dwSize = sizeof(DDCAPS_DX5);
-
- retVal = DD_OK;
- }
- break;
-
- /* DDCAPS_DX6 is same as DDCAPS_DX7 */
- case sizeof(DDCAPS_DX7):
- {
- LPDDCAPS_DX7 myCaps = (LPDDCAPS_DX7) pDriverCaps;
-
- /* FIXME This->lpLcl->lpGbl->lpddNLVCaps are not set in
startup.c
- if (This->lpLcl->lpGbl->lpddNLVCaps->dwSize ==
sizeof(DDNONLOCALVIDMEMCAPS))
- {
- memcpy(&myCaps->dwNLVBCaps,
This->lpLcl->lpGbl->lpddNLVCaps, sizeof(DDNONLOCALVIDMEMCAPS));
- }
- */
- memset(myCaps->dwNLVBCaps,0,sizeof(DDNONLOCALVIDMEMCAPS));
-
- if (CoreCaps->dwSize == sizeof(DDCORECAPS))
- {
- memcpy(&myCaps->dwCaps, &CoreCaps->dwCaps,
sizeof(DDCORECAPS));
- }
-
- myCaps->dwVidMemFree = dwFree;
- myCaps->dwVidMemTotal = dwTotal;
-
- myCaps->ddsCaps.dwCaps = myCaps->ddsOldCaps.dwCaps;
- myCaps->ddsCaps.dwCaps2 = 0;
- myCaps->ddsCaps.dwCaps3 = 0;
- myCaps->ddsCaps.dwCaps4 = 0;
- myCaps->dwSize = sizeof(DDCAPS_DX7);
-
- }
- break;
-
- default:
- retVal = DDERR_INVALIDPARAMS;
- break;
- }
- }
-
- if (pHELCaps)
- {
- /* Setup software caps */
- switch (pHELCaps->dwSize)
- {
- case sizeof(DDCAPS_DX1):
- retVal = DDERR_INVALIDPARAMS;
- break;
- case sizeof(DDCAPS_DX3):
- retVal = DDERR_INVALIDPARAMS;
- break;
- case sizeof(DDCAPS_DX5):
- retVal = DDERR_INVALIDPARAMS;
- break;
-
- /* DDCAPS_DX6 is same as DDCAPS_DX7 */
- case sizeof(DDCAPS_DX7):
- retVal = DDERR_INVALIDPARAMS;
- break;
- default:
- retVal = DDERR_INVALIDPARAMS;
- break;
- }
- }
- }
- _SEH_HANDLE
- {
- retVal = DD_FALSE;
- }
- _SEH_END;
-
- return retVal;
-}
-
-
-
/*
@@ -699,7 +537,7 @@
Main_DirectDraw_EnumDisplayModes, /* (EnumDisplayModes testing / devloping)
*/
Main_DirectDraw_EnumSurfaces,
Main_DirectDraw_FlipToGDISurface,
- Main_DirectDraw_GetCaps, /* (GetCaps testing / devloping) */
+ Main_DirectDraw_GetCaps, /* (GetCaps done) */
Main_DirectDraw_GetDisplayMode, /* (GetDisplayMode testing / devloping)
*/
Main_DirectDraw_GetFourCCCodes, /* (GetFourCCCodes done) */
Main_DirectDraw_GetGDISurface,
Modified: trunk/reactos/dll/directx/ddraw/ddraw.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/ddraw.rb…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/ddraw.rbuild (original)
+++ trunk/reactos/dll/directx/ddraw/ddraw.rbuild Sun Jun 17 19:19:59 2007
@@ -27,6 +27,7 @@
<file>ddraw_main.c</file>
<file>ddraw_displaymode.c</file>
<file>ddraw_setcooperativelevel.c</file>
+ <file>GetCaps.c</file>
<file>GetDeviceIdentifier.c</file>
<file>ddraw_stubs.c</file>
<file>callbacks_dd_hel.c</file>