Implemented IDirect3D9->QueryInterface()

svn path=/trunk/; revision=31332
This commit is contained in:
Gregor Brunmar 2007-12-19 19:49:10 +00:00
parent a5e7839caf
commit 162365cf34
6 changed files with 31 additions and 19 deletions

View file

@ -61,6 +61,7 @@ IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion)
LPDIRECT3D9 D3D9Obj = 0;
LPDIRECT3DCREATE9 DebugDirect3DCreate9 = 0;
CHAR DebugMessageBuffer[DEBUG_MESSAGE_BUFFER_SIZE];
UINT NoDebugSDKVersion = SDKVersion & 0x7FFFFFFF;
UNIMPLEMENTED
@ -80,11 +81,11 @@ IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion)
}
}
if ((SDKVersion & 0x7FFFFFFF) != D3D_SDK_VERSION || (SDKVersion & 0x7FFFFFFF) != D3D9b_SDK_VERSION)
if (NoDebugSDKVersion != D3D_SDK_VERSION && NoDebugSDKVersion != D3D9b_SDK_VERSION)
{
if (SDKVersion & 0x80000000)
{
FormatDebugString(DebugMessageBuffer, DEBUG_MESSAGE_BUFFER_SIZE, D3dError_WrongSdkVersion, SDKVersion, D3D_SDK_VERSION);
FormatDebugString(DebugMessageBuffer, DEBUG_MESSAGE_BUFFER_SIZE, D3dError_WrongSdkVersion, NoDebugSDKVersion, D3D_SDK_VERSION);
OutputDebugStringA(DebugMessageBuffer);
}
@ -98,13 +99,13 @@ IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion)
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;

View file

@ -5,6 +5,8 @@
<library>advapi32</library>
<library>kernel32</library>
<library>uuid</library>
<library>dxguid</library>
<file>d3d9.c</file>
<file>d3d9_helpers.c</file>

View file

@ -56,7 +56,7 @@ HRESULT FormatDebugString(IN OUT LPSTR Buffer, IN LONG BufferSize, IN LPCSTR For
return 0;
}
HRESULT CreateD3D9(IDirect3D9** ppDirect3D9)
HRESULT CreateD3D9(OUT LPDIRECT3D9 *ppDirect3D9)
{
LPDIRECTD3D9_INT pDirect3D9;
@ -71,9 +71,9 @@ HRESULT CreateD3D9(IDirect3D9** ppDirect3D9)
pDirect3D9->unknown000007 = 0;
pDirect3D9->lpInt = 0;
//pDirect3D9->lpVtbl = &IDirect3D3_Vtbl;
pDirect3D9->lpVtbl = &Direct3D9_Vtbl;
pDirect3D9->dwProcessId = GetCurrentThreadId();
pDirect3D9->dwIntRefCnt = 1;
pDirect3D9->dwRefCnt = 1;
*ppDirect3D9 = (IDirect3D9*)pDirect3D9;

View file

@ -16,4 +16,4 @@ BOOL ReadRegistryValue(IN DWORD ValueType, IN LPCSTR ValueName, OUT LPBYTE DataB
HRESULT FormatDebugString(IN OUT LPSTR Buffer, IN LONG BufferSize, IN LPCSTR FormatString, ... );
/* Creates a Direct3D9 object */
HRESULT CreateD3D9(IDirect3D9** ppDirect3D9);
HRESULT CreateD3D9(OUT LPDIRECT3D9 *ppDirect3D9);

View file

@ -9,10 +9,17 @@
#include <debug.h>
static ULONG WINAPI IDirect3D9Impl_AddRef(LPDIRECT3D9 iface);
/* IDirect3D9: IUnknown implementation */
static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9 iface, REFIID riid, LPVOID* ppobj)
static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9 iface, REFIID riid, LPVOID* ppvObject)
{
UNIMPLEMENTED
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirect3D9))
{
IDirect3D9Impl_AddRef(iface);
*ppvObject = iface;
return S_OK;
}
return E_NOINTERFACE;
}
@ -146,7 +153,7 @@ static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9 iface, UINT
static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType,
HWND hFocusWindow, DWORD BehaviourFlags,
D3DPRESENT_PARAMETERS* pPresentationParameters,
IDirect3DDevice9** ppReturnedDeviceInterface)
struct IDirect3DDevice9** ppReturnedDeviceInterface)
{
UNIMPLEMENTED

View file

@ -13,14 +13,16 @@
typedef IDirect3D9* (WINAPI *LPDIRECT3DCREATE9)(UINT);
extern const IDirect3D9Vtbl Direct3D9_Vtbl;
typedef struct _tagDIRECTD3D9_INT_
{
/* 0x0000 */ LPVOID lpVtbl; /* LPDIRECTD3D9 functoions table */
/* 0x0000 */ const IDirect3D9Vtbl *lpVtbl; /* LPDIRECTD3D9 functoions table */
/* 0x0004 */ CRITICAL_SECTION d3d9_cs;
/* 0x001c */ DWORD unknown000007; /* 0x00000001 */
/* 0x001c */ DWORD unknown000007; /* 0x00000001 */
/* 0x0020 */ DWORD dwProcessId;
/* 0x0024 */ struct _tagDIRECTD3D9_INT_ * lpInt;
/* 0x0028 */ volatile LONG dwRefCnt; /* Increases and decreases by AddRef() and Release() */
/* 0x0028 */ LONG dwRefCnt; /* Increases and decreases by AddRef() and Release() */
/* 0x002c */ DWORD unknown000011; /* 0x00000001 - Probably AdapterIndex */
/* 0x0030 */ GUID DisplayGuid; /*? Always {67685559-3106-11D0-B971-00AA00342F9F} ? */
/* 0x0040 */ CHAR DeviceName[16];