Author: gbrunmar
Date: Wed May 7 13:00:50 2008
New Revision: 33347
URL:
http://svn.reactos.org/svn/reactos?rev=33347&view=rev
Log:
* Fixed an error in IDirect3DDevice9::GetDisplayMode() spotted by Steven Edwards
* Renamed an internal D3D9 struct variable
* Re-implemented IDirect3DDevice9::GetAvailableTextureMem(), hopefully more correct this
time around
Modified:
trunk/reactos/dll/directx/d3d9/d3d9_caps.c
trunk/reactos/dll/directx/d3d9/d3d9_device.c
trunk/reactos/dll/directx/d3d9/d3d9_private.h
Modified: trunk/reactos/dll/directx/d3d9/d3d9_caps.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_caps…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_caps.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_caps.c [iso-8859-1] Wed May 7 13:00:50 2008
@@ -90,8 +90,8 @@
return;
}
- pUnknown6BC->hDD = OsThunkDdCreateDirectDrawObject(hDC);
- if (0 == pUnknown6BC->hDD)
+ pUnknown6BC->hDirectDrawLocal = OsThunkDdCreateDirectDrawObject(hDC);
+ if (0 == pUnknown6BC->hDirectDrawLocal)
{
HeapFree(GetProcessHeap(), 0, pUnknown6BC);
return;
@@ -116,7 +116,7 @@
static void ReleaseInternalDeviceData(LPD3D9_DEVICEDATA pDeviceData)
{
- OsThunkDdDeleteDirectDrawObject(pDeviceData->pUnknown6BC->hDD);
+ OsThunkDdDeleteDirectDrawObject(pDeviceData->pUnknown6BC->hDirectDrawLocal);
HeapFree(GetProcessHeap(), 0, pDeviceData->pUnknown6BC);
pDeviceData->pUnknown6BC = NULL;
@@ -302,7 +302,7 @@
BOOL bDisplayModeWasChanged;
/* Try the real way first */
- if (TRUE == OsThunkDdReenableDirectDrawObject(pUnknown->hDD,
&bDisplayModeWasChanged))
+ if (TRUE == OsThunkDdReenableDirectDrawObject(pUnknown->hDirectDrawLocal,
&bDisplayModeWasChanged))
return TRUE;
/* Ref types and software types can always be reenabled after a mode switch */
@@ -384,7 +384,7 @@
bRet = OsThunkDdQueryDirectDrawObject(
- pUnknown6BC->hDD,
+ pUnknown6BC->hDirectDrawLocal,
&HalInfo,
CallBackFlags,
&D3dCallbacks,
@@ -407,7 +407,7 @@
puD3dTextureFormats != NULL)
{
bRet = OsThunkDdQueryDirectDrawObject(
- pUnknown6BC->hDD,
+ pUnknown6BC->hDirectDrawLocal,
&HalInfo,
CallBackFlags,
&D3dCallbacks,
@@ -447,7 +447,7 @@
DxVersion.dwDXVersion = dwDXVersion;
PrepareDriverInfoData(&DrvInfo, &DxVersion, sizeof(DxVersion));
- OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD, &DrvInfo);
+ OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal, &DrvInfo);
}
@@ -455,7 +455,7 @@
{
ResetGetDriverInfo2Data(&DdiVersion.gdi2, D3DGDI2_TYPE_GETDDIVERSION,
sizeof(DD_GETDDIVERSIONDATA));
PrepareDriverInfoData(&DrvInfo, &DdiVersion, sizeof(DdiVersion));
- bRet = OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD, &DrvInfo);
+ bRet = OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal,
&DrvInfo);
if (DdiVersion.dwDDIVersion != DX9_DDI_VERSION)
{
@@ -492,7 +492,7 @@
ResetGetDriverInfo2Data((DD_GETDRIVERINFO2DATA*)&DriverCaps8,
D3DGDI2_TYPE_GETD3DCAPS8, sizeof(D3DCAPS8));
PrepareDriverInfoData(&DrvInfo, &DriverCaps8, sizeof(D3DCAPS8));
- if (FALSE == OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD,
&DrvInfo) ||
+ if (FALSE == OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal,
&DrvInfo) ||
S_OK != DrvInfo.ddRVal ||
DrvInfo.dwActualSize != sizeof(D3DCAPS8))
{
@@ -515,7 +515,7 @@
ResetGetDriverInfo2Data((DD_GETDRIVERINFO2DATA*)&DriverCaps9,
D3DGDI2_TYPE_GETD3DCAPS9, sizeof(D3DCAPS9));
PrepareDriverInfoData(&DrvInfo, &DriverCaps9, sizeof(D3DCAPS9));
- if (FALSE == OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD,
&DrvInfo) ||
+ if (FALSE == OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal,
&DrvInfo) ||
S_OK != DrvInfo.ddRVal ||
DrvInfo.dwActualSize != sizeof(D3DCAPS9))
{
@@ -536,7 +536,7 @@
FormatCountData.dwFormatCount = UINT_MAX;
FormatCountData.dwReserved = dwDXVersion;
- if (TRUE == OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD,
&DrvInfo))
+ if (TRUE == OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal,
&DrvInfo))
{
if (DrvInfo.ddRVal != S_OK)
{
@@ -570,7 +570,7 @@
PrepareDriverInfoData(&DrvInfo, &FormatData,
sizeof(DD_GETFORMATDATA));
FormatData.dwFormatIndex = FormatIndex;
- if (TRUE == OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD,
&DrvInfo))
+ if (TRUE == OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal,
&DrvInfo))
{
if (DrvInfo.ddRVal != S_OK)
{
@@ -612,7 +612,7 @@
ExModeCountData.dwModeCount = UINT_MAX;
ExModeCountData.dwReserved = dwDXVersion;
- if (TRUE == OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD,
&DrvInfo))
+ if (TRUE == OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal,
&DrvInfo))
{
if (DrvInfo.ddRVal == S_OK)
{
@@ -649,7 +649,7 @@
ExModeData.dwModeIndex = ModeIndex;
ExModeData.mode.Width = UINT_MAX;
- if (TRUE == OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD,
&DrvInfo))
+ if (TRUE == OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal,
&DrvInfo))
{
if (DrvInfo.ddRVal != S_OK)
{
@@ -680,7 +680,7 @@
PrepareDriverInfoData(&DrvInfo, &AdapterGroupData,
sizeof(DD_GETADAPTERGROUPDATA));
AdapterGroupData.ulUniqueAdapterGroupId = UINT_MAX;
- if (TRUE == OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD,
&DrvInfo))
+ if (TRUE == OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal,
&DrvInfo))
{
if (DrvInfo.ddRVal != S_OK)
{
@@ -708,7 +708,7 @@
PrepareDriverInfoData(&DrvInfo, &D3dQueryCountData,
sizeof(DD_GETD3DQUERYCOUNTDATA));
D3dQueryCountData.dwNumQueries = UINT_MAX;
- if (TRUE == OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD,
&DrvInfo))
+ if (TRUE == OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal,
&DrvInfo))
{
if (DrvInfo.ddRVal != S_OK)
{
@@ -742,7 +742,7 @@
PrepareDriverInfoData(&DrvInfo, &D3dQueryData,
sizeof(DD_GETD3DQUERYDATA));
D3dQueryData.dwQueryIndex = QueryIndex;
- if (TRUE == OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD,
&DrvInfo))
+ if (TRUE == OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal,
&DrvInfo))
{
if (DrvInfo.ddRVal != S_OK)
{
@@ -773,7 +773,7 @@
DrvInfo.guidInfo = GUID_D3DExtendedCaps;
DrvInfo.dwExpectedSize = sizeof(D3DHAL_D3DEXTENDEDCAPS);
DrvInfo.lpvData = pD3dExtendedCaps;
- bRet = OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD, &DrvInfo);
+ bRet = OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal, &DrvInfo);
if (TRUE != bRet || DrvInfo.ddRVal != S_OK)
{
@@ -790,7 +790,7 @@
DrvInfo.guidInfo = GUID_ZPixelFormats;
DrvInfo.dwExpectedSize = FormatCountData.dwFormatCount * sizeof(DDPIXELFORMAT);
DrvInfo.lpvData = pZPixelFormats;
- bRet = OsThunkDdGetDriverInfo((HANDLE)pUnknown6BC->hDD, &DrvInfo);
+ bRet = OsThunkDdGetDriverInfo(pUnknown6BC->hDirectDrawLocal, &DrvInfo);
if (TRUE != bRet || DrvInfo.ddRVal != S_OK)
{
Modified: trunk/reactos/dll/directx/d3d9/d3d9_device.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_devi…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_device.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_device.c [iso-8859-1] Wed May 7 13:00:50 2008
@@ -88,22 +88,19 @@
static UINT WINAPI IDirect3DDevice9Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE9 iface)
{
UINT AvailableTextureMemory = 0;
- DDHAL_GETAVAILDRIVERMEMORYDATA ddGetAvailDriverMemoryData;
+ D3D9_GETAVAILDRIVERMEMORYDATA d3d9GetAvailDriverMemoryData;
LPDIRECT3DDEVICE9_INT This = impl_from_IDirect3DDevice9(iface);
LOCK_D3DDEVICE9();
- memset(&ddGetAvailDriverMemoryData, 0, sizeof(ddGetAvailDriverMemoryData));
- ddGetAvailDriverMemoryData.lpDD =
(LPDDRAWI_DIRECTDRAW_GBL)&This->DeviceData[0].pUnknown6BC->hDD;
- ddGetAvailDriverMemoryData.ddRVal = DDERR_GENERIC;
-
- if (DDHAL_DRIVER_HANDLED ==
(*This->DeviceData[0].D3D9Callbacks.DdGetAvailDriverMemory)(&ddGetAvailDriverMemoryData))
+ memset(&d3d9GetAvailDriverMemoryData, 0, sizeof(d3d9GetAvailDriverMemoryData));
+ d3d9GetAvailDriverMemoryData.pUnknown6BC = This->DeviceData[0].pUnknown6BC;
+ d3d9GetAvailDriverMemoryData.dwMemoryType = D3D9_GETAVAILDRIVERMEMORY_TYPE_ALL;
+
+ if (TRUE ==
(*This->DeviceData[0].D3D9Callbacks.DdGetAvailDriverMemory)(&d3d9GetAvailDriverMemoryData))
{
- if (DD_OK == ddGetAvailDriverMemoryData.ddRVal)
- {
- /* Round it up to the nearest MB */
- AvailableTextureMemory = (ddGetAvailDriverMemoryData.dwFree + 0x80000) &
0xFFF00000;
- }
+ /* Round it up to the nearest MB */
+ AvailableTextureMemory = (d3d9GetAvailDriverMemoryData.dwFree + 0x80000) &
0xFFF00000;
}
UNLOCK_D3DDEVICE9();
@@ -226,7 +223,7 @@
return D3DERR_INVALIDCALL;
}
- if (IsBadWritePtr(pMode, sizeof(D3DDISPLAYMODE*)))
+ if (IsBadWritePtr(pMode, sizeof(D3DDISPLAYMODE)))
{
DPRINT1("Invalid pMode parameter specified");
UNLOCK_D3DDEVICE9();
Modified: trunk/reactos/dll/directx/d3d9/d3d9_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_priv…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_private.h [iso-8859-1] Wed May 7 13:00:50 2008
@@ -10,16 +10,31 @@
#include <windows.h>
#include <ddraw.h>
-#include <ddrawi.h>
#define D3D9_INT_MAX_NUM_ADAPTERS 12
#define D3D9_INT_D3DCAPS8_VALID 1
#define D3D9_INT_D3DCAPS9_VALID 2
+typedef enum _D3D9_GETAVAILDRIVERMEMORY_TYPE
+{
+ D3D9_GETAVAILDRIVERMEMORY_TYPE_ALL = 0,
+ D3D9_GETAVAILDRIVERMEMORY_TYPE_LOCAL = 4,
+ D3D9_GETAVAILDRIVERMEMORY_TYPE_NONLOCAL = 5,
+} D3D9_GETAVAILDRIVERMEMORY_TYPE;
+
+typedef struct _D3D9_GETAVAILDRIVERMEMORYDATA
+{
+/* 0x0000 */ struct _D3D9Unknown6BC_* pUnknown6BC;
+/* 0x0004 */ D3D9_GETAVAILDRIVERMEMORY_TYPE dwMemoryType;
+/* 0x0008 */ DWORD dwTextureType;
+/* 0x000c */ DWORD dwFree;
+} D3D9_GETAVAILDRIVERMEMORYDATA, FAR* LPD3D9_GETAVAILDRIVERMEMORYDATA;
+typedef BOOL (WINAPI FAR* LPD3D9_GETAVAILDRIVERMEMORY)(LPD3D9_GETAVAILDRIVERMEMORYDATA);
+
typedef struct _D3D9Unknown6BC_
{
-/* 0x0000 */ HANDLE hDD;
+/* 0x0000 */ HANDLE hDirectDrawLocal;
/* 0x0004 */ LPDWORD pUnknown0004;
/* 0x0008 */ DWORD dwUnknown0008;
/* 0x000c */ CHAR szDeviceName[CCHDEVICENAME];
@@ -108,7 +123,7 @@
/* 0x0044 */ DWORD DdFlip;
/* 0x0048 */ DWORD DdGetBltStatus;
/* 0x004c */ DWORD DdGetFlipStatus;
-/* 0x0050 */ LPDDHAL_GETAVAILDRIVERMEMORY DdGetAvailDriverMemory;
+/* 0x0050 */ LPD3D9_GETAVAILDRIVERMEMORY DdGetAvailDriverMemory;
/* 0x0054 */ DWORD unknown0115;
/* 0x0058 */ DWORD DdSetMode;
/* 0x005c */ DWORD DdSetExclusiveMode;