Author: gbrunmar
Date: Wed Mar 12 14:29:10 2008
New Revision: 32668
URL:
http://svn.reactos.org/svn/reactos?rev=3D32668&view=3Drev
Log:
* Made IDirect3D9 structure more MS compatible.
* Removed duplicate initing of internal structure
* Started implementing IDirect3D9::CreateDevice() error return values
Modified:
trunk/reactos/dll/directx/d3d9/d3d9_caps.c
trunk/reactos/dll/directx/d3d9/d3d9_create.c
trunk/reactos/dll/directx/d3d9/d3d9_impl.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.c?rev=3D32668&r1=3D32667&r2=3D32668&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/dll/directx/d3d9/d3d9_caps.c (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_caps.c Wed Mar 12 14:29:10 2008
@@ -502,6 +502,7 @@
=
memcpy(&pDriverCaps->DriverCaps9, &DriverCaps8, sizeof(D3D=
CAPS8));
pDriverCaps->DriverCaps9.Caps =3D HalInfo.ddCaps.dwCaps;
+ pDriverCaps->dwDriverCaps |=3D D3D9_INT_D3DCAPS8_VALID;
}
}
=
@@ -524,6 +525,7 @@
=
pDriverCaps->DriverCaps9 =3D DriverCaps9;
pDriverCaps->DriverCaps9.Caps =3D HalInfo.ddCaps.dwCaps;
+ pDriverCaps->dwDriverCaps |=3D D3D9_INT_D3DCAPS9_VALID;
}
=
=
Modified: trunk/reactos/dll/directx/d3d9/d3d9_create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9=
_create.c?rev=3D32668&r1=3D32667&r2=3D32668&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/dll/directx/d3d9/d3d9_create.c (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_create.c Wed Mar 12 14:29:10 2008
@@ -177,7 +177,7 @@
=
AdapterIndex =3D 0;
while (EnumDisplayDevicesA(NULL, AdapterIndex, &DisplayDevice, 0) =3D=
=3D TRUE &&
- pDirect3D9->NumDisplayAdapters < DX_D3D9_MAX_NUM_ADAPTERS)
+ pDirect3D9->NumDisplayAdapters < D3D9_INT_MAX_NUM_ADAPTERS)
{
if ((DisplayDevice.StateFlags & (DISPLAY_DEVICE_DISCONNECT | DISPL=
AY_DEVICE_MIRRORING_DRIVER)) =3D=3D 0 &&
(DisplayDevice.StateFlags & (DISPLAY_DEVICE_PRIMARY_DEVICE | D=
ISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) !=3D 0)
@@ -196,7 +196,7 @@
=
AdapterIndex =3D 0;
while (EnumDisplayDevicesA(NULL, AdapterIndex, &DisplayDevice, 0) =3D=
=3D TRUE &&
- pDirect3D9->NumDisplayAdapters < DX_D3D9_MAX_NUM_ADAPTERS)
+ pDirect3D9->NumDisplayAdapters < D3D9_INT_MAX_NUM_ADAPTERS)
{
if ((DisplayDevice.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP=
) !=3D 0 &&
(DisplayDevice.StateFlags & (DISPLAY_DEVICE_MIRRORING_DRIVER |=
DISPLAY_DEVICE_PRIMARY_DEVICE)) =3D=3D 0)
@@ -240,13 +240,6 @@
pDirect3D9->dwProcessId =3D GetCurrentThreadId();
pDirect3D9->dwRefCnt =3D 1;
=
- pDirect3D9->unknown004576 =3D 0;
- pDirect3D9->unknown004578 =3D 0;
- pDirect3D9->unknown004579 =3D 0;
- pDirect3D9->unknown004580 =3D 0;
- pDirect3D9->unknown004581 =3D 0;
- pDirect3D9->unknown004582 =3D 0;
- pDirect3D9->unknown004583 =3D 0;
pDirect3D9->SDKVersion =3D SDKVersion;
=
pDirect3D9->lpInt =3D pDirect3D9;
@@ -254,7 +247,6 @@
=
InitializeCriticalSection(&pDirect3D9->d3d9_cs);
=
- memset(pDirect3D9->DisplayAdapters, 0, sizeof(pDirect3D9->DisplayAdapt=
ers));
GetDisplayDeviceInfo(pDirect3D9);
=
*ppDirect3D9 =3D (LPDIRECT3D9)&pDirect3D9->lpVtbl;
Modified: trunk/reactos/dll/directx/d3d9/d3d9_impl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9=
_impl.c?rev=3D32668&r1=3D32667&r2=3D32668&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/dll/directx/d3d9/d3d9_impl.c (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_impl.c Wed Mar 12 14:29:10 2008
@@ -881,6 +881,55 @@
D3DPRESENT_PARAMETERS* p=
PresentationParameters,
struct IDirect3DDevice9*=
* ppReturnedDeviceInterface)
{
+ DWORD NumAdaptersToCreate;
+
+ LPDIRECT3D9_INT This =3D impl_from_IDirect3D9(iface);
+ LOCK_D3D9();
+
+ if (Adapter >=3D This->NumDisplayAdapters)
+ {
+ DPRINT1("Invalid Adapter number specified");
+ UNLOCK_D3D9();
+ return D3DERR_INVALIDCALL;
+ }
+
+ if (DeviceType !=3D D3DDEVTYPE_HAL &&
+ DeviceType !=3D D3DDEVTYPE_REF &&
+ DeviceType !=3D D3DDEVTYPE_SW)
+ {
+ DPRINT1("Invalid DeviceType specified");
+ UNLOCK_D3D9();
+ return D3DERR_INVALIDCALL;
+ }
+
+ if (DeviceType !=3D D3DDEVTYPE_HAL)
+ {
+ UNIMPLEMENTED
+ DPRINT1("Sorry, only D3DDEVTYPE_HAL is implemented at this time...=
");
+ return D3DERR_INVALIDCALL;
+ }
+
+ if (hFocusWindow !=3D NULL && FALSE =3D=3D IsWindow(hFocusWindow))
+ {
+ DPRINT1("Invalid hFocusWindow parameter specified");
+ UNLOCK_D3D9();
+ return D3DERR_INVALIDCALL;
+ }
+
+ if (IsBadWritePtr(ppReturnedDeviceInterface, sizeof(IDirect3DDevice9*)=
))
+ {
+ DPRINT1("Invalid ppReturnedDeviceInterface parameter specified");
+ UNLOCK_D3D9();
+ return D3DERR_INVALIDCALL;
+ }
+
+ if ((BehaviourFlags & D3DCREATE_ADAPTERGROUP_DEVICE) !=3D 0)
+ NumAdaptersToCreate =3D This->DisplayAdapters[Adapter].NumAdapters=
InGroup;
+ else
+ NumAdaptersToCreate =3D 1;
+
+ *ppReturnedDeviceInterface =3D 0;
+
UNIMPLEMENTED
=
return D3D_OK;
Modified: trunk/reactos/dll/directx/d3d9/d3d9_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9=
_private.h?rev=3D32668&r1=3D32667&r2=3D32668&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/dll/directx/d3d9/d3d9_private.h (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_private.h Wed Mar 12 14:29:10 2008
@@ -11,7 +11,10 @@
#include <windows.h>
#include <ddraw.h>
=
-#define DX_D3D9_MAX_NUM_ADAPTERS 12
+#define D3D9_INT_MAX_NUM_ADAPTERS 12
+
+#define D3D9_INT_D3DCAPS8_VALID 1
+#define D3D9_INT_D3DCAPS9_VALID 2
=
typedef struct _D3D9Unknown6BC_INT_
{
@@ -64,7 +67,7 @@
/* 0x0148 */ DWORD dwSVBCaps;
/* 0x014c */ DWORD dwVSBCaps;
/* 0x0150 */ DWORD dwSVBCaps2;
-/* 0x0154 */ DWORD unknown0085;
+/* 0x0154 */ DWORD dwDriverCaps;
/* 0x0158 */ DWORD NumSupportedFormatOps;
/* 0x015c */ LPDDSURFACEDESC pSupportedFormatOps;
/* 0x0160 */ DWORD unknown0088;
@@ -162,7 +165,7 @@
/* 0x0024 */ struct _tagDIRECT3D9_INT_ *lpInt;
/* 0x0028 */ LONG dwRefCnt; /* Increases and decreases by AddR=
ef() and Release() */
/* 0x002c */ UINT NumDisplayAdapters;
-/* 0x0030 */ Direct3D9DisplayAdapterInfo_INT DisplayAdapters[DX_D3D9_MA=
X_NUM_ADAPTERS];
+/* 0x0030 */ Direct3D9DisplayAdapterInfo_INT DisplayAdapters[D3D9_INT_M=
AX_NUM_ADAPTERS];
/* 0x2100 */ DWORD unknown002112;
/* 0x2104 */ DWORD unknown002113;
/* 0x2108 */ DWORD unknown002114;