Author: gbrunmar
Date: Fri Dec 14 10:13:21 2007
New Revision: 31206
URL:
http://svn.reactos.org/svn/reactos?rev=31206&view=rev
Log:
* Added helper function to read Direct3D registry properties
* Started implementing Direct3DCreate9
Added:
trunk/reactos/dll/directx/d3d9/d3d9_helpers.c (with props)
trunk/reactos/dll/directx/d3d9/d3d9_helpers.h (with props)
Modified:
trunk/reactos/dll/directx/d3d9/d3d9.c
trunk/reactos/dll/directx/d3d9/d3d9.rbuild
trunk/reactos/dll/directx/d3d9/d3d9_private.h
Modified: trunk/reactos/dll/directx/d3d9/d3d9.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9.c?re…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9.c (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9.c Fri Dec 14 10:13:21 2007
@@ -1,5 +1,15 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS ReactX
+ * FILE: dll/directx/d3d9/d3d9.c
+ * PURPOSE: d3d9.dll implementation
+ * PROGRAMERS: Magnus Olsen <greatlrd (at) reactos (dot) org>
+ * Gregor Brunmar <gregor (dot) brunmar (at) home (dot) se>
+ */
+
#include <windows.h>
#include "d3d9_private.h"
+#include "d3d9_helpers.h"
#include <debug.h>
@@ -41,8 +51,31 @@
DLLAPI
IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion)
{
+ HINSTANCE hDebugDll;
+ DWORD LoadDebugDll;
+ DWORD LoadDebugDllSize;
+ LPDIRECT3D9 D3D9Obj = 0;
+ LPDIRECT3DCREATE9 DebugDirect3DCreate9 = 0;
+
UNIMPLEMENTED
- return 0;
+
+ LoadDebugDllSize = sizeof(LoadDebugDll);
+ if (ReadRegistryValue(REG_DWORD, "LoadDebugRuntime",
(LPBYTE)&LoadDebugDll, &LoadDebugDllSize))
+ {
+ if (0 != LoadDebugDll)
+ {
+ hDebugDll = LoadLibrary("d3d9d.dll");
+
+ if (0 != hDebugDll)
+ {
+ DebugDirect3DCreate9 = (LPDIRECT3DCREATE9)GetProcAddress(hDebugDll,
"Direct3DCreate9");
+
+ D3D9Obj = DebugDirect3DCreate9(SDKVersion);
+ }
+ }
+ }
+
+ return D3D9Obj;
}
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
Modified: trunk/reactos/dll/directx/d3d9/d3d9.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9.rbui…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9.rbuild (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9.rbuild Fri Dec 14 10:13:21 2007
@@ -2,6 +2,11 @@
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="d3d9" type="win32dll" entrypoint="0"
installbase="system32" installname="d3d9.dll">
<importlibrary definition="d3d9.def" />
+
+ <library>advapi32</library>
+ <library>kernel32</library>
+
<file>d3d9.c</file>
+ <file>d3d9_helpers.c</file>
<file>d3d9.rc</file>
</module>
Added: trunk/reactos/dll/directx/d3d9/d3d9_helpers.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_help…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_helpers.c (added)
+++ trunk/reactos/dll/directx/d3d9/d3d9_helpers.c Fri Dec 14 10:13:21 2007
@@ -1,0 +1,34 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS ReactX
+ * FILE: dll/directx/d3d9/d3d9_helpers.c
+ * PURPOSE: d3d9.dll helper functions
+ * PROGRAMERS: Gregor Brunmar <gregor (dot) brunmar (at) home (dot) se>
+ */
+
+#include "d3d9_helpers.h"
+
+
+static LPCSTR D3dDebugRegPath = "Software\\Microsoft\\Direct3D";
+
+BOOL ReadRegistryValue(IN DWORD ValueType, IN LPCSTR ValueName, OUT LPBYTE DataBuffer, IN
OUT LPDWORD DataBufferSize)
+{
+ HKEY hKey;
+ DWORD Type;
+ LONG Ret;
+
+ if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, D3dDebugRegPath, 0,
KEY_QUERY_VALUE, &hKey))
+ return FALSE;
+
+ Ret = RegQueryValueEx(hKey, ValueName, 0, &Type, DataBuffer, DataBufferSize);
+
+ RegCloseKey(hKey);
+
+ if (ERROR_SUCCESS != Ret)
+ return FALSE;
+
+ if (Type != ValueType)
+ return FALSE;
+
+ return TRUE;
+}
Propchange: trunk/reactos/dll/directx/d3d9/d3d9_helpers.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/directx/d3d9/d3d9_helpers.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_help…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_helpers.h (added)
+++ trunk/reactos/dll/directx/d3d9/d3d9_helpers.h Fri Dec 14 10:13:21 2007
@@ -1,0 +1,11 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS ReactX
+ * FILE: dll/directx/d3d9/d3d9_helpers.h
+ * PURPOSE: d3d9.dll helper functions
+ * PROGRAMERS: Gregor Brunmar <gregor (dot) brunmar (at) home (dot) se>
+ */
+
+#include <windows.h>
+
+BOOL ReadRegistryValue(IN DWORD ValueType, IN LPCSTR ValueName, OUT LPBYTE DataBuffer, IN
OUT LPDWORD DataBufferSize);
Propchange: trunk/reactos/dll/directx/d3d9/d3d9_helpers.h
------------------------------------------------------------------------------
svn:eol-style = native
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 (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_private.h Fri Dec 14 10:13:21 2007
@@ -1,7 +1,17 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS ReactX
+ * FILE: dll/directx/d3d9/d3d9_helpers.c
+ * PURPOSE: d3d9.dll helper functions
+ * PROGRAMERS: Gregor Brunmar <gregor (dot) brunmar (at) home (dot) se>
+ */
+
#include <windows.h>
#include <d3d9.h>
#define DLLAPI __declspec(dllexport)
+
+typedef IDirect3D9* WINAPI (*LPDIRECT3DCREATE9)(UINT);
struct _tagDIRECTD3D9_INT_
{
@@ -11,7 +21,7 @@
/* 0x0020 */ DWORD dwProcessId;
/* 0x0024 */ struct _tagDIRECTD3D9_INT_ * lpInt;
/* 0x0028 */ DWORD dwIntRefCnt; /* Increases and decreases by AddRef() and
Release() */
-/* 0x002c */ DWORD unknown000011; /* 0x00000001 - Probably AdapterIndex */
+/* 0x002c */ DWORD unknown000011; /* 0x00000001 - Probably AdapterIndex */
/* 0x0030 */ GUID DisplayGuid; /*? Always {67685559-3106-11D0-B971-00AA00342F9F}
? */
/* 0x0040 */ CHAR DeviceName[16];
/* 0x0050 */ DWORD unknown000020;