--- /dev/null
+*.obj
+*.dll
+*.lib
+*.exp
+.scons*
--- /dev/null
+Wrapper DLLs to trace D3D8 and D3D9 APIs calls.
+
+Base on the idea and code (public domain) from Michael Koch.
+
+See also:
+- http://www.mikoweb.eu/index.php?node=21
+- http://www.codeguru.com/cpp/g-m/directx/directx8/article.php/c11453/
+- http://doc.51windows.net/Directx9_SDK/?url=/directx9_sdk/graphics/programmingguide/TutorialsAndSamplesAndToolsAndTips/Tools/D3DSpy.htm
+
+
+--
+Jose Fonseca <jrfonseca@tungstengraphics.com>
\ No newline at end of file
--- /dev/null
+#######################################################################
+# Top-level SConstruct
+#
+# For example, invoke scons as
+#
+# scons debug=1
+#
+# to set configuration variables. Or you can write those options to a file
+# named config.py:
+#
+# # config.py
+# debug=1
+# dxsdk='C:\\DXSDK'
+#
+# Invoke
+#
+# scons -h
+#
+# to get the full list of options. See scons manpage for more info.
+#
+
+import os
+import os.path
+import sys
+
+opts = Options('config.py')
+opts.Add(BoolOption('debug', 'build debug version', 'no'))
+opts.Add(PathOption('dxsdk', 'DirectX SDK installation dir', os.environ.get('DXSDK_DIR', 'C:\\DXSDK')))
+
+env = Environment(
+ options = opts,
+ ENV = os.environ)
+Help(opts.GenerateHelpText(env))
+
+env.Append(CPPDEFINES = [
+ 'WIN32',
+ '_WINDOWS',
+ '_UNICODE',
+ 'UNICODE',
+ '_CRT_SECURE_NO_DEPRECATE',
+ '_CRT_NON_CONFORMING_SWPRINTFS',
+])
+
+if env['debug']:
+ env.Append(CPPDEFINES = ['_DEBUG'])
+else:
+ env.Append(CPPDEFINES = ['NDEBUG'])
+#env['PDB'] = '${TARGET.base}.pdb'
+
+cflags = [
+ '/W3', # warning level
+]
+if env['debug']:
+ cflags += [
+ '/Od', # disable optimizations
+ '/Oi', # enable intrinsic functions
+ '/Oy-', # disable frame pointer omission
+ ]
+else:
+ cflags += [
+ '/Ox', # maximum optimizations
+ '/Oi', # enable intrinsic functions
+ '/Os', # favor code space
+ ]
+env.Append(CFLAGS = cflags)
+env.Append(CXXFLAGS = cflags)
+
+env.Prepend(LIBS = [
+ 'kernel32',
+ 'user32',
+ 'gdi32',
+ 'winspool',
+ 'comdlg32',
+ 'advapi32',
+ 'shell32',
+ 'ole32',
+ 'oleaut32',
+ 'uuid',
+ 'odbc32',
+ 'odbccp32',
+])
+
+env.Append(CPPPATH = [
+ os.path.join(env['dxsdk'], 'Include'),
+])
+
+Export('env')
+
+SConscript('d3d8/SConscript')
+SConscript('d3d9/SConscript')
--- /dev/null
+Import('env')
+
+env.SharedLibrary(
+ target = 'd3d8.dll',
+ source = [
+ 'd3d8.def',
+ 'dllmain.cpp',
+ 'idirect3d8.cpp',
+ 'idirect3d_device8.cpp',
+ ]
+)
--- /dev/null
+LIBRARY "d3d8"
+
+EXPORTS
+ Direct3DCreate8 @1
--- /dev/null
+// proxydll.cpp
+#include "stdafx.h"
+
+// global variables
+#pragma data_seg (".d3d8_shared")
+static HINSTANCE gl_hOriginalDll;
+static HINSTANCE gl_hThisInstance;
+#pragma data_seg ()
+
+static void InitInstance(HANDLE hModule) {
+ OutputDebugString(_T("PROXYDLL: InitInstance called.\r\n"));
+
+ // Initialisation
+ gl_hOriginalDll = NULL;
+ gl_hThisInstance = NULL;
+
+ // Storing Instance handle into global var
+ gl_hThisInstance = (HINSTANCE) hModule;
+}
+
+static void LoadOriginalDll(void) {
+ TCHAR buffer[MAX_PATH];
+
+ // Getting path to system dir and to d3d8.dll
+ ::GetSystemDirectory(buffer, MAX_PATH);
+
+ // Append dll name
+ _tcscat(buffer, _T("\\d3d8.dll"));
+
+ // try to load the system's d3d8.dll, if pointer empty
+ if (!gl_hOriginalDll)
+ gl_hOriginalDll = ::LoadLibrary(buffer);
+
+ // Debug
+ if (!gl_hOriginalDll) {
+ OutputDebugString(_T("PROXYDLL: Original d3d8.dll not loaded ERROR ****\r\n"));
+ ::ExitProcess(0); // exit the hard way
+ }
+}
+
+static void ExitInstance() {
+ OutputDebugString(_T("PROXYDLL: ExitInstance called.\r\n"));
+
+ // Release the system's d3d8.dll
+ if (gl_hOriginalDll) {
+ ::FreeLibrary(gl_hOriginalDll);
+ gl_hOriginalDll = NULL;
+ }
+}
+
+BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+{
+ // to avoid compiler lvl4 warnings
+ LPVOID lpDummy = lpReserved;
+ lpDummy = NULL;
+
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH: InitInstance(hModule); break;
+ case DLL_PROCESS_DETACH: ExitInstance(); break;
+
+ case DLL_THREAD_ATTACH: break;
+ case DLL_THREAD_DETACH: break;
+ }
+ return TRUE;
+}
+
+// Exported function (faking d3d8.dll's one-and-only export)
+IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion)
+{
+ if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right d3d8.dll"
+
+ // Hooking IDirect3D Object from Original Library
+ typedef IDirect3D8 *(WINAPI* D3D8_Type)(UINT SDKVersion);
+ D3D8_Type D3DCreate8_fn = (D3D8_Type) GetProcAddress( gl_hOriginalDll, "Direct3DCreate8");
+
+ // Debug
+ if (!D3DCreate8_fn)
+ {
+ OutputDebugString(_T("PROXYDLL: Pointer to original D3DCreate8 function not received ERROR ****\r\n"));
+ ::ExitProcess(0); // exit the hard way
+ }
+
+ // Request pointer from Original Dll.
+ IDirect3D8 *pIDirect3D8_orig = D3DCreate8_fn(SDKVersion);
+
+ // Create my IDirect3D8 object and store pointer to original object there.
+ // note: the object will delete itself once Ref count is zero (similar to COM objects)
+ return new TraceDirect3D8(pIDirect3D8_orig);
+}
--- /dev/null
+// TraceDirect3D8.cpp
+#include "stdafx.h"
+
+TraceDirect3D8::TraceDirect3D8(IDirect3D8 *pOriginal) {
+ m_pIDirect3D8 = pOriginal; // store the pointer to original object
+}
+
+TraceDirect3D8::~TraceDirect3D8() {
+
+}
+
+HRESULT __stdcall TraceDirect3D8::QueryInterface(REFIID riid, void** ppvObj) {
+ *ppvObj = NULL;
+
+ // call this to increase AddRef at original object
+ // and to check if such an interface is there
+
+ HRESULT hRes = m_pIDirect3D8->QueryInterface(riid, ppvObj);
+
+ if (hRes == NOERROR) // if OK, send our "fake" address
+ {
+ *ppvObj = this;
+ }
+
+ return hRes;
+}
+
+ULONG __stdcall TraceDirect3D8::AddRef() {
+ return (m_pIDirect3D8->AddRef());
+}
+
+ULONG __stdcall TraceDirect3D8::Release() {
+ // call original routine
+ ULONG count = m_pIDirect3D8->Release();
+
+ // in case no further Ref is there, the Original Object has deleted itself
+ // so do we here
+ if (count == 0) {
+ delete (this);
+ }
+
+ return (count);
+}
+
+HRESULT __stdcall TraceDirect3D8::RegisterSoftwareDevice(void* pInitializeFunction) {
+ return (m_pIDirect3D8->RegisterSoftwareDevice(pInitializeFunction));
+}
+
+UINT __stdcall TraceDirect3D8::GetAdapterCount() {
+ return (m_pIDirect3D8->GetAdapterCount());
+}
+
+HRESULT __stdcall TraceDirect3D8::GetAdapterIdentifier(UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER8* pIdentifier) {
+ return (m_pIDirect3D8->GetAdapterIdentifier(Adapter, Flags, pIdentifier));
+}
+
+UINT __stdcall TraceDirect3D8::GetAdapterModeCount(UINT Adapter) {
+ return (m_pIDirect3D8->GetAdapterModeCount(Adapter));
+}
+
+HRESULT __stdcall TraceDirect3D8::EnumAdapterModes(UINT Adapter, UINT Mode, D3DDISPLAYMODE* pMode) {
+ return (m_pIDirect3D8->EnumAdapterModes(Adapter, Mode, pMode));
+}
+
+HRESULT __stdcall TraceDirect3D8::GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE* pMode) {
+ return (m_pIDirect3D8->GetAdapterDisplayMode(Adapter, pMode));
+}
+
+HRESULT __stdcall TraceDirect3D8::CheckDeviceType(UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL Windowed) {
+ return (m_pIDirect3D8->CheckDeviceType(Adapter, CheckType, DisplayFormat, BackBufferFormat, Windowed));
+}
+
+HRESULT __stdcall TraceDirect3D8::CheckDeviceFormat(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) {
+ return (m_pIDirect3D8->CheckDeviceFormat(Adapter, DeviceType, AdapterFormat, Usage, RType, CheckFormat));
+}
+
+HRESULT __stdcall TraceDirect3D8::CheckDeviceMultiSampleType(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType) {
+ return (m_pIDirect3D8->CheckDeviceMultiSampleType(Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType));
+}
+
+HRESULT __stdcall TraceDirect3D8::CheckDepthStencilMatch(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) {
+ return (m_pIDirect3D8->CheckDepthStencilMatch(Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat));
+}
+
+HRESULT __stdcall TraceDirect3D8::GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8* pCaps) {
+ return (m_pIDirect3D8->GetDeviceCaps(Adapter, DeviceType, pCaps));
+}
+
+HMONITOR __stdcall TraceDirect3D8::GetAdapterMonitor(UINT Adapter) {
+ return (m_pIDirect3D8->GetAdapterMonitor(Adapter));
+}
+
+HRESULT __stdcall TraceDirect3D8::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice8** ppReturnedDeviceInterface) {
+ // we intercept this call and provide our own "fake" Device Object
+ HRESULT hres = m_pIDirect3D8->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface);
+
+ // Create our own Device object and strore it in global pointer
+ // note: the object will delete itself once Ref count is zero (similar to COM objects)
+ *ppReturnedDeviceInterface = new TraceDirect3DDevice8(*ppReturnedDeviceInterface);
+
+ return (hres);
+}
--- /dev/null
+// TraceDirect3D8.h
+#pragma once
+
+class TraceDirect3D8 : public IDirect3D8
+{
+public:
+
+ TraceDirect3D8(IDirect3D8 *pOriginal);
+ virtual ~TraceDirect3D8();
+
+ // START: The original DX8.1a function definitions
+ HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj);
+ ULONG __stdcall AddRef(void);
+ ULONG __stdcall Release(void);
+ HRESULT __stdcall RegisterSoftwareDevice(void* pInitializeFunction);
+ UINT __stdcall GetAdapterCount(void);
+ HRESULT __stdcall GetAdapterIdentifier(UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER8* pIdentifier);
+ UINT __stdcall GetAdapterModeCount(UINT Adapter);
+ HRESULT __stdcall EnumAdapterModes(UINT Adapter,UINT Mode,D3DDISPLAYMODE* pMode);
+ HRESULT __stdcall GetAdapterDisplayMode( UINT Adapter,D3DDISPLAYMODE* pMode);
+ HRESULT __stdcall CheckDeviceType(UINT Adapter,D3DDEVTYPE CheckType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL Windowed);
+ HRESULT __stdcall CheckDeviceFormat(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat);
+ HRESULT __stdcall CheckDeviceMultiSampleType(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType);
+ HRESULT __stdcall CheckDepthStencilMatch(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat);
+ HRESULT __stdcall GetDeviceCaps(UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS8* pCaps);
+ HMONITOR __stdcall GetAdapterMonitor(UINT Adapter);
+ HRESULT __stdcall CreateDevice(UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice8** ppReturnedDeviceInterface);
+ // END: The original DX8,1a functions definitions
+
+private:
+
+ IDirect3D8 * m_pIDirect3D8;
+};
+
--- /dev/null
+// TraceDirect3DDevice8.cpp
+#include "stdafx.h"
+
+TraceDirect3DDevice8::TraceDirect3DDevice8(IDirect3DDevice8* pOriginal) {
+ m_pIDirect3DDevice8 = pOriginal; // store the pointer to original object
+}
+
+TraceDirect3DDevice8::~TraceDirect3DDevice8() {
+
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::QueryInterface(REFIID riid, void** ppvObj) {
+ // check if original dll can provide an interface. then send *our* address
+ *ppvObj = NULL;
+
+ HRESULT hRes = m_pIDirect3DDevice8->QueryInterface(riid, ppvObj);
+
+ if (hRes == NOERROR) {
+ *ppvObj = this;
+ }
+
+ return hRes;
+}
+
+ULONG __stdcall TraceDirect3DDevice8::AddRef(void) {
+ return (m_pIDirect3DDevice8->AddRef());
+}
+
+ULONG __stdcall TraceDirect3DDevice8::Release(void) {
+ // ATTENTION: This is a booby-trap ! Watch out !
+ // If we create our own sprites, surfaces, etc. (thus increasing the ref counter
+ // by external action), we need to delete that objects before calling the original
+ // Release function
+
+ // release/delete own objects
+ // ... here if any ...
+
+ // Calling original function now
+ ULONG count = m_pIDirect3DDevice8->Release();
+
+ // now, the Original Object has deleted itself, so do we here
+ delete (this); // destructor will be called automatically
+
+ return (count);
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::TestCooperativeLevel(void) {
+ return (m_pIDirect3DDevice8->TestCooperativeLevel());
+}
+
+UINT __stdcall TraceDirect3DDevice8::GetAvailableTextureMem(void) {
+ return (m_pIDirect3DDevice8->GetAvailableTextureMem());
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::ResourceManagerDiscardBytes(DWORD Bytes) {
+ return (m_pIDirect3DDevice8->ResourceManagerDiscardBytes(Bytes));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetDirect3D(IDirect3D8** ppD3D8) {
+ return (m_pIDirect3DDevice8->GetDirect3D(ppD3D8));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetDeviceCaps(D3DCAPS8* pCaps) {
+ return (m_pIDirect3DDevice8->GetDeviceCaps(pCaps));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetDisplayMode(D3DDISPLAYMODE* pMode) {
+ return (m_pIDirect3DDevice8->GetDisplayMode(pMode));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters) {
+ return (m_pIDirect3DDevice8->GetCreationParameters(pParameters));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface8* pCursorBitmap) {
+ return (m_pIDirect3DDevice8->SetCursorProperties(XHotSpot, YHotSpot, pCursorBitmap));
+}
+
+void __stdcall TraceDirect3DDevice8::SetCursorPosition(int XScreenSpace, int YScreenSpace, DWORD Flags) {
+ m_pIDirect3DDevice8->SetCursorPosition(XScreenSpace, YScreenSpace, Flags);
+}
+
+BOOL __stdcall TraceDirect3DDevice8::ShowCursor(BOOL bShow) {
+ return (m_pIDirect3DDevice8->ShowCursor(bShow));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain8** pSwapChain) {
+ return (m_pIDirect3DDevice8->CreateAdditionalSwapChain(pPresentationParameters, pSwapChain));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::Reset(D3DPRESENT_PARAMETERS* pPresentationParameters) {
+ return (m_pIDirect3DDevice8->Reset(pPresentationParameters));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion)
+{
+ // we may want to draw own things here before flipping surfaces
+ // ... draw own stuff ...
+ this->ShowWeAreHere();
+
+ // call original routine
+ HRESULT hres = m_pIDirect3DDevice8->Present( pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
+
+ return (hres);
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetBackBuffer(UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) {
+ return (m_pIDirect3DDevice8->GetBackBuffer(BackBuffer, Type, ppBackBuffer));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetRasterStatus(D3DRASTER_STATUS* pRasterStatus) {
+ return (m_pIDirect3DDevice8->GetRasterStatus(pRasterStatus));
+}
+
+void __stdcall TraceDirect3DDevice8::SetGammaRamp(DWORD Flags,CONST D3DGAMMARAMP* pRamp)
+{ m_pIDirect3DDevice8->SetGammaRamp( Flags, pRamp);}
+
+void __stdcall TraceDirect3DDevice8::GetGammaRamp(D3DGAMMARAMP* pRamp) {
+ m_pIDirect3DDevice8->GetGammaRamp(pRamp);
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CreateTexture(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture8** ppTexture) {
+ return (m_pIDirect3DDevice8->CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CreateVolumeTexture(UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture8** ppVolumeTexture) {
+ return (m_pIDirect3DDevice8->CreateVolumeTexture(Width, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CreateCubeTexture(UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture8** ppCubeTexture) {
+ return (m_pIDirect3DDevice8->CreateCubeTexture(EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer8** ppVertexBuffer) {
+ return (m_pIDirect3DDevice8->CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer8** ppIndexBuffer) {
+ return (m_pIDirect3DDevice8->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CreateRenderTarget(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, BOOL Lockable, IDirect3DSurface8** ppSurface) {
+ return (m_pIDirect3DDevice8->CreateRenderTarget(Width, Height, Format, MultiSample, Lockable, ppSurface));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CreateDepthStencilSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, IDirect3DSurface8** ppSurface) {
+ return (m_pIDirect3DDevice8->CreateDepthStencilSurface(Width, Height, Format, MultiSample, ppSurface));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CreateImageSurface(UINT Width, UINT Height, D3DFORMAT Format, IDirect3DSurface8** ppSurface) {
+ return (m_pIDirect3DDevice8->CreateImageSurface(Width, Height, Format, ppSurface));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CopyRects( IDirect3DSurface8* pSourceSurface,CONST RECT* pSourceRectsArray,UINT cRects,IDirect3DSurface8* pDestinationSurface,CONST POINT* pDestPointsArray)
+{ return (m_pIDirect3DDevice8->CopyRects(pSourceSurface, pSourceRectsArray, cRects, pDestinationSurface, pDestPointsArray) );}
+
+HRESULT __stdcall TraceDirect3DDevice8::UpdateTexture(IDirect3DBaseTexture8* pSourceTexture, IDirect3DBaseTexture8* pDestinationTexture) {
+ return (m_pIDirect3DDevice8->UpdateTexture(pSourceTexture, pDestinationTexture));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetFrontBuffer(IDirect3DSurface8* pDestSurface) {
+ return (m_pIDirect3DDevice8->GetFrontBuffer(pDestSurface));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetRenderTarget(IDirect3DSurface8* pRenderTarget, IDirect3DSurface8* pNewZStencil) {
+ return (m_pIDirect3DDevice8->SetRenderTarget(pRenderTarget, pNewZStencil));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetRenderTarget(IDirect3DSurface8** ppRenderTarget) {
+ return (m_pIDirect3DDevice8->GetRenderTarget(ppRenderTarget));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetDepthStencilSurface(IDirect3DSurface8** ppZStencilSurface) {
+ return (m_pIDirect3DDevice8->GetDepthStencilSurface(ppZStencilSurface));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::BeginScene(void) {
+ return (m_pIDirect3DDevice8->BeginScene());
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::EndScene(void) {
+ return (m_pIDirect3DDevice8->EndScene());
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::Clear( DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil)
+{ return (m_pIDirect3DDevice8->Clear(Count, pRects, Flags, Color, Z, Stencil) );}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetTransform( D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix)
+{ return (m_pIDirect3DDevice8->SetTransform(State, pMatrix) );}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) {
+ return (m_pIDirect3DDevice8->GetTransform(State, pMatrix));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::MultiplyTransform( D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix)
+{ return (m_pIDirect3DDevice8->MultiplyTransform( State,pMatrix) );}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetViewport( CONST D3DVIEWPORT8* pViewport)
+{ return (m_pIDirect3DDevice8->SetViewport( pViewport) );}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetViewport(D3DVIEWPORT8* pViewport) {
+ return (m_pIDirect3DDevice8->GetViewport(pViewport));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetMaterial( CONST D3DMATERIAL8* pMaterial)
+{ return (m_pIDirect3DDevice8->SetMaterial( pMaterial) );}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetMaterial(D3DMATERIAL8* pMaterial) {
+ return (m_pIDirect3DDevice8->GetMaterial(pMaterial));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetLight( DWORD Index,CONST D3DLIGHT8* pLight)
+{ return (m_pIDirect3DDevice8->SetLight(Index, pLight) );}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetLight(DWORD Index, D3DLIGHT8* pLight) {
+ return (m_pIDirect3DDevice8->GetLight(Index, pLight));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::LightEnable(DWORD Index, BOOL Enable) {
+ return (m_pIDirect3DDevice8->LightEnable(Index, Enable));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetLightEnable(DWORD Index, BOOL* pEnable) {
+ return (m_pIDirect3DDevice8->GetLightEnable(Index, pEnable));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetClipPlane(DWORD Index, CONST float* pPlane) {
+ return (m_pIDirect3DDevice8->SetClipPlane(Index, pPlane));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetClipPlane(DWORD Index, float* pPlane) {
+ return (m_pIDirect3DDevice8->GetClipPlane(Index, pPlane));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetRenderState(D3DRENDERSTATETYPE State, DWORD Value) {
+ return (m_pIDirect3DDevice8->SetRenderState(State, Value));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetRenderState(D3DRENDERSTATETYPE State, DWORD* pValue) {
+ return (m_pIDirect3DDevice8->GetRenderState(State, pValue));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::BeginStateBlock(void) {
+ return (m_pIDirect3DDevice8->BeginStateBlock());
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::EndStateBlock(DWORD* pToken) {
+ return (m_pIDirect3DDevice8->EndStateBlock(pToken));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::ApplyStateBlock(DWORD Token) {
+ return (m_pIDirect3DDevice8->ApplyStateBlock(Token));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CaptureStateBlock(DWORD Token) {
+ return (m_pIDirect3DDevice8->CaptureStateBlock(Token));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::DeleteStateBlock(DWORD Token) {
+ return (m_pIDirect3DDevice8->DeleteStateBlock(Token));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CreateStateBlock(D3DSTATEBLOCKTYPE Type, DWORD* pToken) {
+ return (m_pIDirect3DDevice8->CreateStateBlock(Type, pToken));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetClipStatus( CONST D3DCLIPSTATUS8* pClipStatus)
+{ return (m_pIDirect3DDevice8->SetClipStatus( pClipStatus) );}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetClipStatus(D3DCLIPSTATUS8* pClipStatus) {
+ return (m_pIDirect3DDevice8->GetClipStatus(pClipStatus));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetTexture(DWORD Stage, IDirect3DBaseTexture8** ppTexture) {
+ return (m_pIDirect3DDevice8->GetTexture(Stage, ppTexture));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetTexture(DWORD Stage, IDirect3DBaseTexture8* pTexture) {
+ return (m_pIDirect3DDevice8->SetTexture(Stage, pTexture));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue) {
+ return (m_pIDirect3DDevice8->GetTextureStageState(Stage, Type, pValue));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) {
+ return (m_pIDirect3DDevice8->SetTextureStageState(Stage, Type, Value));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::ValidateDevice(DWORD* pNumPasses) {
+ return (m_pIDirect3DDevice8->ValidateDevice(pNumPasses));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetInfo(DWORD DevInfoID, void* pDevInfoStruct, DWORD DevInfoStructSize) {
+ return (m_pIDirect3DDevice8->GetInfo(DevInfoID, pDevInfoStruct, DevInfoStructSize));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetPaletteEntries( UINT PaletteNumber,CONST PALETTEENTRY* pEntries)
+{ return (m_pIDirect3DDevice8->SetPaletteEntries(PaletteNumber, pEntries) );}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY* pEntries) {
+ return (m_pIDirect3DDevice8->GetPaletteEntries(PaletteNumber, pEntries));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetCurrentTexturePalette(UINT PaletteNumber) {
+ return (m_pIDirect3DDevice8->SetCurrentTexturePalette(PaletteNumber));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetCurrentTexturePalette(UINT *PaletteNumber) {
+ return (m_pIDirect3DDevice8->GetCurrentTexturePalette(PaletteNumber));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) {
+ return (m_pIDirect3DDevice8->DrawPrimitive(PrimitiveType, StartVertex, PrimitiveCount));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::DrawIndexedPrimitive(D3DPRIMITIVETYPE Type, UINT minIndex, UINT NumVertices, UINT startIndex, UINT primCount) {
+ return (m_pIDirect3DDevice8->DrawIndexedPrimitive(Type, minIndex, NumVertices, startIndex, primCount));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) {
+ return (m_pIDirect3DDevice8->DrawPrimitiveUP(PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertexIndices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) {
+ return (m_pIDirect3DDevice8->DrawIndexedPrimitiveUP(PrimitiveType, MinVertexIndex, NumVertexIndices, PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::ProcessVertices(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer8* pDestBuffer, DWORD Flags) {
+ return (m_pIDirect3DDevice8->ProcessVertices(SrcStartIndex, DestIndex, VertexCount, pDestBuffer, Flags));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CreateVertexShader( CONST DWORD* pDeclaration,CONST DWORD* pFunction,DWORD* pHandle,DWORD Usage)
+{ return (m_pIDirect3DDevice8->CreateVertexShader( pDeclaration, pFunction, pHandle, Usage));}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetVertexShader(DWORD Handle) {
+ return (m_pIDirect3DDevice8->SetVertexShader(Handle));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetVertexShader(DWORD* pHandle) {
+ return (m_pIDirect3DDevice8->GetVertexShader(pHandle));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::DeleteVertexShader(DWORD Handle) {
+ return (m_pIDirect3DDevice8->DeleteVertexShader(Handle));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetVertexShaderConstant(DWORD Register, CONST void* pConstantData, DWORD ConstantCount) {
+ return (m_pIDirect3DDevice8->SetVertexShaderConstant(Register, pConstantData, ConstantCount));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetVertexShaderConstant(DWORD Register, void* pConstantData, DWORD ConstantCount) {
+ return (m_pIDirect3DDevice8->GetVertexShaderConstant(Register, pConstantData, ConstantCount));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetVertexShaderDeclaration(DWORD Handle, void* pData, DWORD* pSizeOfData) {
+ return (m_pIDirect3DDevice8->GetVertexShaderDeclaration(Handle, pData, pSizeOfData));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetVertexShaderFunction(DWORD Handle, void* pData, DWORD* pSizeOfData) {
+ return (m_pIDirect3DDevice8->GetVertexShaderFunction(Handle, pData, pSizeOfData));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer8* pStreamData, UINT Stride) {
+ return (m_pIDirect3DDevice8->SetStreamSource(StreamNumber, pStreamData, Stride));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer8** ppStreamData, UINT* pStride) {
+ return (m_pIDirect3DDevice8->GetStreamSource(StreamNumber, ppStreamData, pStride));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetIndices(IDirect3DIndexBuffer8* pIndexData, UINT BaseVertexIndex) {
+ return (m_pIDirect3DDevice8->SetIndices(pIndexData, BaseVertexIndex));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetIndices(IDirect3DIndexBuffer8** ppIndexData, UINT* pBaseVertexIndex) {
+ return (m_pIDirect3DDevice8->GetIndices(ppIndexData, pBaseVertexIndex));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::CreatePixelShader( CONST DWORD* pFunction,DWORD* pHandle)
+{ return (m_pIDirect3DDevice8->CreatePixelShader( pFunction, pHandle));}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetPixelShader(DWORD Handle) {
+ return (m_pIDirect3DDevice8->SetPixelShader(Handle));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetPixelShader(DWORD* pHandle) {
+ return (m_pIDirect3DDevice8->GetPixelShader(pHandle));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::DeletePixelShader(DWORD Handle) {
+ return (m_pIDirect3DDevice8->DeletePixelShader(Handle));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::SetPixelShaderConstant(DWORD Register, CONST void* pConstantData, DWORD ConstantCount) {
+ return (m_pIDirect3DDevice8->SetPixelShaderConstant(Register, pConstantData, ConstantCount));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetPixelShaderConstant(DWORD Register, void* pConstantData, DWORD ConstantCount) {
+ return (m_pIDirect3DDevice8->GetPixelShaderConstant(Register, pConstantData, ConstantCount));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::GetPixelShaderFunction(DWORD Handle, void* pData, DWORD* pSizeOfData) {
+ return (m_pIDirect3DDevice8->GetPixelShaderFunction(Handle, pData, pSizeOfData));
+}
+
+HRESULT __stdcall TraceDirect3DDevice8::DrawRectPatch( UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo)
+{ return (m_pIDirect3DDevice8->DrawRectPatch(Handle, pNumSegs, pRectPatchInfo) );}
+
+HRESULT __stdcall TraceDirect3DDevice8::DrawTriPatch( UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo)
+{ return (m_pIDirect3DDevice8->DrawTriPatch(Handle, pNumSegs, pTriPatchInfo) );}
+
+HRESULT __stdcall TraceDirect3DDevice8::DeletePatch(UINT Handle) {
+ return (m_pIDirect3DDevice8->DeletePatch(Handle));
+}
+
+// This is our test function
+void TraceDirect3DDevice8::ShowWeAreHere(void) {
+ D3DRECT rec = { 1, 1, 50, 50 };
+ m_pIDirect3DDevice8->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255,255,255,0), 0, 0);
+}
--- /dev/null
+// TraceDirect3DDevice8.h
+#pragma once
+
+class TraceDirect3DDevice8: public IDirect3DDevice8 {
+public:
+
+ TraceDirect3DDevice8(IDirect3DDevice8* pOriginal);
+ virtual ~TraceDirect3DDevice8();
+
+ // START: The original DX8.1a function definitions
+ HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj);
+ ULONG __stdcall AddRef(void);
+ ULONG __stdcall Release(void);
+ HRESULT __stdcall TestCooperativeLevel(void);
+ UINT __stdcall GetAvailableTextureMem(void);
+ HRESULT __stdcall ResourceManagerDiscardBytes(DWORD Bytes);
+ HRESULT __stdcall GetDirect3D(IDirect3D8** ppD3D8);
+ HRESULT __stdcall GetDeviceCaps(D3DCAPS8* pCaps);
+ HRESULT __stdcall GetDisplayMode(D3DDISPLAYMODE* pMode);
+ HRESULT __stdcall GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters);
+ HRESULT __stdcall SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface8* pCursorBitmap);
+ void __stdcall SetCursorPosition(int XScreenSpace, int YScreenSpace, DWORD Flags);
+ BOOL __stdcall ShowCursor(BOOL bShow);
+ HRESULT __stdcall CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain8** pSwapChain);
+ HRESULT __stdcall Reset(D3DPRESENT_PARAMETERS* pPresentationParameters);
+ HRESULT __stdcall Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion);
+ HRESULT __stdcall GetBackBuffer(UINT BackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer);
+ HRESULT __stdcall GetRasterStatus(D3DRASTER_STATUS* pRasterStatus);
+ void __stdcall SetGammaRamp(DWORD Flags,CONST D3DGAMMARAMP* pRamp);
+ void __stdcall GetGammaRamp(D3DGAMMARAMP* pRamp);
+ HRESULT __stdcall CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture8** ppTexture);
+ HRESULT __stdcall CreateVolumeTexture(UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture8** ppVolumeTexture);
+ HRESULT __stdcall CreateCubeTexture(UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture8** ppCubeTexture);
+ HRESULT __stdcall CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer8** ppVertexBuffer);
+ HRESULT __stdcall CreateIndexBuffer(UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer8** ppIndexBuffer);
+ HRESULT __stdcall CreateRenderTarget(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,BOOL Lockable,IDirect3DSurface8** ppSurface);
+ HRESULT __stdcall CreateDepthStencilSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,IDirect3DSurface8** ppSurface);
+ HRESULT __stdcall CreateImageSurface(UINT Width,UINT Height,D3DFORMAT Format,IDirect3DSurface8** ppSurface);
+ HRESULT __stdcall CopyRects(IDirect3DSurface8* pSourceSurface,CONST RECT* pSourceRectsArray,UINT cRects,IDirect3DSurface8* pDestinationSurface,CONST POINT* pDestPointsArray);
+ HRESULT __stdcall UpdateTexture(IDirect3DBaseTexture8* pSourceTexture,IDirect3DBaseTexture8* pDestinationTexture);
+ HRESULT __stdcall GetFrontBuffer(IDirect3DSurface8* pDestSurface);
+ HRESULT __stdcall SetRenderTarget(IDirect3DSurface8* pRenderTarget,IDirect3DSurface8* pNewZStencil);
+ HRESULT __stdcall GetRenderTarget(IDirect3DSurface8** ppRenderTarget);
+ HRESULT __stdcall GetDepthStencilSurface(IDirect3DSurface8** ppZStencilSurface);
+ HRESULT __stdcall BeginScene(THIS);
+ HRESULT __stdcall EndScene(THIS);
+ HRESULT __stdcall Clear(DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil);
+ HRESULT __stdcall SetTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix);
+ HRESULT __stdcall GetTransform(D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix);
+ HRESULT __stdcall MultiplyTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix);
+ HRESULT __stdcall SetViewport(CONST D3DVIEWPORT8* pViewport);
+ HRESULT __stdcall GetViewport(D3DVIEWPORT8* pViewport);
+ HRESULT __stdcall SetMaterial(CONST D3DMATERIAL8* pMaterial);
+ HRESULT __stdcall GetMaterial(D3DMATERIAL8* pMaterial);
+ HRESULT __stdcall SetLight(DWORD Index,CONST D3DLIGHT8* pLight);
+ HRESULT __stdcall GetLight(DWORD Index,D3DLIGHT8* pLight);
+ HRESULT __stdcall LightEnable(DWORD Index,BOOL Enable);
+ HRESULT __stdcall GetLightEnable(DWORD Index,BOOL* pEnable);
+ HRESULT __stdcall SetClipPlane(DWORD Index,CONST float* pPlane);
+ HRESULT __stdcall GetClipPlane(DWORD Index,float* pPlane);
+ HRESULT __stdcall SetRenderState(D3DRENDERSTATETYPE State,DWORD Value);
+ HRESULT __stdcall GetRenderState(D3DRENDERSTATETYPE State,DWORD* pValue);
+ HRESULT __stdcall BeginStateBlock(THIS);
+ HRESULT __stdcall EndStateBlock(DWORD* pToken);
+ HRESULT __stdcall ApplyStateBlock(DWORD Token);
+ HRESULT __stdcall CaptureStateBlock(DWORD Token);
+ HRESULT __stdcall DeleteStateBlock(DWORD Token);
+ HRESULT __stdcall CreateStateBlock(D3DSTATEBLOCKTYPE Type,DWORD* pToken);
+ HRESULT __stdcall SetClipStatus(CONST D3DCLIPSTATUS8* pClipStatus);
+ HRESULT __stdcall GetClipStatus(D3DCLIPSTATUS8* pClipStatus);
+ HRESULT __stdcall GetTexture(DWORD Stage,IDirect3DBaseTexture8** ppTexture);
+ HRESULT __stdcall SetTexture(DWORD Stage,IDirect3DBaseTexture8* pTexture);
+ HRESULT __stdcall GetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue);
+ HRESULT __stdcall SetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value);
+ HRESULT __stdcall ValidateDevice(DWORD* pNumPasses);
+ HRESULT __stdcall GetInfo(DWORD DevInfoID,void* pDevInfoStruct,DWORD DevInfoStructSize);
+ HRESULT __stdcall SetPaletteEntries(UINT PaletteNumber,CONST PALETTEENTRY* pEntries);
+ HRESULT __stdcall GetPaletteEntries(UINT PaletteNumber,PALETTEENTRY* pEntries);
+ HRESULT __stdcall SetCurrentTexturePalette(UINT PaletteNumber);
+ HRESULT __stdcall GetCurrentTexturePalette(UINT *PaletteNumber);
+ HRESULT __stdcall DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount);
+ HRESULT __stdcall DrawIndexedPrimitive(D3DPRIMITIVETYPE Type,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount);
+ HRESULT __stdcall DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride);
+ HRESULT __stdcall DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride);
+ HRESULT __stdcall ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags);
+ HRESULT __stdcall CreateVertexShader(CONST DWORD* pDeclaration,CONST DWORD* pFunction,DWORD* pHandle,DWORD Usage);
+ HRESULT __stdcall SetVertexShader(DWORD Handle);
+ HRESULT __stdcall GetVertexShader(DWORD* pHandle);
+ HRESULT __stdcall DeleteVertexShader(DWORD Handle);
+ HRESULT __stdcall SetVertexShaderConstant(DWORD Register,CONST void* pConstantData,DWORD ConstantCount);
+ HRESULT __stdcall GetVertexShaderConstant(DWORD Register,void* pConstantData,DWORD ConstantCount);
+ HRESULT __stdcall GetVertexShaderDeclaration(DWORD Handle,void* pData,DWORD* pSizeOfData);
+ HRESULT __stdcall GetVertexShaderFunction(DWORD Handle,void* pData,DWORD* pSizeOfData);
+ HRESULT __stdcall SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer8* pStreamData,UINT Stride);
+ HRESULT __stdcall GetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer8** ppStreamData,UINT* pStride);
+ HRESULT __stdcall SetIndices(IDirect3DIndexBuffer8* pIndexData,UINT BaseVertexIndex);
+ HRESULT __stdcall GetIndices(IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex);
+ HRESULT __stdcall CreatePixelShader(CONST DWORD* pFunction,DWORD* pHandle);
+ HRESULT __stdcall SetPixelShader(DWORD Handle);
+ HRESULT __stdcall GetPixelShader(DWORD* pHandle);
+ HRESULT __stdcall DeletePixelShader(DWORD Handle);
+ HRESULT __stdcall SetPixelShaderConstant(DWORD Register,CONST void* pConstantData,DWORD ConstantCount);
+ HRESULT __stdcall GetPixelShaderConstant(DWORD Register,void* pConstantData,DWORD ConstantCount);
+ HRESULT __stdcall GetPixelShaderFunction(DWORD Handle,void* pData,DWORD* pSizeOfData);
+ HRESULT __stdcall DrawRectPatch(UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo);
+ HRESULT __stdcall DrawTriPatch(UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo);
+ HRESULT __stdcall DeletePatch(UINT Handle);
+ // END: The original DX8.1a function definitions
+
+private:
+
+ IDirect3DDevice8 *m_pIDirect3DDevice8;
+
+ // This is our test function
+ void ShowWeAreHere(void);
+
+};
+
--- /dev/null
+// stdafx.h
+#pragma once
+
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <tchar.h>
+
+#include <d3d8.h>
+
+#include "idirect3d8.hpp"
+#include "idirect3d_device8.hpp"
--- /dev/null
+Import('env')
+
+env.SharedLibrary(
+ target = 'd3d9.dll',
+ source = [
+ 'd3d9.def',
+ 'dllmain.cpp',
+ 'idirect3d9.cpp',
+ 'idirect3d_device9.cpp',
+ 'idirect3d_swapchain9.cpp',
+ ]
+)
--- /dev/null
+LIBRARY "d3d9"
+
+EXPORTS
+ Direct3DCreate9 @1
--- /dev/null
+// proxydll.cpp
+#include "stdafx.h"
+#include "dllmain.hpp"
+
+// global variables
+#pragma data_seg (".d3d9_shared")
+TraceDirect3DSwapChain9* gl_pmyIDirect3DSwapChain9;
+TraceDirect3DDevice9* gl_pmyIDirect3DDevice9;
+TraceDirect3D9* gl_pmyIDirect3D9;
+HINSTANCE gl_hOriginalDll;
+HINSTANCE gl_hThisInstance;
+#pragma data_seg ()
+
+BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+{
+ // to avoid compiler lvl4 warnings
+ LPVOID lpDummy = lpReserved;
+ lpDummy = NULL;
+
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH: InitInstance(hModule); break;
+ case DLL_PROCESS_DETACH: ExitInstance(); break;
+
+ case DLL_THREAD_ATTACH: break;
+ case DLL_THREAD_DETACH: break;
+ }
+ return TRUE;
+}
+
+// Exported function (faking d3d9.dll's one-and-only export)
+IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion)
+{
+ if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right d3d9.dll"
+
+ // Hooking IDirect3D Object from Original Library
+ typedef IDirect3D9 *(WINAPI* D3D9_Type)(UINT SDKVersion);
+ D3D9_Type D3DCreate9_fn = (D3D9_Type) GetProcAddress( gl_hOriginalDll, "Direct3DCreate9");
+
+ // Debug
+ if (!D3DCreate9_fn)
+ {
+ OutputDebugString(_T("PROXYDLL: Pointer to original D3DCreate9 function not received ERROR ****\r\n"));
+ ::ExitProcess(0); // exit the hard way
+ }
+
+ // Request pointer from Original Dll.
+ IDirect3D9 *pIDirect3D9_orig = D3DCreate9_fn(SDKVersion);
+
+ // Create my IDirect3D8 object and store pointer to original object there.
+ // note: the object will delete itself once Ref count is zero (similar to COM objects)
+ gl_pmyIDirect3D9 = new TraceDirect3D9(pIDirect3D9_orig);
+
+ // Return pointer to hooking Object instead of "real one"
+ return (gl_pmyIDirect3D9);
+}
+
+void InitInstance(HANDLE hModule) {
+ OutputDebugString(_T("PROXYDLL: InitInstance called.\r\n"));
+
+ // Initialisation
+ gl_hOriginalDll = NULL;
+ gl_hThisInstance = NULL;
+ gl_pmyIDirect3D9 = NULL;
+ gl_pmyIDirect3DDevice9 = NULL;
+ gl_pmyIDirect3DSwapChain9 = NULL;
+
+ // Storing Instance handle into global var
+ gl_hThisInstance = (HINSTANCE) hModule;
+}
+
+void LoadOriginalDll(void) {
+ TCHAR buffer[MAX_PATH];
+
+ // Getting path to system dir and to d3d8.dll
+ ::GetSystemDirectory(buffer, MAX_PATH);
+
+ // Append dll name
+ _tcscat(buffer, _T("\\d3d9.dll"));
+
+ // try to load the system's d3d9.dll, if pointer empty
+ if (!gl_hOriginalDll)
+ gl_hOriginalDll = ::LoadLibrary(buffer);
+
+ // Debug
+ if (!gl_hOriginalDll) {
+ OutputDebugString(_T("PROXYDLL: Original d3d9.dll not loaded ERROR ****\r\n"));
+ ::ExitProcess(0); // exit the hard way
+ }
+}
+
+void ExitInstance() {
+ OutputDebugString(_T("PROXYDLL: ExitInstance called.\r\n"));
+
+ // Release the system's d3d9.dll
+ if (gl_hOriginalDll) {
+ ::FreeLibrary(gl_hOriginalDll);
+ gl_hOriginalDll = NULL;
+ }
+}
+
--- /dev/null
+// proxydll.h
+#pragma once
+
+// Exported function
+IDirect3D9* WINAPI Direct3DCreate9 (UINT SDKVersion);
+
+// regular functions
+void InitInstance(HANDLE hModule);
+void ExitInstance(void);
+void LoadOriginalDll(void);
\ No newline at end of file
--- /dev/null
+#include "StdAfx.h"
+
+TraceDirect3D9::TraceDirect3D9(IDirect3D9 *pOriginal) {
+ m_pIDirect3D9 = pOriginal;
+}
+
+TraceDirect3D9::~TraceDirect3D9(void) {
+}
+
+HRESULT __stdcall TraceDirect3D9::QueryInterface(REFIID riid, void** ppvObj) {
+ *ppvObj = NULL;
+
+ // call this to increase AddRef at original object
+ // and to check if such an interface is there
+
+ HRESULT hRes = m_pIDirect3D9->QueryInterface(riid, ppvObj);
+
+ if (hRes == NOERROR) // if OK, send our "fake" address
+ {
+ *ppvObj = this;
+ }
+
+ return hRes;
+}
+
+ULONG __stdcall TraceDirect3D9::AddRef(void) {
+ return (m_pIDirect3D9->AddRef());
+}
+
+ULONG __stdcall TraceDirect3D9::Release(void) {
+ extern TraceDirect3D9* gl_pmyIDirect3D9;
+
+ // call original routine
+ ULONG count = m_pIDirect3D9->Release();
+
+ // in case no further Ref is there, the Original Object has deleted itself
+ // so do we here
+ if (count == 0) {
+ gl_pmyIDirect3D9 = NULL;
+ delete (this);
+ }
+
+ return (count);
+}
+
+HRESULT __stdcall TraceDirect3D9::RegisterSoftwareDevice(void* pInitializeFunction) {
+ return (m_pIDirect3D9->RegisterSoftwareDevice(pInitializeFunction));
+}
+
+UINT __stdcall TraceDirect3D9::GetAdapterCount(void) {
+ return (m_pIDirect3D9->GetAdapterCount());
+}
+
+HRESULT __stdcall TraceDirect3D9::GetAdapterIdentifier(UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier) {
+ return (m_pIDirect3D9->GetAdapterIdentifier(Adapter, Flags, pIdentifier));
+}
+
+UINT __stdcall TraceDirect3D9::GetAdapterModeCount(UINT Adapter, D3DFORMAT Format) {
+ return (m_pIDirect3D9->GetAdapterModeCount(Adapter, Format));
+}
+
+HRESULT __stdcall TraceDirect3D9::EnumAdapterModes(UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) {
+ return (m_pIDirect3D9->EnumAdapterModes(Adapter, Format, Mode, pMode));
+}
+
+HRESULT __stdcall TraceDirect3D9::GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE* pMode) {
+ return (m_pIDirect3D9->GetAdapterDisplayMode(Adapter, pMode));
+}
+
+HRESULT __stdcall TraceDirect3D9::CheckDeviceType(UINT iAdapter, D3DDEVTYPE DevType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed) {
+ return (m_pIDirect3D9->CheckDeviceType(iAdapter, DevType, DisplayFormat, BackBufferFormat, bWindowed));
+}
+
+HRESULT __stdcall TraceDirect3D9::CheckDeviceFormat(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) {
+ return (m_pIDirect3D9->CheckDeviceFormat(Adapter, DeviceType, AdapterFormat, Usage, RType, CheckFormat));
+}
+
+HRESULT __stdcall TraceDirect3D9::CheckDeviceMultiSampleType(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) {
+ return (m_pIDirect3D9->CheckDeviceMultiSampleType(Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType, pQualityLevels));
+}
+
+HRESULT __stdcall TraceDirect3D9::CheckDepthStencilMatch(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) {
+ return (m_pIDirect3D9->CheckDepthStencilMatch(Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat));
+}
+
+HRESULT __stdcall TraceDirect3D9::CheckDeviceFormatConversion(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) {
+ return (m_pIDirect3D9->CheckDeviceFormatConversion(Adapter, DeviceType, SourceFormat, TargetFormat));
+}
+
+HRESULT __stdcall TraceDirect3D9::GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) {
+ return (m_pIDirect3D9->GetDeviceCaps(Adapter, DeviceType, pCaps));
+}
+
+HMONITOR __stdcall TraceDirect3D9::GetAdapterMonitor(UINT Adapter) {
+ return (m_pIDirect3D9->GetAdapterMonitor(Adapter));
+}
+
+HRESULT __stdcall TraceDirect3D9::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface) {
+ // global var
+ extern TraceDirect3DDevice9* gl_pmyIDirect3DDevice9;
+
+ // we intercept this call and provide our own "fake" Device Object
+ HRESULT hres = m_pIDirect3D9->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface);
+
+ // Create our own Device object and store it in global pointer
+ // note: the object will delete itself once Ref count is zero (similar to COM objects)
+ gl_pmyIDirect3DDevice9 = new TraceDirect3DDevice9(*ppReturnedDeviceInterface);
+
+ // store our pointer (the fake one) for returning it to the calling progam
+ *ppReturnedDeviceInterface = gl_pmyIDirect3DDevice9;
+
+ return (hres);
+}
+
--- /dev/null
+#pragma once
+
+class TraceDirect3D9 : public IDirect3D9
+{
+public:
+ TraceDirect3D9(IDirect3D9 *pOriginal);
+ virtual ~TraceDirect3D9(void);
+
+ // The original DX9 function definitions
+ HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj);
+ ULONG __stdcall AddRef(void);
+ ULONG __stdcall Release(void);
+ HRESULT __stdcall RegisterSoftwareDevice(void* pInitializeFunction);
+ UINT __stdcall GetAdapterCount(void);
+ HRESULT __stdcall GetAdapterIdentifier(UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) ;
+ UINT __stdcall GetAdapterModeCount(UINT Adapter, D3DFORMAT Format);
+ HRESULT __stdcall EnumAdapterModes(UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) ;
+ HRESULT __stdcall GetAdapterDisplayMode( UINT Adapter,D3DDISPLAYMODE* pMode) ;
+ HRESULT __stdcall CheckDeviceType(UINT iAdapter,D3DDEVTYPE DevType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) ;
+ HRESULT __stdcall CheckDeviceFormat(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) ;
+ HRESULT __stdcall CheckDeviceMultiSampleType(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) ;
+ HRESULT __stdcall CheckDepthStencilMatch(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) ;
+ HRESULT __stdcall CheckDeviceFormatConversion(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat);
+ HRESULT __stdcall GetDeviceCaps(UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) ;
+ HMONITOR __stdcall GetAdapterMonitor(UINT Adapter) ;
+ HRESULT __stdcall CreateDevice(UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) ;
+ // The original DX9 function definitions
+
+private:
+ IDirect3D9 *m_pIDirect3D9;
+};
--- /dev/null
+#include "StdAfx.h"
+
+TraceDirect3DDevice9::TraceDirect3DDevice9(IDirect3DDevice9* pOriginal) {
+ m_pIDirect3DDevice9 = pOriginal; // store the pointer to original object
+}
+
+TraceDirect3DDevice9::~TraceDirect3DDevice9(void) {
+}
+
+HRESULT TraceDirect3DDevice9::QueryInterface(REFIID riid, void** ppvObj) {
+ // check if original dll can provide interface. then send *our* address
+ *ppvObj = NULL;
+
+ HRESULT hRes = m_pIDirect3DDevice9->QueryInterface(riid, ppvObj);
+
+ if (hRes == NOERROR) {
+ *ppvObj = this;
+ }
+
+ return hRes;
+}
+
+ULONG TraceDirect3DDevice9::AddRef(void) {
+ return (m_pIDirect3DDevice9->AddRef());
+}
+
+ULONG TraceDirect3DDevice9::Release(void) {
+ // ATTENTION: This is a booby-trap ! Watch out !
+ // If we create our own sprites, surfaces, etc. (thus increasing the ref counter
+ // by external action), we need to delete that objects before calling the original
+ // Release function
+
+ // global var
+ extern TraceDirect3DDevice9* gl_pmyIDirect3DDevice9;
+
+ // release/delete own objects
+ // .....
+
+ // Calling original function now
+ ULONG count = m_pIDirect3DDevice9->Release();
+
+ if (count == 0) {
+ // now, the Original Object has deleted itself, so do we here
+ gl_pmyIDirect3DDevice9 = NULL;
+ delete (this); // destructor will be called automatically
+ }
+
+ return (count);
+}
+
+HRESULT TraceDirect3DDevice9::TestCooperativeLevel(void) {
+ return (m_pIDirect3DDevice9->TestCooperativeLevel());
+}
+
+UINT TraceDirect3DDevice9::GetAvailableTextureMem(void) {
+ return (m_pIDirect3DDevice9->GetAvailableTextureMem());
+}
+
+HRESULT TraceDirect3DDevice9::EvictManagedResources(void) {
+ return (m_pIDirect3DDevice9->EvictManagedResources());
+}
+
+HRESULT TraceDirect3DDevice9::GetDirect3D(IDirect3D9** ppD3D9) {
+ return (m_pIDirect3DDevice9->GetDirect3D(ppD3D9));
+}
+
+HRESULT TraceDirect3DDevice9::GetDeviceCaps(D3DCAPS9* pCaps) {
+ return (m_pIDirect3DDevice9->GetDeviceCaps(pCaps));
+}
+
+HRESULT TraceDirect3DDevice9::GetDisplayMode(UINT iSwapChain, D3DDISPLAYMODE* pMode) {
+ return (m_pIDirect3DDevice9->GetDisplayMode(iSwapChain, pMode));
+}
+
+HRESULT TraceDirect3DDevice9::GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters) {
+ return (m_pIDirect3DDevice9->GetCreationParameters(pParameters));
+}
+
+HRESULT TraceDirect3DDevice9::SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap) {
+ return (m_pIDirect3DDevice9->SetCursorProperties(XHotSpot, YHotSpot, pCursorBitmap));
+}
+
+void TraceDirect3DDevice9::SetCursorPosition(int X, int Y, DWORD Flags) {
+ return (m_pIDirect3DDevice9->SetCursorPosition(X, Y, Flags));
+}
+
+BOOL TraceDirect3DDevice9::ShowCursor(BOOL bShow) {
+ return (m_pIDirect3DDevice9->ShowCursor(bShow));
+}
+
+HRESULT TraceDirect3DDevice9::CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain) {
+ return (m_pIDirect3DDevice9->CreateAdditionalSwapChain(pPresentationParameters, pSwapChain));
+}
+
+HRESULT TraceDirect3DDevice9::GetSwapChain(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain) {
+ // global var
+ extern TraceDirect3DSwapChain9* gl_pmyIDirect3DSwapChain9;
+
+ // We only cover swapchain 0
+ if (iSwapChain != 0)
+ return (m_pIDirect3DDevice9->GetSwapChain(iSwapChain, pSwapChain));
+
+ if (gl_pmyIDirect3DSwapChain9) {
+ *pSwapChain = gl_pmyIDirect3DSwapChain9;
+ return (D3D_OK);
+ }
+
+ // we intercept this call and provide our own "fake" SwapChain Object
+ IDirect3DSwapChain9* pOriginal = NULL;
+ HRESULT hres = m_pIDirect3DDevice9->GetSwapChain(iSwapChain, &pOriginal);
+
+ // Create our own SwapChain object and store it in global pointer
+ // note: the object will delete itself once Ref count is zero (similar to COM objects)
+ gl_pmyIDirect3DSwapChain9
+ = new TraceDirect3DSwapChain9(pOriginal, m_pIDirect3DDevice9);
+
+ // store our pointer (the fake one) for returning it to the calling progam
+ *pSwapChain = gl_pmyIDirect3DSwapChain9;
+
+ return (hres);
+}
+
+UINT TraceDirect3DDevice9::GetNumberOfSwapChains(void) {
+ return (m_pIDirect3DDevice9->GetNumberOfSwapChains());
+}
+
+HRESULT TraceDirect3DDevice9::Reset(D3DPRESENT_PARAMETERS* pPresentationParameters) {
+ return (m_pIDirect3DDevice9->Reset(pPresentationParameters));
+}
+
+HRESULT TraceDirect3DDevice9::Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion)
+{
+ // we may want to draw own things here before flipping surfaces
+ // ... draw own stuff ...
+ this->ShowWeAreHere();
+
+ // call original routine
+ HRESULT hres = m_pIDirect3DDevice9->Present( pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
+
+ return (hres);
+}
+
+HRESULT TraceDirect3DDevice9::GetBackBuffer(UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) {
+ return (m_pIDirect3DDevice9->GetBackBuffer(iSwapChain, iBackBuffer, Type, ppBackBuffer));
+}
+
+HRESULT TraceDirect3DDevice9::GetRasterStatus(UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) {
+ return (m_pIDirect3DDevice9->GetRasterStatus(iSwapChain, pRasterStatus));
+}
+
+HRESULT TraceDirect3DDevice9::SetDialogBoxMode(BOOL bEnableDialogs) {
+ return (m_pIDirect3DDevice9->SetDialogBoxMode(bEnableDialogs));
+}
+
+void TraceDirect3DDevice9::SetGammaRamp(UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp)
+{
+ return(m_pIDirect3DDevice9->SetGammaRamp(iSwapChain,Flags,pRamp));
+}
+
+void TraceDirect3DDevice9::GetGammaRamp(UINT iSwapChain, D3DGAMMARAMP* pRamp) {
+ return (m_pIDirect3DDevice9->GetGammaRamp(iSwapChain, pRamp));
+}
+
+HRESULT TraceDirect3DDevice9::CreateTexture(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle) {
+ return (m_pIDirect3DDevice9->CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture, pSharedHandle));
+}
+
+HRESULT TraceDirect3DDevice9::CreateVolumeTexture(UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle) {
+ return (m_pIDirect3DDevice9->CreateVolumeTexture(Width, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture, pSharedHandle));
+}
+
+HRESULT TraceDirect3DDevice9::CreateCubeTexture(UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) {
+ return (m_pIDirect3DDevice9->CreateCubeTexture(EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture, pSharedHandle));
+}
+
+HRESULT TraceDirect3DDevice9::CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) {
+ return (m_pIDirect3DDevice9->CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer, pSharedHandle));
+}
+
+HRESULT TraceDirect3DDevice9::CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle) {
+ return (m_pIDirect3DDevice9->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer, pSharedHandle));
+}
+
+HRESULT TraceDirect3DDevice9::CreateRenderTarget(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) {
+ return (m_pIDirect3DDevice9->CreateRenderTarget(Width, Height, Format, MultiSample, MultisampleQuality, Lockable, ppSurface, pSharedHandle));
+}
+
+HRESULT TraceDirect3DDevice9::CreateDepthStencilSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) {
+ return (m_pIDirect3DDevice9->CreateDepthStencilSurface(Width, Height, Format, MultiSample, MultisampleQuality, Discard, ppSurface, pSharedHandle));
+}
+
+HRESULT TraceDirect3DDevice9::UpdateSurface(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint)
+{
+ return(m_pIDirect3DDevice9->UpdateSurface(pSourceSurface,pSourceRect,pDestinationSurface,pDestPoint));
+}
+
+HRESULT TraceDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture) {
+ return (m_pIDirect3DDevice9->UpdateTexture(pSourceTexture, pDestinationTexture));
+}
+
+HRESULT TraceDirect3DDevice9::GetRenderTargetData(IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface) {
+ return (m_pIDirect3DDevice9->GetRenderTargetData(pRenderTarget, pDestSurface));
+}
+
+HRESULT TraceDirect3DDevice9::GetFrontBufferData(UINT iSwapChain, IDirect3DSurface9* pDestSurface) {
+ return (m_pIDirect3DDevice9->GetFrontBufferData(iSwapChain, pDestSurface));
+}
+
+HRESULT TraceDirect3DDevice9::StretchRect(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter)
+{
+ return(m_pIDirect3DDevice9->StretchRect(pSourceSurface,pSourceRect,pDestSurface,pDestRect,Filter));
+}
+
+HRESULT TraceDirect3DDevice9::ColorFill(IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color)
+{
+ return(m_pIDirect3DDevice9->ColorFill(pSurface,pRect,color));
+}
+
+HRESULT TraceDirect3DDevice9::CreateOffscreenPlainSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) {
+ return (m_pIDirect3DDevice9->CreateOffscreenPlainSurface(Width, Height, Format, Pool, ppSurface, pSharedHandle));
+}
+
+HRESULT TraceDirect3DDevice9::SetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) {
+ return (m_pIDirect3DDevice9->SetRenderTarget(RenderTargetIndex, pRenderTarget));
+}
+
+HRESULT TraceDirect3DDevice9::GetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget) {
+ return (m_pIDirect3DDevice9->GetRenderTarget(RenderTargetIndex, ppRenderTarget));
+}
+
+HRESULT TraceDirect3DDevice9::SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil) {
+ return (m_pIDirect3DDevice9->SetDepthStencilSurface(pNewZStencil));
+}
+
+HRESULT TraceDirect3DDevice9::GetDepthStencilSurface(IDirect3DSurface9** ppZStencilSurface) {
+ return (m_pIDirect3DDevice9->GetDepthStencilSurface(ppZStencilSurface));
+}
+
+HRESULT TraceDirect3DDevice9::BeginScene(void) {
+ return (m_pIDirect3DDevice9->BeginScene());
+}
+
+HRESULT TraceDirect3DDevice9::EndScene(void) {
+ return (m_pIDirect3DDevice9->EndScene());
+}
+
+HRESULT TraceDirect3DDevice9::Clear(DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil)
+{
+ return(m_pIDirect3DDevice9->Clear(Count,pRects,Flags,Color,Z,Stencil));
+}
+
+HRESULT TraceDirect3DDevice9::SetTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix)
+{
+ return(m_pIDirect3DDevice9->SetTransform(State,pMatrix));
+}
+
+HRESULT TraceDirect3DDevice9::GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) {
+ return (m_pIDirect3DDevice9->GetTransform(State, pMatrix));
+}
+
+HRESULT TraceDirect3DDevice9::MultiplyTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix)
+{
+ return(m_pIDirect3DDevice9->MultiplyTransform(State,pMatrix));
+}
+
+HRESULT TraceDirect3DDevice9::SetViewport(CONST D3DVIEWPORT9* pViewport)
+{
+ return(m_pIDirect3DDevice9->SetViewport(pViewport));
+}
+
+HRESULT TraceDirect3DDevice9::GetViewport(D3DVIEWPORT9* pViewport) {
+ return (m_pIDirect3DDevice9->GetViewport(pViewport));
+}
+
+HRESULT TraceDirect3DDevice9::SetMaterial(CONST D3DMATERIAL9* pMaterial)
+{
+ return(m_pIDirect3DDevice9->SetMaterial(pMaterial));
+}
+
+HRESULT TraceDirect3DDevice9::GetMaterial(D3DMATERIAL9* pMaterial) {
+ return (m_pIDirect3DDevice9->GetMaterial(pMaterial));
+}
+
+HRESULT TraceDirect3DDevice9::SetLight(DWORD Index,CONST D3DLIGHT9* pLight)
+{
+ return(m_pIDirect3DDevice9->SetLight(Index,pLight));
+}
+
+HRESULT TraceDirect3DDevice9::GetLight(DWORD Index, D3DLIGHT9* pLight) {
+ return (m_pIDirect3DDevice9->GetLight(Index, pLight));
+}
+
+HRESULT TraceDirect3DDevice9::LightEnable(DWORD Index, BOOL Enable) {
+ return (m_pIDirect3DDevice9->LightEnable(Index, Enable));
+}
+
+HRESULT TraceDirect3DDevice9::GetLightEnable(DWORD Index, BOOL* pEnable) {
+ return (m_pIDirect3DDevice9->GetLightEnable(Index, pEnable));
+}
+
+HRESULT TraceDirect3DDevice9::SetClipPlane(DWORD Index, CONST float* pPlane) {
+ return (m_pIDirect3DDevice9->SetClipPlane(Index, pPlane));
+}
+
+HRESULT TraceDirect3DDevice9::GetClipPlane(DWORD Index, float* pPlane) {
+ return (m_pIDirect3DDevice9->GetClipPlane(Index, pPlane));
+}
+
+HRESULT TraceDirect3DDevice9::SetRenderState(D3DRENDERSTATETYPE State, DWORD Value) {
+ return (m_pIDirect3DDevice9->SetRenderState(State, Value));
+}
+
+HRESULT TraceDirect3DDevice9::GetRenderState(D3DRENDERSTATETYPE State, DWORD* pValue) {
+ return (m_pIDirect3DDevice9->GetRenderState(State, pValue));
+}
+
+HRESULT TraceDirect3DDevice9::CreateStateBlock(D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB) {
+ return (m_pIDirect3DDevice9->CreateStateBlock(Type, ppSB));
+}
+
+HRESULT TraceDirect3DDevice9::BeginStateBlock(void) {
+ return (m_pIDirect3DDevice9->BeginStateBlock());
+}
+
+HRESULT TraceDirect3DDevice9::EndStateBlock(IDirect3DStateBlock9** ppSB) {
+ return (m_pIDirect3DDevice9->EndStateBlock(ppSB));
+}
+
+HRESULT TraceDirect3DDevice9::SetClipStatus(CONST D3DCLIPSTATUS9* pClipStatus)
+{
+ return(m_pIDirect3DDevice9->SetClipStatus(pClipStatus));
+}
+
+HRESULT TraceDirect3DDevice9::GetClipStatus(D3DCLIPSTATUS9* pClipStatus) {
+ return (m_pIDirect3DDevice9->GetClipStatus(pClipStatus));
+}
+
+HRESULT TraceDirect3DDevice9::GetTexture(DWORD Stage, IDirect3DBaseTexture9** ppTexture) {
+ return (m_pIDirect3DDevice9->GetTexture(Stage, ppTexture));
+}
+
+HRESULT TraceDirect3DDevice9::SetTexture(DWORD Stage, IDirect3DBaseTexture9* pTexture) {
+ return (m_pIDirect3DDevice9->SetTexture(Stage, pTexture));
+}
+
+HRESULT TraceDirect3DDevice9::GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue) {
+ return (m_pIDirect3DDevice9->GetTextureStageState(Stage, Type, pValue));
+}
+
+HRESULT TraceDirect3DDevice9::SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) {
+ return (m_pIDirect3DDevice9->SetTextureStageState(Stage, Type, Value));
+}
+
+HRESULT TraceDirect3DDevice9::GetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue) {
+ return (m_pIDirect3DDevice9->GetSamplerState(Sampler, Type, pValue));
+}
+
+HRESULT TraceDirect3DDevice9::SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) {
+ return (m_pIDirect3DDevice9->SetSamplerState(Sampler, Type, Value));
+}
+
+HRESULT TraceDirect3DDevice9::ValidateDevice(DWORD* pNumPasses) {
+ return (m_pIDirect3DDevice9->ValidateDevice(pNumPasses));
+}
+
+HRESULT TraceDirect3DDevice9::SetPaletteEntries(UINT PaletteNumber,CONST PALETTEENTRY* pEntries)
+{
+ return(m_pIDirect3DDevice9->SetPaletteEntries(PaletteNumber, pEntries));
+}
+
+HRESULT TraceDirect3DDevice9::GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY* pEntries) {
+ return (m_pIDirect3DDevice9->GetPaletteEntries(PaletteNumber, pEntries));
+}
+
+HRESULT TraceDirect3DDevice9::SetCurrentTexturePalette(UINT PaletteNumber) {
+ return (m_pIDirect3DDevice9->SetCurrentTexturePalette(PaletteNumber));
+}
+
+HRESULT TraceDirect3DDevice9::GetCurrentTexturePalette(UINT *PaletteNumber) {
+ return (m_pIDirect3DDevice9->GetCurrentTexturePalette(PaletteNumber));
+}
+
+HRESULT TraceDirect3DDevice9::SetScissorRect(CONST RECT* pRect)
+{
+ return(m_pIDirect3DDevice9->SetScissorRect( pRect));
+}
+
+HRESULT TraceDirect3DDevice9::GetScissorRect(RECT* pRect) {
+ return (m_pIDirect3DDevice9->GetScissorRect(pRect));
+}
+
+HRESULT TraceDirect3DDevice9::SetSoftwareVertexProcessing(BOOL bSoftware) {
+ return (m_pIDirect3DDevice9->SetSoftwareVertexProcessing(bSoftware));
+}
+
+BOOL TraceDirect3DDevice9::GetSoftwareVertexProcessing(void) {
+ return (m_pIDirect3DDevice9->GetSoftwareVertexProcessing());
+}
+
+HRESULT TraceDirect3DDevice9::SetNPatchMode(float nSegments) {
+ return (m_pIDirect3DDevice9->SetNPatchMode(nSegments));
+}
+
+float TraceDirect3DDevice9::GetNPatchMode(void) {
+ return (m_pIDirect3DDevice9->GetNPatchMode());
+}
+
+HRESULT TraceDirect3DDevice9::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) {
+ return (m_pIDirect3DDevice9->DrawPrimitive(PrimitiveType, StartVertex, PrimitiveCount));
+}
+
+HRESULT TraceDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount) {
+ return (m_pIDirect3DDevice9->DrawIndexedPrimitive(PrimitiveType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount));
+}
+
+HRESULT TraceDirect3DDevice9::DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) {
+ return (m_pIDirect3DDevice9->DrawPrimitiveUP(PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride));
+}
+
+HRESULT TraceDirect3DDevice9::DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) {
+ return (m_pIDirect3DDevice9->DrawIndexedPrimitiveUP(PrimitiveType, MinVertexIndex, NumVertices, PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride));
+}
+
+HRESULT TraceDirect3DDevice9::ProcessVertices(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags) {
+ return (m_pIDirect3DDevice9->ProcessVertices(SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags));
+}
+
+HRESULT TraceDirect3DDevice9::CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl)
+{
+ return(m_pIDirect3DDevice9->CreateVertexDeclaration( pVertexElements,ppDecl));
+}
+
+HRESULT TraceDirect3DDevice9::SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl) {
+ return (m_pIDirect3DDevice9->SetVertexDeclaration(pDecl));
+}
+
+HRESULT TraceDirect3DDevice9::GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl) {
+ return (m_pIDirect3DDevice9->GetVertexDeclaration(ppDecl));
+}
+
+HRESULT TraceDirect3DDevice9::SetFVF(DWORD FVF) {
+ return (m_pIDirect3DDevice9->SetFVF(FVF));
+}
+
+HRESULT TraceDirect3DDevice9::GetFVF(DWORD* pFVF) {
+ return (m_pIDirect3DDevice9->GetFVF(pFVF));
+}
+
+HRESULT TraceDirect3DDevice9::CreateVertexShader(CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader)
+{
+ return(m_pIDirect3DDevice9->CreateVertexShader(pFunction,ppShader));
+}
+
+HRESULT TraceDirect3DDevice9::SetVertexShader(IDirect3DVertexShader9* pShader) {
+ return (m_pIDirect3DDevice9->SetVertexShader(pShader));
+}
+
+HRESULT TraceDirect3DDevice9::GetVertexShader(IDirect3DVertexShader9** ppShader) {
+ return (m_pIDirect3DDevice9->GetVertexShader(ppShader));
+}
+
+HRESULT TraceDirect3DDevice9::SetVertexShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount) {
+ return (m_pIDirect3DDevice9->SetVertexShaderConstantF(StartRegister, pConstantData, Vector4fCount));
+}
+
+HRESULT TraceDirect3DDevice9::GetVertexShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount) {
+ return (m_pIDirect3DDevice9->GetVertexShaderConstantF(StartRegister, pConstantData, Vector4fCount));
+}
+
+HRESULT TraceDirect3DDevice9::SetVertexShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) {
+ return (m_pIDirect3DDevice9->SetVertexShaderConstantI(StartRegister, pConstantData, Vector4iCount));
+}
+
+HRESULT TraceDirect3DDevice9::GetVertexShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount) {
+ return (m_pIDirect3DDevice9->GetVertexShaderConstantI(StartRegister, pConstantData, Vector4iCount));
+}
+
+HRESULT TraceDirect3DDevice9::SetVertexShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount)
+{
+ return(m_pIDirect3DDevice9->SetVertexShaderConstantB(StartRegister,pConstantData,BoolCount));
+}
+
+HRESULT TraceDirect3DDevice9::GetVertexShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount) {
+ return (m_pIDirect3DDevice9->GetVertexShaderConstantB(StartRegister, pConstantData, BoolCount));
+}
+
+HRESULT TraceDirect3DDevice9::SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) {
+ return (m_pIDirect3DDevice9->SetStreamSource(StreamNumber, pStreamData, OffsetInBytes, Stride));
+}
+
+HRESULT TraceDirect3DDevice9::GetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* OffsetInBytes, UINT* pStride) {
+ return (m_pIDirect3DDevice9->GetStreamSource(StreamNumber, ppStreamData, OffsetInBytes, pStride));
+}
+
+HRESULT TraceDirect3DDevice9::SetStreamSourceFreq(UINT StreamNumber, UINT Divider) {
+ return (m_pIDirect3DDevice9->SetStreamSourceFreq(StreamNumber, Divider));
+}
+
+HRESULT TraceDirect3DDevice9::GetStreamSourceFreq(UINT StreamNumber, UINT* Divider) {
+ return (m_pIDirect3DDevice9->GetStreamSourceFreq(StreamNumber, Divider));
+}
+
+HRESULT TraceDirect3DDevice9::SetIndices(IDirect3DIndexBuffer9* pIndexData) {
+ return (m_pIDirect3DDevice9->SetIndices(pIndexData));
+}
+
+HRESULT TraceDirect3DDevice9::GetIndices(IDirect3DIndexBuffer9** ppIndexData) {
+ return (m_pIDirect3DDevice9->GetIndices(ppIndexData));
+}
+
+HRESULT TraceDirect3DDevice9::CreatePixelShader(CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader)
+{
+ return(m_pIDirect3DDevice9->CreatePixelShader(pFunction,ppShader));
+}
+
+HRESULT TraceDirect3DDevice9::SetPixelShader(IDirect3DPixelShader9* pShader) {
+ return (m_pIDirect3DDevice9->SetPixelShader(pShader));
+}
+
+HRESULT TraceDirect3DDevice9::GetPixelShader(IDirect3DPixelShader9** ppShader) {
+ return (m_pIDirect3DDevice9->GetPixelShader(ppShader));
+}
+
+HRESULT TraceDirect3DDevice9::SetPixelShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount) {
+ return (m_pIDirect3DDevice9->SetPixelShaderConstantF(StartRegister, pConstantData, Vector4fCount));
+}
+
+HRESULT TraceDirect3DDevice9::GetPixelShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount) {
+ return (m_pIDirect3DDevice9->GetPixelShaderConstantF(StartRegister, pConstantData, Vector4fCount));
+}
+
+HRESULT TraceDirect3DDevice9::SetPixelShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) {
+ return (m_pIDirect3DDevice9->SetPixelShaderConstantI(StartRegister, pConstantData, Vector4iCount));
+}
+
+HRESULT TraceDirect3DDevice9::GetPixelShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount) {
+ return (m_pIDirect3DDevice9->GetPixelShaderConstantI(StartRegister, pConstantData, Vector4iCount));
+}
+
+HRESULT TraceDirect3DDevice9::SetPixelShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount)
+{
+ return(m_pIDirect3DDevice9->SetPixelShaderConstantB(StartRegister,pConstantData,BoolCount));
+}
+
+HRESULT TraceDirect3DDevice9::GetPixelShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount) {
+ return (m_pIDirect3DDevice9->GetPixelShaderConstantB(StartRegister, pConstantData, BoolCount));
+}
+
+HRESULT TraceDirect3DDevice9::DrawRectPatch(UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo)
+{
+ return(m_pIDirect3DDevice9->DrawRectPatch(Handle,pNumSegs, pRectPatchInfo));
+}
+
+HRESULT TraceDirect3DDevice9::DrawTriPatch(UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo)
+{
+ return(m_pIDirect3DDevice9->DrawTriPatch(Handle, pNumSegs, pTriPatchInfo));
+}
+
+HRESULT TraceDirect3DDevice9::DeletePatch(UINT Handle) {
+ return (m_pIDirect3DDevice9->DeletePatch(Handle));
+}
+
+HRESULT TraceDirect3DDevice9::CreateQuery(D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery) {
+ return (m_pIDirect3DDevice9->CreateQuery(Type, ppQuery));
+}
+
+// This is our test function
+void TraceDirect3DDevice9::ShowWeAreHere(void) {
+ D3DRECT rec = { 1, 1, 50, 50 };
+ m_pIDirect3DDevice9->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255, 255, 255, 0), 0, 0);
+}
+
--- /dev/null
+#pragma once
+
+class TraceDirect3DDevice9: public IDirect3DDevice9 {
+public:
+ TraceDirect3DDevice9(IDirect3DDevice9* pOriginal);
+ virtual ~TraceDirect3DDevice9(void);
+
+ // START: The original DX9 function definitions
+ HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj);
+ ULONG __stdcall AddRef(void);
+ ULONG __stdcall Release(void);
+ HRESULT __stdcall TestCooperativeLevel(void);
+ UINT __stdcall GetAvailableTextureMem(void);
+ HRESULT __stdcall EvictManagedResources(void);
+ HRESULT __stdcall GetDirect3D(IDirect3D9** ppD3D9);
+ HRESULT __stdcall GetDeviceCaps(D3DCAPS9* pCaps);
+ HRESULT __stdcall GetDisplayMode(UINT iSwapChain, D3DDISPLAYMODE* pMode);
+ HRESULT __stdcall GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters);
+ HRESULT __stdcall SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap);
+ void __stdcall SetCursorPosition(int X, int Y, DWORD Flags);
+ BOOL __stdcall ShowCursor(BOOL bShow);
+ HRESULT __stdcall CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain);
+ HRESULT __stdcall GetSwapChain(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain);
+ UINT __stdcall GetNumberOfSwapChains(void);
+ HRESULT __stdcall Reset(D3DPRESENT_PARAMETERS* pPresentationParameters);
+ HRESULT __stdcall Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion);
+ HRESULT __stdcall GetBackBuffer(UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer);
+ HRESULT __stdcall GetRasterStatus(UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus);
+ HRESULT __stdcall SetDialogBoxMode(BOOL bEnableDialogs);
+ void __stdcall SetGammaRamp(UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp);
+ void __stdcall GetGammaRamp(UINT iSwapChain,D3DGAMMARAMP* pRamp);
+ HRESULT __stdcall CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle);
+ HRESULT __stdcall CreateVolumeTexture(UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle);
+ HRESULT __stdcall CreateCubeTexture(UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle);
+ HRESULT __stdcall CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle);
+ HRESULT __stdcall CreateIndexBuffer(UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle);
+ HRESULT __stdcall CreateRenderTarget(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle);
+ HRESULT __stdcall CreateDepthStencilSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle);
+ HRESULT __stdcall UpdateSurface(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint);
+ HRESULT __stdcall UpdateTexture(IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture);
+ HRESULT __stdcall GetRenderTargetData(IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface);
+ HRESULT __stdcall GetFrontBufferData(UINT iSwapChain,IDirect3DSurface9* pDestSurface);
+ HRESULT __stdcall StretchRect(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter);
+ HRESULT __stdcall ColorFill(IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color);
+ HRESULT __stdcall CreateOffscreenPlainSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle);
+ HRESULT __stdcall SetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget);
+ HRESULT __stdcall GetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget);
+ HRESULT __stdcall SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil);
+ HRESULT __stdcall GetDepthStencilSurface(IDirect3DSurface9** ppZStencilSurface);
+ HRESULT __stdcall BeginScene(void);
+ HRESULT __stdcall EndScene(void);
+ HRESULT __stdcall Clear(DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil);
+ HRESULT __stdcall SetTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix);
+ HRESULT __stdcall GetTransform(D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix);
+ HRESULT __stdcall MultiplyTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix);
+ HRESULT __stdcall SetViewport(CONST D3DVIEWPORT9* pViewport);
+ HRESULT __stdcall GetViewport(D3DVIEWPORT9* pViewport);
+ HRESULT __stdcall SetMaterial(CONST D3DMATERIAL9* pMaterial);
+ HRESULT __stdcall GetMaterial(D3DMATERIAL9* pMaterial);
+ HRESULT __stdcall SetLight(DWORD Index,CONST D3DLIGHT9* pLight);
+ HRESULT __stdcall GetLight(DWORD Index,D3DLIGHT9* pLight);
+ HRESULT __stdcall LightEnable(DWORD Index,BOOL Enable);
+ HRESULT __stdcall GetLightEnable(DWORD Index,BOOL* pEnable);
+ HRESULT __stdcall SetClipPlane(DWORD Index,CONST float* pPlane);
+ HRESULT __stdcall GetClipPlane(DWORD Index,float* pPlane);
+ HRESULT __stdcall SetRenderState(D3DRENDERSTATETYPE State,DWORD Value);
+ HRESULT __stdcall GetRenderState(D3DRENDERSTATETYPE State,DWORD* pValue);
+ HRESULT __stdcall CreateStateBlock(D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB);
+ HRESULT __stdcall BeginStateBlock(void);
+ HRESULT __stdcall EndStateBlock(IDirect3DStateBlock9** ppSB);
+ HRESULT __stdcall SetClipStatus(CONST D3DCLIPSTATUS9* pClipStatus);
+ HRESULT __stdcall GetClipStatus(D3DCLIPSTATUS9* pClipStatus);
+ HRESULT __stdcall GetTexture(DWORD Stage,IDirect3DBaseTexture9** ppTexture);
+ HRESULT __stdcall SetTexture(DWORD Stage,IDirect3DBaseTexture9* pTexture);
+ HRESULT __stdcall GetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue);
+ HRESULT __stdcall SetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value);
+ HRESULT __stdcall GetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue);
+ HRESULT __stdcall SetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value);
+ HRESULT __stdcall ValidateDevice(DWORD* pNumPasses);
+ HRESULT __stdcall SetPaletteEntries(UINT PaletteNumber,CONST PALETTEENTRY* pEntries);
+ HRESULT __stdcall GetPaletteEntries(UINT PaletteNumber,PALETTEENTRY* pEntries);
+ HRESULT __stdcall SetCurrentTexturePalette(UINT PaletteNumber);
+ HRESULT __stdcall GetCurrentTexturePalette(UINT *PaletteNumber);
+ HRESULT __stdcall SetScissorRect(CONST RECT* pRect);
+ HRESULT __stdcall GetScissorRect( RECT* pRect);
+ HRESULT __stdcall SetSoftwareVertexProcessing(BOOL bSoftware);
+ BOOL __stdcall GetSoftwareVertexProcessing(void);
+ HRESULT __stdcall SetNPatchMode(float nSegments);
+ float __stdcall GetNPatchMode(void);
+ HRESULT __stdcall DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount);
+ HRESULT __stdcall DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount);
+ HRESULT __stdcall DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride);
+ HRESULT __stdcall DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride);
+ HRESULT __stdcall ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags);
+ HRESULT __stdcall CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl);
+ HRESULT __stdcall SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl);
+ HRESULT __stdcall GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl);
+ HRESULT __stdcall SetFVF(DWORD FVF);
+ HRESULT __stdcall GetFVF(DWORD* pFVF);
+ HRESULT __stdcall CreateVertexShader(CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader);
+ HRESULT __stdcall SetVertexShader(IDirect3DVertexShader9* pShader);
+ HRESULT __stdcall GetVertexShader(IDirect3DVertexShader9** ppShader);
+ HRESULT __stdcall SetVertexShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount);
+ HRESULT __stdcall GetVertexShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount);
+ HRESULT __stdcall SetVertexShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount);
+ HRESULT __stdcall GetVertexShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount);
+ HRESULT __stdcall SetVertexShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount);
+ HRESULT __stdcall GetVertexShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount);
+ HRESULT __stdcall SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride);
+ HRESULT __stdcall GetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* OffsetInBytes,UINT* pStride);
+ HRESULT __stdcall SetStreamSourceFreq(UINT StreamNumber,UINT Divider);
+ HRESULT __stdcall GetStreamSourceFreq(UINT StreamNumber,UINT* Divider);
+ HRESULT __stdcall SetIndices(IDirect3DIndexBuffer9* pIndexData);
+ HRESULT __stdcall GetIndices(IDirect3DIndexBuffer9** ppIndexData);
+ HRESULT __stdcall CreatePixelShader(CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader);
+ HRESULT __stdcall SetPixelShader(IDirect3DPixelShader9* pShader);
+ HRESULT __stdcall GetPixelShader(IDirect3DPixelShader9** ppShader);
+ HRESULT __stdcall SetPixelShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount);
+ HRESULT __stdcall GetPixelShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount);
+ HRESULT __stdcall SetPixelShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount);
+ HRESULT __stdcall GetPixelShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount);
+ HRESULT __stdcall SetPixelShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount);
+ HRESULT __stdcall GetPixelShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount);
+ HRESULT __stdcall DrawRectPatch(UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo);
+ HRESULT __stdcall DrawTriPatch(UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo);
+ HRESULT __stdcall DeletePatch(UINT Handle);
+ HRESULT __stdcall CreateQuery(D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery);
+ // END: The original DX9 function definitions
+
+private:
+ IDirect3DDevice9 *m_pIDirect3DDevice9;
+
+ // This is our test function
+ void ShowWeAreHere(void);
+};
--- /dev/null
+#include "StdAfx.h"
+
+TraceDirect3DSwapChain9::TraceDirect3DSwapChain9(IDirect3DSwapChain9* pOriginal, IDirect3DDevice9* pDevice) {
+ m_pIDirect3DSwapChain9 = pOriginal; // store the pointer to original object
+ m_pIDirect3DDevice9 = pDevice;
+}
+
+TraceDirect3DSwapChain9::~TraceDirect3DSwapChain9(void) {
+ m_pIDirect3DSwapChain9 = NULL;
+}
+
+HRESULT TraceDirect3DSwapChain9::QueryInterface(REFIID riid, void** ppvObj) {
+ // check if original dll can provide interface. then send *our* address
+ *ppvObj = NULL;
+
+ HRESULT hRes = m_pIDirect3DSwapChain9->QueryInterface(riid, ppvObj);
+
+ if (hRes == NOERROR) {
+ *ppvObj = this;
+ }
+
+ return hRes;
+}
+
+ULONG TraceDirect3DSwapChain9::AddRef(void) {
+ return (m_pIDirect3DSwapChain9->AddRef());
+}
+
+ULONG TraceDirect3DSwapChain9::Release(void) {
+ // ATTENTION: This is a booby-trap ! Watch out !
+ // If we create our own sprites, surfaces, etc. (thus increasing the ref counter
+ // by external action), we need to delete that objects before calling the original
+ // Release function
+
+ // global var
+ extern TraceDirect3DSwapChain9* gl_pmyIDirect3DSwapChain9;
+
+ // release/delete own objects
+ // .....
+
+ // Calling original function now
+ ULONG count = m_pIDirect3DSwapChain9->Release();
+
+ if (count == 0) {
+ // now, the Original Object has deleted itself, so do we here
+ gl_pmyIDirect3DSwapChain9 = NULL;
+ delete (this); // destructor will be called automatically
+ }
+
+ return (count);
+}
+
+HRESULT TraceDirect3DSwapChain9::Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags)
+{
+ // Some games use this one for presenting. They ignore the Device's present routine
+
+ // we may want to draw own things here before flipping surfaces
+ // ... draw own stuff ...
+ this->ShowWeAreHere();
+
+ // call original routine
+ HRESULT hres = m_pIDirect3DSwapChain9->Present(pSourceRect,pDestRect,hDestWindowOverride,pDirtyRegion,dwFlags);
+
+ return (hres);
+}
+
+HRESULT TraceDirect3DSwapChain9::GetFrontBufferData(IDirect3DSurface9* pDestSurface) {
+ return (m_pIDirect3DSwapChain9->GetFrontBufferData(pDestSurface));
+}
+
+HRESULT TraceDirect3DSwapChain9::GetBackBuffer(UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) {
+ return (m_pIDirect3DSwapChain9->GetBackBuffer(iBackBuffer, Type, ppBackBuffer));
+}
+
+HRESULT TraceDirect3DSwapChain9::GetRasterStatus(D3DRASTER_STATUS* pRasterStatus) {
+ return (m_pIDirect3DSwapChain9->GetRasterStatus(pRasterStatus));
+}
+
+HRESULT TraceDirect3DSwapChain9::GetDisplayMode(D3DDISPLAYMODE* pMode) {
+ return (m_pIDirect3DSwapChain9->GetDisplayMode(pMode));
+}
+
+HRESULT TraceDirect3DSwapChain9::GetDevice(IDirect3DDevice9** ppDevice) {
+ return (m_pIDirect3DSwapChain9->GetDevice(ppDevice));
+}
+
+HRESULT TraceDirect3DSwapChain9::GetPresentParameters(D3DPRESENT_PARAMETERS* pPresentationParameters) {
+ return (m_pIDirect3DSwapChain9->GetPresentParameters(pPresentationParameters));
+}
+
+// This is our test function
+void TraceDirect3DSwapChain9::ShowWeAreHere(void) {
+ D3DRECT rec = { 100, 1, 150, 50 };
+ m_pIDirect3DDevice9->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255, 255, 255, 0), 0, 0);
+}
+
--- /dev/null
+#pragma once
+
+class TraceDirect3DSwapChain9: public IDirect3DSwapChain9 {
+public:
+ TraceDirect3DSwapChain9(IDirect3DSwapChain9* pOriginal, IDirect3DDevice9* pDevice);
+ virtual ~TraceDirect3DSwapChain9(void);
+
+ // START: The original DX9 function definitions
+ HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj);
+ ULONG __stdcall AddRef(void);
+ ULONG __stdcall Release(void);
+ HRESULT __stdcall Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags);
+ HRESULT __stdcall GetFrontBufferData(IDirect3DSurface9* pDestSurface);
+ HRESULT __stdcall GetBackBuffer(UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer);
+ HRESULT __stdcall GetRasterStatus(D3DRASTER_STATUS* pRasterStatus);
+ HRESULT __stdcall GetDisplayMode(D3DDISPLAYMODE* pMode);
+ HRESULT __stdcall GetDevice(IDirect3DDevice9** ppDevice);
+ HRESULT __stdcall GetPresentParameters(D3DPRESENT_PARAMETERS* pPresentationParameters);
+ // END: The original DX9 function definitions
+
+private:
+ IDirect3DSwapChain9 *m_pIDirect3DSwapChain9;
+ IDirect3DDevice9 *m_pIDirect3DDevice9;
+
+ // This is our test function
+ void ShowWeAreHere(void);
+};
--- /dev/null
+// stdafx.h
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <tchar.h>
+
+#include <d3d9.h>
+
+#include "idirect3d9.hpp"
+#include "idirect3d_device9.hpp"
+#include "idirect3d_swapchain9.hpp"