D3D8 Wrapper: Some code cleanup, better logging

This commit is contained in:
pjgat09 2014-08-10 21:14:29 +00:00
parent a4988cca22
commit 1de36a0e2f
15 changed files with 301 additions and 391 deletions

View File

@ -8,12 +8,14 @@ extern "C"
D3D8Wrapper::IDirect3D8::IDirect3D8(D3D8Base::IDirect3D8* real) : D3D8Wrapper::IDirect3DUnknown((IUnknown*) real)
{
LOG("IDirect3D8::IDirect3D8( " << real << " )\n");
m_pD3D = real;
}
// Tries to find the real object in the pointer set, or creates a new wrapped object
D3D8Wrapper::IDirect3D8* D3D8Wrapper::IDirect3D8::GetDirect3D(D3D8Base::IDirect3D8* pD3D)
{
LOG("IDirect3D8::GetDirect3D( " << pD3D << " )\n");
D3D8Wrapper::IDirect3D8* p = (D3D8Wrapper::IDirect3D8*) m_List.GetDataPtr(pD3D);
if( p == NULL )
{
@ -28,6 +30,7 @@ extern "C"
STDMETHODIMP_(ULONG) D3D8Wrapper::IDirect3D8::Release(THIS)
{
LOG("IDirect3D8::Release( " << this << " )\n");
m_pUnk->Release();
ULONG ulRef = --m_ulRef;
@ -42,113 +45,106 @@ extern "C"
}
/*** IDirect3D8 methods ***/
STDMETHODIMP D3D8Wrapper::IDirect3D8::GetAdapterDisplayMode(THIS_ UINT Adapter,D3D8Base::D3DDISPLAYMODE* pMode)
{
LOG("IDirect3D8::GetAdapterDisplayMode");
LOG("IDirect3D8::GetAdapterDisplayMode( " << Adapter << " , " << pMode << " )\n");
return m_pD3D->GetAdapterDisplayMode(Adapter, pMode);
}
/*** IDirect3D8 methods ***/
STDMETHODIMP D3D8Wrapper::IDirect3D8::RegisterSoftwareDevice(void* pInitializeFunction)
{
LOG("IDirect3D8::RegisterSoftwareDevice");
LOG("IDirect3D8::RegisterSoftwareDevice( " << pInitializeFunction << " )\n");
return m_pD3D->RegisterSoftwareDevice(pInitializeFunction);
}
STDMETHODIMP_(UINT) D3D8Wrapper::IDirect3D8::GetAdapterCount(THIS)
{
LOG("IDirect3D8::GetAdapterCount");
LOG("IDirect3D8::GetAdapterCount()\n");
return m_pD3D->GetAdapterCount();
}
STDMETHODIMP D3D8Wrapper::IDirect3D8::GetAdapterIdentifier(UINT Adapter,DWORD Flags,D3D8Base::D3DADAPTER_IDENTIFIER8* pIdentifier)
{
LOG("IDirect3D8::GetAdapterIdentifier");
LOG("IDirect3D8::GetAdapterIdentifier( " << Adapter << " , " << Flags << " , " << pIdentifier << " )\n");
return m_pD3D->GetAdapterIdentifier(Adapter,Flags,pIdentifier);
}
STDMETHODIMP_(UINT) D3D8Wrapper::IDirect3D8::GetAdapterModeCount(UINT Adapter)
{
LOG("IDirect3D8::GetAdapterModeCount");
LOG("IDirect3D8::GetAdapterModeCount( " << Adapter << " )\n");
return m_pD3D->GetAdapterModeCount(Adapter);
}
STDMETHODIMP D3D8Wrapper::IDirect3D8::EnumAdapterModes(UINT Adapter,UINT Mode,D3D8Base::D3DDISPLAYMODE* pMode)
{
LOG("IDirect3D8::EnumAdapterModes");
LOG("IDirect3D8::EnumAdapterModes( " << Adapter << " , " << Mode << " , " << pMode << " )\n");
return m_pD3D->EnumAdapterModes(Adapter,Mode,pMode);
}
STDMETHODIMP D3D8Wrapper::IDirect3D8::CheckDeviceType(UINT Adapter,D3D8Base::D3DDEVTYPE CheckType,D3D8Base::D3DFORMAT DisplayFormat,D3D8Base::D3DFORMAT BackBufferFormat,BOOL Windowed)
{
LOG("IDirect3D8::CheckDeviceType");
LOG("IDirect3D8::CheckDeviceType( " << Adapter << " , " << CheckType << " , " << DisplayFormat << " , " << BackBufferFormat << " , " << Windowed << " )\n");
return m_pD3D->CheckDeviceType(Adapter,CheckType,DisplayFormat,BackBufferFormat,Windowed);
}
STDMETHODIMP D3D8Wrapper::IDirect3D8::CheckDeviceFormat(UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,D3D8Base::D3DFORMAT AdapterFormat,DWORD Usage,D3D8Base::D3DRESOURCETYPE RType,D3D8Base::D3DFORMAT CheckFormat)
{
LOG("IDirect3D8::CheckDeviceFormat");
LOG("IDirect3D8::CheckDeviceFormat( " << Adapter << " , " << DeviceType << " , " << AdapterFormat << " , " << Usage << " , " << RType << " , " << CheckFormat << " )\n");
return m_pD3D->CheckDeviceFormat(Adapter,DeviceType,AdapterFormat,Usage,RType,CheckFormat);
}
STDMETHODIMP D3D8Wrapper::IDirect3D8::CheckDeviceMultiSampleType(UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,D3D8Base::D3DFORMAT SurfaceFormat,BOOL Windowed,D3D8Base::D3DMULTISAMPLE_TYPE MultiSampleType)
{
LOG("IDirect3D8::CheckDeviceMultiSampleType");
LOG("IDirect3D8::CheckDeviceMultiSampleType( " << Adapter << " , " << DeviceType << " , " << SurfaceFormat << " , " << Windowed << " , " << MultiSampleType << " )\n");
return m_pD3D->CheckDeviceMultiSampleType(Adapter,DeviceType,SurfaceFormat,Windowed,MultiSampleType);
}
STDMETHODIMP D3D8Wrapper::IDirect3D8::CheckDepthStencilMatch(UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,D3D8Base::D3DFORMAT AdapterFormat,D3D8Base::D3DFORMAT RenderTargetFormat,D3D8Base::D3DFORMAT DepthStencilFormat)
{
LOG("IDirect3D8::CheckDepthStencilMatch");
LOG("IDirect3D8::CheckDepthStencilMatch( " << Adapter << " , " << DeviceType << " , " << AdapterFormat << " , " << RenderTargetFormat << " , " << DepthStencilFormat << " )\n");
return m_pD3D->CheckDepthStencilMatch(Adapter,DeviceType,AdapterFormat,RenderTargetFormat,DepthStencilFormat);
}
STDMETHODIMP D3D8Wrapper::IDirect3D8::GetDeviceCaps(UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,D3D8Base::D3DCAPS8* pCaps)
{
LOG("IDirect3D8::GetDeviceCaps");
LOG("IDirect3D8::GetDeviceCaps( " << Adapter << " , " << DeviceType << " , " << pCaps << " )\n");
return m_pD3D->GetDeviceCaps(Adapter,DeviceType,pCaps);
}
STDMETHODIMP_(HMONITOR) D3D8Wrapper::IDirect3D8::GetAdapterMonitor(UINT Adapter)
{
LOG("IDirect3D8::GetAdapterMonitor");
LOG("IDirect3D8::GetAdapterMonitor( " << Adapter << " )\n");
return m_pD3D->GetAdapterMonitor(Adapter);
}
STDMETHODIMP D3D8Wrapper::IDirect3D8::CreateDevice(UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3D8Base::D3DPRESENT_PARAMETERS* pPresentationParameters,D3D8Wrapper::IDirect3DDevice8** ppReturnedDeviceInterface)
{
LOG("IDirect3D8::CreateDevice");
D3D8Base::IDirect3DDevice8* base_device = NULL;
LOG("IDirect3D8::CreateDevice( " << Adapter << " , " << DeviceType << " , " << hFocusWindow << " , " << BehaviorFlags << " , " << pPresentationParameters << " , " << ppReturnedDeviceInterface << " )\n");
D3D8Base::IDirect3DDevice8* realDevice = NULL;
HRESULT hr = m_pD3D->CreateDevice(Adapter,DeviceType,hFocusWindow,BehaviorFlags,pPresentationParameters,&base_device);
HRESULT hr = m_pD3D->CreateDevice(Adapter,DeviceType,hFocusWindow,BehaviorFlags,pPresentationParameters,&realDevice);
if(FAILED(hr))
{
return hr;
}
// Wrap the real object
D3D8Wrapper::IDirect3DDevice8* f = D3D8Wrapper::IDirect3DDevice8::GetDirect3DDevice(base_device);
D3D8Wrapper::IDirect3DDevice8* wrappedDevice = D3D8Wrapper::IDirect3DDevice8::GetDirect3DDevice(realDevice);
last_device = f;
// Store this wrapped pointer for grabbing the screen later
last_device = wrappedDevice;
D3D8Base::IDirect3DSurface8 *f2 = NULL;
// Create a new render target
D3D8Base::IDirect3DSurface8 *realSurface = NULL;
HRESULT hr2 = realDevice->CreateRenderTarget(pPresentationParameters->BackBufferWidth,pPresentationParameters->BackBufferHeight,D3D8Base::D3DFMT_X8R8G8B8,pPresentationParameters->MultiSampleType,FALSE,&realSurface);
// make a new render target
HRESULT hr2 = base_device->CreateRenderTarget(pPresentationParameters->BackBufferWidth,pPresentationParameters->BackBufferHeight,D3D8Base::D3DFMT_X8R8G8B8,pPresentationParameters->MultiSampleType,FALSE,&f2);
render_surface = D3D8Wrapper::IDirect3DSurface8::GetSurface(f2);
// Store a wrapped pointer to it for grabbing the screen
render_surface = D3D8Wrapper::IDirect3DSurface8::GetSurface(realSurface);
// Return our wrapped object
*ppReturnedDeviceInterface = f;
*ppReturnedDeviceInterface = wrappedDevice;
return hr;
}

View File

@ -6,28 +6,28 @@ extern "C"
{
D3D8Wrapper::IDirect3DBaseTexture8::IDirect3DBaseTexture8(D3D8Base::IDirect3DBaseTexture8* pTexture) : IDirect3DResource8((D3D8Base::IDirect3DResource8*) pTexture)
{
LOG("IDirect3DBaseTexture8");
LOG("IDirect3DBaseTexture8::IDirect3DBaseTexture8( " << pTexture << " )\n");
m_pD3D = pTexture;
}
/*STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE;*/
STDMETHODIMP_(DWORD) D3D8Wrapper::IDirect3DBaseTexture8::SetLOD(DWORD LODNew)
{
LOG("IDirect3DBaseTexture8::SetLOD");
LOG("IDirect3DBaseTexture8::SetLOD( " << LODNew << " )\n");
return m_pD3D->SetLOD(LODNew);
}
/*STDMETHOD_(DWORD, GetLOD)(THIS) PURE;*/
STDMETHODIMP_(DWORD) D3D8Wrapper::IDirect3DBaseTexture8::GetLOD()
{
LOG("IDirect3DBaseTexture8::GetLOD");
LOG("IDirect3DBaseTexture8::GetLOD()\n");
return m_pD3D->GetLOD();
}
/*STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE;*/
STDMETHODIMP_(DWORD) D3D8Wrapper::IDirect3DBaseTexture8::GetLevelCount()
{
LOG("IDirect3DBaseTexture8::GetLevelCount");
LOG("IDirect3DBaseTexture8::GetLevelCount()\n");
return m_pD3D->GetLevelCount();
}
}

View File

@ -6,14 +6,14 @@ extern "C"
{
D3D8Wrapper::IDirect3DCubeTexture8::IDirect3DCubeTexture8(D3D8Base::IDirect3DCubeTexture8* pTexture) : IDirect3DBaseTexture8((D3D8Base::IDirect3DBaseTexture8*) pTexture)
{
LOG("IDirect3DCubeTexture8");
LOG("IDirect3DCubeTexture8( " << pTexture << " )\n");
m_pD3D = pTexture;
}
/*STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DCubeTexture8::GetLevelDesc(UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc)
{
LOG("IDirect3DCubeTexture8::GetLevelDesc");
LOG("IDirect3DCubeTexture8::GetLevelDesc( " << pDesc << " )\n");
HRESULT hr = m_pD3D->GetLevelDesc(Level,pDesc);
return hr;
@ -22,7 +22,7 @@ extern "C"
/*STDMETHOD(GetCubeMapSurface)(THIS_ D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level,D3D8Wrapper::IDirect3DSurface8** ppCubeMapSurface) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DCubeTexture8::GetCubeMapSurface(D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level,D3D8Wrapper::IDirect3DSurface8** ppCubeMapSurface)
{
LOG("IDirect3DCubeTexture8::GetCubeMapSurface");
LOG("IDirect3DCubeTexture8::GetCubeMapSurface( " << FaceType << " , " << Level << " , " << ppCubeMapSurface << " )\n");
D3D8Base::IDirect3DSurface8* fd = NULL;
@ -38,7 +38,7 @@ extern "C"
/*STDMETHOD(LockRect)(THIS_ D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level,D3D8Base::D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DCubeTexture8::LockRect(D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level,D3D8Base::D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags)
{
LOG("IDirect3DCubeTexture8::LockRect");
LOG("IDirect3DCubeTexture8::LockRect( " << FaceType << " , " << Level << " , " << pLockedRect << " , " << pRect << " , " << Flags << " )\n");
HRESULT hr = m_pD3D->LockRect(FaceType,Level,pLockedRect,pRect,Flags);
return hr;
@ -47,7 +47,7 @@ extern "C"
/*STDMETHOD(UnlockRect)(THIS_ D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DCubeTexture8::UnlockRect(D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level)
{
LOG("IDirect3DCubeTexture8::UnlockRect");
LOG("IDirect3DCubeTexture8::UnlockRect( " << FaceType << " , " << Level << " )\n");
HRESULT hr = m_pD3D->UnlockRect(FaceType,Level);
return hr;
@ -56,7 +56,7 @@ extern "C"
/*STDMETHOD(AddDirtyRect)(THIS_ D3D8Base::D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DCubeTexture8::AddDirtyRect(D3D8Base::D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect)
{
LOG("IDirect3DCubeTexture8::AddDirtyRect");
LOG("IDirect3DCubeTexture8::AddDirtyRect( " << FaceType << " , " << pDirtyRect << " )\n");
HRESULT hr = m_pD3D->AddDirtyRect(FaceType,pDirtyRect);
return hr;

File diff suppressed because it is too large Load Diff

View File

@ -6,14 +6,14 @@ extern "C"
{
D3D8Wrapper::IDirect3DIndexBuffer8::IDirect3DIndexBuffer8(D3D8Base::IDirect3DIndexBuffer8* pTexture) : IDirect3DResource8((D3D8Base::IDirect3DResource8*) pTexture)
{
LOG("IDirect3DIndexBuffer8");
LOG("IDirect3DIndexBuffer8( " << pTexture << " )\n");
m_pD3D = pTexture;
}
/*STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DIndexBuffer8::Lock(UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags)
{
LOG("IDirect3DIndexBuffer8::Lock");
LOG("IDirect3DIndexBuffer8::Lock( " << OffsetToLock << " , " << SizeToLock << " , " << ppbData << " , " << Flags << " )\n");
HRESULT hr = m_pD3D->Lock(OffsetToLock,SizeToLock,ppbData,Flags);
return hr;
@ -22,7 +22,7 @@ extern "C"
/*STDMETHOD(Unlock)(THIS) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DIndexBuffer8::Unlock()
{
LOG("IDirect3DIndexBuffer8::Unlock");
LOG("IDirect3DIndexBuffer8::Unlock()\n");
HRESULT hr = m_pD3D->Unlock();
return hr;
@ -31,7 +31,7 @@ extern "C"
/*STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DINDEXBUFFER_DESC *pDesc) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DIndexBuffer8::GetDesc(D3D8Base::D3DINDEXBUFFER_DESC *pDesc)
{
LOG("IDirect3DIndexBuffer8::GetDesc");
LOG("IDirect3DIndexBuffer8::GetDesc( " << pDesc << " )\n");
HRESULT hr = m_pD3D->GetDesc(pDesc);
return hr;

View File

@ -8,29 +8,30 @@ extern "C"
D3D8Wrapper::IDirect3DResource8::IDirect3DResource8(D3D8Base::IDirect3DResource8* pResource) : IDirect3DUnknown((IUnknown*) pResource)
{
LOG("IDirect3DResource8 from base " << pResource << " made " << this);
LOG("IDirect3DResource8::IDirect3DResource8( " << pResource << " )\n");
m_pD3D = pResource;
}
D3D8Wrapper::IDirect3DResource8* D3D8Wrapper::IDirect3DResource8::GetResource(D3D8Base::IDirect3DResource8* pSwapChain)
{
LOG("IDirect3DResource8::GetResource( " << pSwapChain << " )\n");
D3D8Wrapper::IDirect3DResource8* p = (D3D8Wrapper::IDirect3DResource8*) m_List.GetDataPtr(pSwapChain);
if( p == NULL )
{
p = new D3D8Wrapper::IDirect3DResource8(pSwapChain);
LOG("IDirect3DResource8::GetResource " << pSwapChain << " created new " << p)
//LOG("IDirect3DResource8::GetResource " << pSwapChain << " created new " << p << "\n")
m_List.AddMember(pSwapChain, p);
return p;
}
p->m_ulRef++;
LOG("IDirect3DResource8::GetResource " << pSwapChain << " found existing " << p)
//LOG("IDirect3DResource8::GetResource " << pSwapChain << " found existing " << p << "\n")
return p;
}
STDMETHODIMP_(ULONG) D3D8Wrapper::IDirect3DResource8::Release(THIS)
{
LOG("IDirect3DResource8::Release " << this);
LOG("IDirect3DResource8::Release( " << this << " )\n");
m_pUnk->Release();
ULONG ulRef = --m_ulRef;
@ -46,7 +47,7 @@ extern "C"
/*STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DResource8::GetDevice(D3D8Wrapper::IDirect3DDevice8** ppDevice)
{
LOG("IDirect3DResource8::GetDevice");
LOG("IDirect3DResource8::GetDevice( " << ppDevice << " )\n");
D3D8Base::IDirect3DDevice8* fd = NULL;
HRESULT hr = m_pD3D->GetDevice(&fd);//ppDevice);
@ -61,7 +62,7 @@ extern "C"
/*STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DResource8::SetPrivateData(REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags)
{
LOG("IDirect3DResource8::SetPrivateData");
LOG("IDirect3DResource8::SetPrivateData( " << &refguid << " , " << pData << " , " << SizeOfData << " , " << Flags << " )\n");
HRESULT hr = m_pD3D->SetPrivateData(refguid,pData,SizeOfData,Flags);
return hr;
@ -70,7 +71,7 @@ extern "C"
/*STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DResource8::GetPrivateData(REFGUID refguid,void* pData,DWORD* pSizeOfData)
{
LOG("IDirect3DResource8::GetPrivateData");
LOG("IDirect3DResource8::GetPrivateData( " << &refguid << " , " << pData << " , " << pSizeOfData << " )\n");
HRESULT hr = m_pD3D->GetPrivateData(refguid,pData,pSizeOfData);
return hr;
@ -79,7 +80,7 @@ extern "C"
/*STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DResource8::FreePrivateData(REFGUID refguid)
{
LOG("IDirect3DResource8::FreePrivateData");
LOG("IDirect3DResource8::FreePrivateData( " << &refguid << " )\n");
HRESULT hr = m_pD3D->FreePrivateData(refguid);
return hr;
@ -88,28 +89,28 @@ extern "C"
/*STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE;*/
STDMETHODIMP_(DWORD) D3D8Wrapper::IDirect3DResource8::SetPriority(DWORD PriorityNew)
{
LOG("IDirect3DResource8::SetPriority");
LOG("IDirect3DResource8::SetPriority( " << PriorityNew << " )\n");
return m_pD3D->SetPriority(PriorityNew);
}
/*STDMETHOD_(DWORD, GetPriority)(THIS) PURE;*/
STDMETHODIMP_(DWORD) D3D8Wrapper::IDirect3DResource8::GetPriority()
{
LOG("IDirect3DResource8::GetPriority");
LOG("IDirect3DResource8::GetPriority()\n");
return m_pD3D->GetPriority();
}
/*STDMETHOD_(void, PreLoad)(THIS) PURE;*/
STDMETHODIMP_(void) D3D8Wrapper::IDirect3DResource8::PreLoad()
{
LOG("IDirect3DResource8::PreLoad");
LOG("IDirect3DResource8::PreLoad()\n");
return m_pD3D->PreLoad();
}
/*STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE;*/
STDMETHODIMP_(D3D8Base::D3DRESOURCETYPE) D3D8Wrapper::IDirect3DResource8::GetType()
{
LOG("IDirect3DResource8::GetType");
LOG("IDirect3DResource8::GetType()\n");
return m_pD3D->GetType();
}
}

View File

@ -6,15 +6,13 @@ extern "C"
{
D3D8Wrapper::IDirect3DSurface8::IDirect3DSurface8(D3D8Base::IDirect3DSurface8* pTexture) : IDirect3DUnknown((IUnknown*) pTexture)
{
LOG("IDirect3DSurface8");
LOG(this);
LOG("IDirect3DSurface8::IDirect3DSurface8( " << pTexture << " )\n");
m_pD3D = pTexture;
}
D3D8Wrapper::IDirect3DSurface8* D3D8Wrapper::IDirect3DSurface8::GetSurface(D3D8Base::IDirect3DSurface8* pSurface)
{
LOG("GetSurface");
LOG(pSurface);
LOG("IDirect3DSurface8::GetSurface( " << pSurface << " )\n");
D3D8Wrapper::IDirect3DSurface8* p = (D3D8Wrapper::IDirect3DSurface8*) m_List.GetDataPtr(pSurface);
if(p == NULL)
{
@ -29,8 +27,7 @@ extern "C"
STDMETHODIMP_(ULONG) D3D8Wrapper::IDirect3DSurface8::Release(THIS)
{
LOG("IDirect3DSurface8::Release");
LOG(this);
LOG("IDirect3DSurface8::Release( " << this << " )\n");
m_pUnk->Release();
ULONG ulRef = --m_ulRef;
@ -46,7 +43,7 @@ extern "C"
/*STDMETHOD(GetDevice)(THIS_ D3D8Wrapper::IDirect3DDevice8** ppDevice) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::GetDevice(D3D8Wrapper::IDirect3DDevice8** ppDevice)
{
LOG("IDirect3DSurface8::GetDevice");
LOG("IDirect3DSurface8::GetDevice( " << ppDevice << " )\n");
D3D8Base::IDirect3DDevice8* fd = NULL;
@ -62,7 +59,7 @@ extern "C"
/*STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::SetPrivateData(REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags)
{
LOG("IDirect3DSurface8::SetPrivateData");
LOG("IDirect3DSurface8::SetPrivateData( " << &refguid << " , " << pData << " , " << SizeOfData << " , " << Flags << " )\n");
HRESULT hr = m_pD3D->SetPrivateData(refguid,pData,SizeOfData,Flags);
return hr;
@ -71,7 +68,7 @@ extern "C"
/*STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::GetPrivateData(REFGUID refguid,void* pData,DWORD* pSizeOfData)
{
LOG("IDirect3DSurface8::GetPrivateData");
LOG("IDirect3DSurface8::GetPrivateData( " << &refguid << " , " << pData << " , " << pSizeOfData << " )\n");
HRESULT hr = m_pD3D->GetPrivateData(refguid,pData,pSizeOfData);
return hr;
@ -80,7 +77,7 @@ extern "C"
/*STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::FreePrivateData(REFGUID refguid)
{
LOG("IDirect3DSurface8::FreePrivateData");
LOG("IDirect3DSurface8::FreePrivateData( " << &refguid << " )\n");
HRESULT hr = m_pD3D->FreePrivateData(refguid);
return hr;
@ -89,7 +86,7 @@ extern "C"
/*STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::GetContainer(REFIID riid,void** ppContainer)
{
LOG("IDirect3DSurface8::GetContainer");
LOG("IDirect3DSurface8::GetContainer( " << &riid << " , " << ppContainer << " )\n");
HRESULT hr = m_pD3D->GetContainer(riid,ppContainer);
return hr;
@ -98,7 +95,7 @@ extern "C"
/*STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DSURFACE_DESC *pDesc) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::GetDesc(D3D8Base::D3DSURFACE_DESC *pDesc)
{
LOG("IDirect3DSurface8::GetDesc");
LOG("IDirect3DSurface8::GetDesc( " << pDesc << " )\n");
HRESULT hr = m_pD3D->GetDesc(pDesc);
return hr;
@ -107,7 +104,14 @@ extern "C"
/*STDMETHOD(LockRect)(THIS_ D3D8Base::D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::LockRect(D3D8Base::D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags)
{
LOG("IDirect3DSurface8::LockRect");
#ifdef LOGGING
LOG("IDirect3DSurface8::LockRect( " << pLockedRect << " , " << pRect);
if (pRect != NULL)
{
LOG("{ " << pRect->left << " , " << pRect->top << " , " << pRect->right << " , " << pRect->bottom << " }");
}
LOG(" , " << Flags << " )\n");
#endif
HRESULT hr = m_pD3D->LockRect(pLockedRect,pRect,Flags);
return hr;
@ -116,7 +120,7 @@ extern "C"
/*STDMETHOD(UnlockRect)(THIS) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::UnlockRect()
{
LOG("IDirect3DSurface8::UnlockRect");
LOG("IDirect3DSurface8::UnlockRect()\n");
HRESULT hr = m_pD3D->UnlockRect();
return hr;

View File

@ -6,12 +6,13 @@ extern "C"
{
D3D8Wrapper::IDirect3DSwapChain8::IDirect3DSwapChain8(D3D8Base::IDirect3DSwapChain8* pSwapChain) : IDirect3DUnknown((IUnknown*) pSwapChain)
{
LOG("IDirect3DSwapChain8");
LOG("IDirect3DSwapChain8::IDirect3DSwapChain8( " << pSwapChain << " )\n");
m_pD3D = pSwapChain;
}
D3D8Wrapper::IDirect3DSwapChain8* D3D8Wrapper::IDirect3DSwapChain8::GetSwapChain(D3D8Base::IDirect3DSwapChain8* pSwapChain)
{
LOG("IDirect3DSwapChain8::GetSwapChain( " << pSwapChain << " )\n");
D3D8Wrapper::IDirect3DSwapChain8* p = (D3D8Wrapper::IDirect3DSwapChain8*) m_List.GetDataPtr(pSwapChain);
if( p == NULL )
{
@ -26,6 +27,7 @@ extern "C"
STDMETHODIMP_(ULONG) D3D8Wrapper::IDirect3DSwapChain8::Release(THIS)
{
LOG("IDirect3DSwapChain8::Release( " << this << " )\n");
m_pUnk->Release();
ULONG ulRef = --m_ulRef;
@ -40,7 +42,7 @@ extern "C"
STDMETHODIMP D3D8Wrapper::IDirect3DSwapChain8::Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion)
{
LOG("IDirect3DSwapChain8::Present");
LOG("IDirect3DSwapChain8::Present( " << pSourceRect << " , " << pDestRect << " , " << hDestWindowOverride << " , " << pDirtyRegion << " )\n");
HRESULT hr = m_pD3D->Present(pSourceRect,pDestRect,hDestWindowOverride,pDirtyRegion);
return hr;
@ -48,7 +50,7 @@ extern "C"
STDMETHODIMP D3D8Wrapper::IDirect3DSwapChain8::GetBackBuffer(UINT BackBuffer,D3D8Base::D3DBACKBUFFER_TYPE Type,D3D8Wrapper::IDirect3DSurface8** ppBackBuffer)
{
LOG("IDirect3DSwapChain8::GetBackBuffer");
LOG("IDirect3DSwapChain8::GetBackBuffer( " << BackBuffer << " , " << Type << " , " << ppBackBuffer << " )\n");
D3D8Base::IDirect3DSurface8* fd = NULL;

View File

@ -6,23 +6,24 @@ extern "C"
{
D3D8Wrapper::IDirect3DTexture8::IDirect3DTexture8(D3D8Base::IDirect3DTexture8* pTexture) : IDirect3DBaseTexture8((D3D8Base::IDirect3DBaseTexture8*) pTexture)
{
LOG("IDirect3DTexture8");
LOG("IDirect3DTexture8::IDirect3DTexture8( " << pTexture << " )\n");
m_pD3D = pTexture;
}
D3D8Wrapper::IDirect3DTexture8* D3D8Wrapper::IDirect3DTexture8::GetTexture(D3D8Base::IDirect3DTexture8* pTexture)
{
LOG("IDirect3DTexture8::GetTexture( " << pTexture << " )\n");
D3D8Wrapper::IDirect3DTexture8* p = (D3D8Wrapper::IDirect3DTexture8*) D3D8Wrapper::IDirect3DResource8::m_List.GetDataPtr(pTexture);
if( p == NULL )
{
p = new D3D8Wrapper::IDirect3DTexture8(pTexture);
LOG("IDirect3DTexture8::GetTexture " << pTexture << " created new " << p)
//LOG("IDirect3DTexture8::GetTexture " << pTexture << " created new " << p << "\n")
D3D8Wrapper::IDirect3DResource8::m_List.AddMember(pTexture, p);
return p;
}
p->m_ulRef++;
LOG("IDirect3DTexture8::GetTexture " << pTexture << " found existing " << p)
//LOG("IDirect3DTexture8::GetTexture " << pTexture << " found existing " << p << "\n")
return p;
}
@ -30,7 +31,7 @@ extern "C"
/*STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::GetLevelDesc(UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc)
{
LOG("IDirect3DTexture8::GetLevelDesc");
LOG("IDirect3DTexture8::GetLevelDesc( " << Level << " , " << pDesc << " )\n");
HRESULT hr = m_pD3D->GetLevelDesc(Level,pDesc);
return hr;
@ -39,7 +40,7 @@ extern "C"
/*STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,D3D8Wrapper::IDirect3DSurface8** ppSurfaceLevel) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::GetSurfaceLevel(UINT Level,D3D8Wrapper::IDirect3DSurface8** ppSurfaceLevel)
{
LOG("IDirect3DTexture8::GetSurfaceLevel");
LOG("IDirect3DTexture8::GetSurfaceLevel( " << Level << " , " << ppSurfaceLevel << " )\n");
D3D8Base::IDirect3DSurface8* fd = NULL;
@ -49,17 +50,13 @@ extern "C"
*ppSurfaceLevel = f;
LOG(f);
LOG(f->GetSurface());
LOG(hr);
return hr;
}
/*STDMETHOD(LockRect)(THIS_ UINT Level,D3D8Base::D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::LockRect(UINT Level,D3D8Base::D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags)
{
LOG("IDirect3DTexture8::LockRect");
LOG("IDirect3DTexture8::LockRect( " << Level << " , " << pLockedRect << " , " << pRect << " , " << Flags << " )\n");
HRESULT hr = m_pD3D->LockRect(Level,pLockedRect,pRect,Flags);
return hr;
@ -68,7 +65,7 @@ extern "C"
/*STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::UnlockRect(UINT Level)
{
LOG("IDirect3DTexture8::UnlockRect");
LOG("IDirect3DTexture8::UnlockRect()\n");
HRESULT hr = m_pD3D->UnlockRect(Level);
return hr;
@ -77,7 +74,7 @@ extern "C"
/*STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::AddDirtyRect(CONST RECT* pDirtyRect)
{
LOG("IDirect3DTexture8::AddDirtyRect");
LOG("IDirect3DTexture8::AddDirtyRect( " << pDirtyRect << " )\n");
HRESULT hr = m_pD3D->AddDirtyRect(pDirtyRect);
return hr;

View File

@ -6,14 +6,14 @@ extern "C"
{
D3D8Wrapper::IDirect3DVertexBuffer8::IDirect3DVertexBuffer8(D3D8Base::IDirect3DVertexBuffer8* pTexture) : IDirect3DResource8((D3D8Base::IDirect3DResource8*) pTexture)
{
LOG("IDirect3DVertexBuffer8");
LOG("IDirect3DVertexBuffer8::IDirect3DVertexBuffer8( " << pTexture << " )\n");
m_pD3D = pTexture;
}
/*STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVertexBuffer8::Lock(UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags)
{
LOG("IDirect3DVertexBuffer8::Lock");
LOG("IDirect3DVertexBuffer8::Lock( " << OffsetToLock << " , " << SizeToLock << " , " << ppbData << " , " << Flags << " )\n");
HRESULT hr = m_pD3D->Lock(OffsetToLock,SizeToLock,ppbData,Flags);
return hr;
@ -22,7 +22,7 @@ extern "C"
/*STDMETHOD(Unlock)(THIS) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVertexBuffer8::Unlock()
{
LOG("IDirect3DVertexBuffer8::Unlock");
LOG("IDirect3DVertexBuffer8::Unlock()\n");
HRESULT hr = m_pD3D->Unlock();
return hr;
@ -31,7 +31,7 @@ extern "C"
/*STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DVERTEXBUFFER_DESC *pDesc) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVertexBuffer8::GetDesc(D3D8Base::D3DVERTEXBUFFER_DESC *pDesc)
{
LOG("IDirect3DVertexBuffer8::GetDesc");
LOG("IDirect3DVertexBuffer8::GetDesc( " << pDesc << " )\n");
HRESULT hr = m_pD3D->GetDesc(pDesc);
return hr;

View File

@ -6,14 +6,14 @@ extern "C"
{
D3D8Wrapper::IDirect3DVolume8::IDirect3DVolume8(D3D8Base::IDirect3DVolume8* pTexture) : IDirect3DUnknown((IUnknown*) pTexture)
{
LOG("IDirect3DVolume8");
LOG("IDirect3DVolume8::IDirect3DVolume8( " << pTexture << " )\n");
m_pD3D = pTexture;
}
/*STDMETHOD(GetDevice)(THIS_ D3D8Wrapper::IDirect3DDevice8** ppDevice) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::GetDevice(D3D8Wrapper::IDirect3DDevice8** ppDevice)
{
LOG("IDirect3DVolume8::GetDevice");
LOG("IDirect3DVolume8::GetDevice( " << ppDevice << " )\n");
D3D8Base::IDirect3DDevice8* fd = NULL;
@ -29,7 +29,7 @@ extern "C"
/*STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::SetPrivateData(REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags)
{
LOG("IDirect3DVolume8::SetPrivateData");
LOG("IDirect3DVolume8::SetPrivateData( " << &refguid << " , " << pData << " , " << SizeOfData << " , " << Flags << " )\n");
HRESULT hr = m_pD3D->SetPrivateData(refguid,pData,SizeOfData,Flags);
return hr;
@ -38,7 +38,7 @@ extern "C"
/*STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::GetPrivateData(REFGUID refguid,void* pData,DWORD* pSizeOfData)
{
LOG("IDirect3DVolume8::GetPrivateData");
LOG("IDirect3DVolume8::GetPrivateData( " << &refguid << " , " << pData << " , " << pSizeOfData << " )\n");
HRESULT hr = m_pD3D->GetPrivateData(refguid,pData,pSizeOfData);
return hr;
@ -47,7 +47,7 @@ extern "C"
/*STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::FreePrivateData(REFGUID refguid)
{
LOG("IDirect3DVolume8::FreePrivateData");
LOG("IDirect3DVolume8::FreePrivateData( " << &refguid << " )\n");
HRESULT hr = m_pD3D->FreePrivateData(refguid);
return hr;
@ -56,7 +56,7 @@ extern "C"
/*STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::GetContainer(REFIID riid,void** ppContainer)
{
LOG("IDirect3DVolume8::GetContainer");
LOG("IDirect3DVolume8::GetContainer( " << &riid << " , " << ppContainer << " )\n");
HRESULT hr = m_pD3D->GetContainer(riid,ppContainer);
return hr;
@ -65,7 +65,7 @@ extern "C"
/*STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DVOLUME_DESC *pDesc) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::GetDesc(D3D8Base::D3DVOLUME_DESC *pDesc)
{
LOG("IDirect3DVolume8::GetDesc");
LOG("IDirect3DVolume8::GetDesc( " << pDesc << " )\n");
HRESULT hr = m_pD3D->GetDesc(pDesc);
return hr;
@ -74,7 +74,7 @@ extern "C"
/*STDMETHOD(LockBox)(THIS_ D3D8Base::D3DLOCKED_BOX * pLockedVolume,CONST D3D8Base::D3DBOX* pBox,DWORD Flags) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::LockBox(D3D8Base::D3DLOCKED_BOX * pLockedVolume,CONST D3D8Base::D3DBOX* pBox,DWORD Flags)
{
LOG("IDirect3DVolume8::LockBox");
LOG("IDirect3DVolume8::LockBox( " << pLockedVolume << " , " << pBox << " , " << Flags << " )\n");
HRESULT hr = m_pD3D->LockBox(pLockedVolume,pBox,Flags);
return hr;
@ -83,7 +83,7 @@ extern "C"
/*STDMETHOD(UnlockBox)(THIS) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::UnlockBox()
{
LOG("IDirect3DVolume8::UnlockBox");
LOG("IDirect3DVolume8::UnlockBox()\n");
HRESULT hr = m_pD3D->UnlockBox();
return hr;

View File

@ -6,14 +6,14 @@ extern "C"
{
D3D8Wrapper::IDirect3DVolumeTexture8::IDirect3DVolumeTexture8(D3D8Base::IDirect3DVolumeTexture8* pTexture) : IDirect3DBaseTexture8((D3D8Base::IDirect3DBaseTexture8*) pTexture)
{
LOG("IDirect3DVolumeTexture8");
LOG("IDirect3DVolumeTexture8( " << pTexture << " )\n");
m_pD3D = pTexture;
}
/*STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3D8Base::D3DVOLUME_DESC *pDesc) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolumeTexture8::GetLevelDesc(UINT Level,D3D8Base::D3DVOLUME_DESC *pDesc)
{
LOG("IDirect3DVolumeTexture8::GetLevelDesc");
LOG("IDirect3DVolumeTexture8::GetLevelDesc( " << Level << " , " << pDesc << " )\n");
HRESULT hr = m_pD3D->GetLevelDesc(Level,pDesc);
return hr;
@ -22,7 +22,7 @@ extern "C"
/*STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,IDirect3DVolume8** ppVolumeLevel) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolumeTexture8::GetVolumeLevel(UINT Level,D3D8Wrapper::IDirect3DVolume8** ppVolumeLevel)
{
LOG("IDirect3DVolumeTexture8::GetVolumeLevel");
LOG("IDirect3DVolumeTexture8::GetVolumeLevel( " << Level << " , " << ppVolumeLevel << " )\n");
D3D8Base::IDirect3DVolume8* fd = NULL;
@ -38,7 +38,7 @@ extern "C"
/*STDMETHOD(LockBox)(THIS_ UINT Level,D3D8Base::D3DLOCKED_BOX* pLockedVolume,CONST D3D8Base::D3DBOX* pBox,DWORD Flags) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolumeTexture8::LockBox(UINT Level,D3D8Base::D3DLOCKED_BOX* pLockedVolume,CONST D3D8Base::D3DBOX* pBox,DWORD Flags)
{
LOG("IDirect3DVolumeTexture8::LockBox");
LOG("IDirect3DVolumeTexture8::LockBox( " << Level << " , " << pLockedVolume << " , " << pBox << " , " << Flags << " )\n");
HRESULT hr = m_pD3D->LockBox(Level,pLockedVolume,pBox,Flags);
return hr;
@ -47,7 +47,7 @@ extern "C"
/*STDMETHOD(UnlockBox)(THIS_ UINT Level) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolumeTexture8::UnlockBox(UINT Level)
{
LOG("IDirect3DVolumeTexture8::UnlockBox");
LOG("IDirect3DVolumeTexture8::UnlockBox( " << Level << " )\n");
HRESULT hr = m_pD3D->UnlockBox(Level);
return hr;
@ -56,7 +56,7 @@ extern "C"
/*STDMETHOD(AddDirtyBox)(THIS_ CONST D3D8Base::D3DBOX* pDirtyBox) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVolumeTexture8::AddDirtyBox(CONST D3D8Base::D3DBOX* pDirtyBox)
{
LOG("IDirect3DVolumeTexture8::AddDirtyBox");
LOG("IDirect3DVolumeTexture8::AddDirtyBox( " << pDirtyBox << " )\n");
HRESULT hr = m_pD3D->AddDirtyBox(pDirtyBox);
return hr;

View File

@ -2,7 +2,7 @@
D3D8Base::LPDIRECT3D8 g_D3D=NULL;
HMODULE hD3D;
HMODULE realDLL;
ThreadSafePointerSet D3D8Wrapper::IDirect3DDevice8::m_List;
ThreadSafePointerSet D3D8Wrapper::IDirect3DBaseTexture8::m_List;
@ -24,30 +24,30 @@ extern "C"
D3D8Wrapper::IDirect3D8* WINAPI Direct3DCreate8(UINT Version)
{
// Get the real DLL path
// Get the real DLL path from the system directory
// Might be unsafe
CHAR dll_path[1024];
GetSystemDirectory(dll_path,1024);
strcat(dll_path,"\\d3d8.dll");
hD3D = LoadLibrary(dll_path);
realDLL = LoadLibrary(dll_path);
D3D8Wrapper::D3DCREATE pCreate = (D3D8Wrapper::D3DCREATE)GetProcAddress(hD3D, "Direct3DCreate8");
D3D8Wrapper::D3DCREATE realDirect3DCreate8 = (D3D8Wrapper::D3DCREATE)GetProcAddress(realDLL, "Direct3DCreate8");
// Use the real Direct3DCreate8 to make the base object
D3D8Base::IDirect3D8* pD3D = pCreate(D3D_SDK_VERSION);
D3D8Base::IDirect3D8* realD3D = realDirect3DCreate8(D3D_SDK_VERSION);
// Wrap the object
D3D8Wrapper::IDirect3D8* fD3D = D3D8Wrapper::IDirect3D8::GetDirect3D(pD3D);
D3D8Wrapper::IDirect3D8* wrappedD3D = D3D8Wrapper::IDirect3D8::GetDirect3D(realD3D);
return fD3D;
return wrappedD3D;
}
}
__declspec(dllexport) void __cdecl CloseDLL()
{
FreeLibrary(hD3D);
FreeLibrary(realDLL);
}
__declspec(dllexport) void __cdecl SetRenderingCallback(void (*callback)(int))

View File

@ -6,8 +6,13 @@
#pragma comment(linker, "/EXPORT:Direct3DCreate8=_Direct3DCreate8@4")
//#define LOG(x) { std::ofstream myfile; myfile.open ("d3d8_wrapper_log.txt", std::ios::app); myfile << x << "\n"; myfile.close(); }
//#define LOGGING 1
#ifdef LOGGING
#define LOG(x) { std::ofstream myfile; myfile.open ("d3d8_wrapper_log.txt", std::ios::app); myfile << x; myfile.close(); }
#else
#define LOG(x)
#endif
#define TESTDLL_API __declspec(dllexport)
@ -111,9 +116,6 @@ extern "C"
protected:
D3D8Base::IDirect3DDevice8* m_pDevice;
static ThreadSafePointerSet m_List;
D3D8Wrapper::IDirect3DSurface8 * rTarget;
D3D8Wrapper::IDirect3DSurface8 * zStencil;
public:
STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj)
{

Binary file not shown.