<library>d3d8thk</library>\r
\r
<file>d3d9.c</file>\r
- <file>d3d9_helpers.c</file>\r
- <file>d3d9_impl.c</file>\r
<file>d3d9_baseobject.c</file>\r
- <file>d3d9_create.c</file>\r
<file>d3d9_caps.c</file>\r
+ <file>d3d9_create.c</file>\r
+ <file>d3d9_cursor.c</file>\r
<file>d3d9_device.c</file>\r
- <file>d3d9_swapchain.c</file>\r
- <file>d3d9_puredevice.c</file>\r
<file>d3d9_haldevice.c</file>\r
+ <file>d3d9_helpers.c</file>\r
+ <file>d3d9_impl.c</file>\r
+ <file>d3d9_puredevice.c</file>\r
+ <file>d3d9_swapchain.c</file>\r
<file>adapter.c</file>\r
<file>device.c</file>\r
<file>format.c</file>\r
return E_NOINTERFACE;
}
+
+HRESULT D3D9BaseObject_GetDeviceInt(D3D9BaseObject* pBaseObject, DIRECT3DDEVICE9_INT** ppDevice)
+{
+ if (pBaseObject->pUnknown)
+ {
+ LPDIRECT3DDEVICE9 pDevice;
+ if (FAILED(pBaseObject->pUnknown->lpVtbl->QueryInterface((IUnknown*) &pBaseObject->pUnknown->lpVtbl, &IID_IDirect3DDevice9, (void**)&pDevice)))
+ return E_NOINTERFACE;
+
+ *ppDevice = IDirect3DDevice9ToImpl(pDevice);
+ return D3D_OK;
+ }
+
+ return E_NOINTERFACE;
+}
#include <d3d9.h>
struct _D3D9BaseObject;
+struct _Direct3DDevice9_INT;
enum REF_TYPE
{
ULONG D3D9BaseObject_AddRef(D3D9BaseObject* pBaseObject);
ULONG D3D9BaseObject_Release(D3D9BaseObject* pBaseObject);
HRESULT D3D9BaseObject_GetDevice(D3D9BaseObject* pBaseObject, IDirect3DDevice9** ppDevice);
+HRESULT D3D9BaseObject_GetDeviceInt(D3D9BaseObject* pBaseObject, struct _Direct3DDevice9_INT** ppDevice);
#endif // _D3D9_BASEOBJECT_H_
--- /dev/null
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS ReactX
+ * FILE: dll/directx/d3d9/d3d9_cursor.h
+ * PURPOSE: d3d9.dll internal cursor methods
+ * PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
+ */
+#include "d3d9_cursor.h"
+
+#include <debug.h>
+#include <d3d9.h>
+#include "d3d9_private.h"
+#include "adapter.h"
+#include "d3d9_device.h"
+#include "d3d9_swapchain.h"
+#include "d3d9_helpers.h"
+
+D3D9Cursor* CreateD3D9Cursor(struct _Direct3DDevice9_INT* pBaseDevice, struct _Direct3DSwapChain9_INT* pSwapChain)
+{
+ D3D9Cursor* pCursor;
+
+ if (FAILED(AlignedAlloc((LPVOID*)&pCursor, sizeof(D3D9Cursor))))
+ {
+ DPRINT1("Failed to allocate D3D9Cursor");
+ return NULL;
+ }
+
+ pCursor->pBaseDevice = pBaseDevice;
+ pCursor->pSwapChain = pSwapChain;
+ pCursor->dwWidth = pSwapChain->dwWidth / 2;
+ pCursor->dwHeight = pSwapChain->dwHeight / 2;
+
+ return pCursor;
+}
--- /dev/null
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS ReactX
+ * FILE: dll/directx/d3d9/d3d9_cursor.h
+ * PURPOSE: d3d9.dll internal cursor methods
+ * PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
+ */
+#ifndef _D3D9_CURSOR_H
+#define _D3D9_CURSOR_H
+
+#include "d3d9_common.h"
+
+typedef struct _D3D9Cursor
+{
+/* 0x0000 */ DWORD dwUnknown0000;
+/* 0x0004 */ DWORD dwUnknown0004;
+/* 0x0008 */ DWORD dwUnknown0008;
+/* 0x000c */ DWORD dwUnknown000c;
+/* 0x0010 */ DWORD dwUnknown0010;
+/* 0x0014 */ DWORD dwUnknown0014;
+/* 0x0018 */ DWORD dwWidth;
+/* 0x001c */ DWORD dwHeight;
+/* 0x0020 */ DWORD dwUnknown0020[18];
+/* 0x0070 */ struct _Direct3DDevice9_INT* pBaseDevice;
+/* 0x0074 */ struct _Direct3DSwapChain9_INT* pSwapChain;
+/* 0x0078 */ DWORD dwUnknown0078;
+/* 0x007c */ DWORD dwMonitorVirtualX;
+/* 0x0080 */ DWORD dwMonitorVirtualY;
+/* 0x0084 */ DWORD dwUnknown0084;
+} D3D9Cursor;
+
+D3D9Cursor* CreateD3D9Cursor(struct _Direct3DDevice9_INT* pBaseDevice, struct _Direct3DSwapChain9_INT* pSwapChain);
+
+#endif // _D3D9_CURSOR_H
#define UNLOCK_D3DDEVICE9() if (This->bLockDevice) LeaveCriticalSection(&This->CriticalSection);
/* Convert a IDirect3D9 pointer safely to the internal implementation struct */
-static LPDIRECT3DDEVICE9_INT IDirect3DDevice9ToImpl(LPDIRECT3DDEVICE9 iface)
+LPDIRECT3DDEVICE9_INT IDirect3DDevice9ToImpl(LPDIRECT3DDEVICE9 iface)
{
if (NULL == iface)
return NULL;
{
DestroyD3D9DeviceData(&This->DeviceData[iAdapter]);
}
+ This->lpVtbl->VirtualDestructor(iface);
LeaveCriticalSection(&This->CriticalSection);
AlignedFree(This);
return ref;
}
-/* IDirect3D9Device interface */
+/* IDirect3DDevice9 public interface */
HRESULT WINAPI IDirect3DDevice9Base_TestCooperativeLevel(LPDIRECT3DDEVICE9 iface)
{
UNIMPLEMENTED
return D3D_OK;
}
+
+/* IDirect3DDevice9 private interface */
+VOID WINAPI IDirect3DDevice9Base_Destroy(LPDIRECT3DDEVICE9 iface)
+{
+ UNIMPLEMENTED
+}
+
+VOID WINAPI IDirect3DDevice9Base_VirtualDestructor(LPDIRECT3DDEVICE9 iface)
+{
+ UNIMPLEMENTED
+}
/* 0x0014 - 0x0174 */ D3D9HeapTexture* pTextureHeap;
} D3D9ResourceManager;
-typedef struct _D3D9Cursor
-{
-/* 0x0000 */ DWORD dwUnknown0000;
-/* 0x0004 */ DWORD dwUnknown0004;
-/* 0x0008 */ DWORD dwUnknown0008;
-/* 0x000c */ DWORD dwUnknown000c;
-/* 0x0010 */ DWORD dwUnknown0010;
-/* 0x0014 */ DWORD dwUnknown0014;
-/* 0x0018 */ DWORD dwWidth;
-/* 0x001c */ DWORD dwHeight;
-/* 0x0020 */ DWORD dwUnknown0020[18];
-/* 0x0070 */ struct _Direct3DDevice9_INT* pBaseDevice;
-/* 0x0074 */ struct _Direct3DSwapChain9_INT* pSwapChain;
-/* 0x0078 */ DWORD dwUnknown0078;
-/* 0x007c */ DWORD dwMonitorVirtualX;
-/* 0x0080 */ DWORD dwMonitorVirtualY;
-/* 0x0084 */ DWORD dwUnknown0084;
-} D3D9Cursor;
-
typedef struct _Direct3DDevice9_INT
{
/* 0x0000 */ struct _IDirect3DDevice9Vtbl_INT* lpVtbl;
/* 0x1f44 */ DWORD unknown002001;
} DIRECT3DDEVICE9_INT, FAR* LPDIRECT3DDEVICE9_INT;
+/* Helper functions */
+LPDIRECT3DDEVICE9_INT IDirect3DDevice9ToImpl(LPDIRECT3DDEVICE9 iface);
+
/* IUnknown interface */
HRESULT WINAPI IDirect3DDevice9Base_QueryInterface(LPDIRECT3DDEVICE9 iface, REFIID riid, void** ppvObject);
ULONG WINAPI IDirect3DDevice9Base_AddRef(LPDIRECT3DDEVICE9 iface);
ULONG WINAPI IDirect3DDevice9Base_Release(LPDIRECT3DDEVICE9 iface);
-/* IDirect3D9Device public interface */
+/* IDirect3DDevice9 public interface */
HRESULT WINAPI IDirect3DDevice9Base_TestCooperativeLevel(LPDIRECT3DDEVICE9 iface);
UINT WINAPI IDirect3DDevice9Base_GetAvailableTextureMem(LPDIRECT3DDEVICE9 iface);
HRESULT WINAPI IDirect3DDevice9Base_EvictManagedResources(LPDIRECT3DDEVICE9 iface);
HRESULT WINAPI IDirect3DDevice9Base_ColorFill(LPDIRECT3DDEVICE9 iface, IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color);
HRESULT WINAPI IDirect3DDevice9Base_CreateOffscreenPlainSurface(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle);
+/* IDirect3DDevice9 private interface */
+VOID WINAPI IDirect3DDevice9Base_Destroy(LPDIRECT3DDEVICE9 iface);
+VOID WINAPI IDirect3DDevice9Base_VirtualDestructor(LPDIRECT3DDEVICE9 iface);
+
#endif /* _D3D9_DEVICE_H_ */
#include "d3d9_helpers.h"
#include "d3d9_device.h"
+#include "d3d9_cursor.h"
#define LOCK_D3DDEVICE9() if (This->BaseObject.pUnknown && ((LPDIRECT3DDEVICE9_INT)This->BaseObject.pUnknown)->bLockDevice) \
EnterCriticalSection(&((LPDIRECT3DDEVICE9_INT)This->BaseObject.pUnknown)->CriticalSection);
Direct3DSwapChain9_INT* CreateDirect3DSwapChain9(enum REF_TYPE RefType, struct _Direct3DDevice9_INT* pBaseDevice, DWORD ChainIndex)
{
Direct3DSwapChain9_INT* pThisSwapChain;
- if (FAILED(AlignedAlloc((LPVOID *)&pThisSwapChain, sizeof(Direct3DSwapChain9_INT))))
+ if (FAILED(AlignedAlloc((LPVOID*)&pThisSwapChain, sizeof(Direct3DSwapChain9_INT))))
{
DPRINT1("Could not create Direct3DSwapChain9_INT");
return NULL;
return pThisSwapChain;
}
-VOID Direct3DSwapChain9_SetDisplayMode(Direct3DSwapChain9_INT* pThisSwapChain, D3DDISPLAYMODE* pMode)
+VOID Direct3DSwapChain9_SetDisplayMode(Direct3DSwapChain9_INT* pThisSwapChain, D3DPRESENT_PARAMETERS* pPresentationParameters)
{
- pThisSwapChain->dwWidth = pMode->Width;
- pThisSwapChain->dwHeight = pMode->Height;
+ pThisSwapChain->dwWidth = pPresentationParameters->BackBufferWidth;
+ pThisSwapChain->dwHeight = pPresentationParameters->BackBufferHeight;
}
HRESULT Direct3DSwapChain9_Init(Direct3DSwapChain9_INT* pThisSwapChain, D3DPRESENT_PARAMETERS* pPresentationParameters)
{
int i;
+ DIRECT3DDEVICE9_INT* pDevice;
for (i = 0; i < 256; i++)
{
pThisSwapChain->PresentParameters = pPresentationParameters[pThisSwapChain->ChainIndex];
pThisSwapChain->SwapEffect = pPresentationParameters->SwapEffect;
+ Direct3DSwapChain9_SetDisplayMode(pThisSwapChain, &pThisSwapChain->PresentParameters);
+
+ if (FAILED(D3D9BaseObject_GetDeviceInt(&pThisSwapChain->BaseObject, &pDevice)))
+ {
+ DPRINT1("Could not get the swapchain device");
+ return DDERR_GENERIC;
+ }
+
+ pThisSwapChain->pCursor = CreateD3D9Cursor(pDevice, pThisSwapChain);
+ if (NULL == pThisSwapChain->pCursor)
+ {
+ DPRINT1("Could not allocate D3D9Cursor");
+ return DDERR_OUTOFMEMORY;
+ }
return Direct3DSwapChain9_Reset(pThisSwapChain, pPresentationParameters);
}
Direct3DSwapChain9_INT* CreateDirect3DSwapChain9(enum REF_TYPE RefType, struct _Direct3DDevice9_INT* pBaseDevice, DWORD ChainIndex);
-VOID Direct3DSwapChain9_SetDisplayMode(Direct3DSwapChain9_INT* pThisSwapChain, D3DDISPLAYMODE* pMode);
+VOID Direct3DSwapChain9_SetDisplayMode(Direct3DSwapChain9_INT* pThisSwapChain, D3DPRESENT_PARAMETERS* pPresentationParameters);
HRESULT Direct3DSwapChain9_Init(Direct3DSwapChain9_INT* pThisSwapChain, D3DPRESENT_PARAMETERS* pPresentationParameters);
HRESULT Direct3DSwapChain9_Reset(Direct3DSwapChain9_INT* pThisSwapChain, D3DPRESENT_PARAMETERS* pPresentationParameters);
pThisBaseDevice->pSwapChains[i] = CreateDirect3DSwapChain9(RT_BUILTIN, pThisBaseDevice, i);
pThisBaseDevice->pSwapChains2[i] = pThisBaseDevice->pSwapChains[i];
- Direct3DSwapChain9_SetDisplayMode(pThisBaseDevice->pSwapChains[i], &pThisBaseDevice->CurrentDisplayMode[i]);
if (FAILED(Direct3DSwapChain9_Init(pThisBaseDevice->pSwapChains[i], pPresentationParameters)))
{