From 23ae71382e548b20c8171fbb67b93088fffe9d47 Mon Sep 17 00:00:00 2001 From: pjgat09 Date: Sun, 17 Aug 2014 18:53:49 +0000 Subject: [PATCH] N64: More D3D8 wrapper cleanup --- .../Direct3DBaseTexture8Functions.cpp | 9 +- .../Direct3DCubeTexture8Functions.cpp | 35 +- .../Direct3DDevice8Functions.cpp | 390 +++++------------- .../Direct3DIndexBuffer8Functions.cpp | 21 +- .../Direct3DResource8Functions.cpp | 54 +-- .../Direct3DSurface8Functions.cpp | 70 ++-- .../Direct3DSwapChain8Functions.cpp | 38 +- .../Direct3DTexture8Functions.cpp | 56 +-- .../Direct3DVertexBuffer8Functions.cpp | 21 +- .../Direct3DVolume8Functions.cpp | 50 +-- .../Direct3DVolumeTexture8Functions.cpp | 35 +- .../D3D8Interceptor/d3d8Wrapper.cpp | 12 +- libmupen64plus/D3D8Interceptor/d3d8Wrapper.h | 75 ---- output/dll/d3d8.dll | Bin 20480 -> 19968 bytes 14 files changed, 232 insertions(+), 634 deletions(-) diff --git a/libmupen64plus/D3D8Interceptor/Direct3DBaseTexture8Functions.cpp b/libmupen64plus/D3D8Interceptor/Direct3DBaseTexture8Functions.cpp index ffd1176e41..c075f782c6 100644 --- a/libmupen64plus/D3D8Interceptor/Direct3DBaseTexture8Functions.cpp +++ b/libmupen64plus/D3D8Interceptor/Direct3DBaseTexture8Functions.cpp @@ -4,27 +4,24 @@ extern "C" { namespace D3D8Wrapper { - D3D8Wrapper::IDirect3DBaseTexture8::IDirect3DBaseTexture8(D3D8Base::IDirect3DBaseTexture8* pTexture) : IDirect3DResource8((D3D8Base::IDirect3DResource8*) pTexture) + D3D8Wrapper::IDirect3DBaseTexture8::IDirect3DBaseTexture8(D3D8Base::IDirect3DBaseTexture8* realBaseTexture) : IDirect3DResource8((D3D8Base::IDirect3DResource8*) realBaseTexture) { - LOG("IDirect3DBaseTexture8::IDirect3DBaseTexture8( " << pTexture << " )\n"); - m_pD3D = pTexture; + LOG("IDirect3DBaseTexture8::IDirect3DBaseTexture8( " << realBaseTexture << " )\n"); + m_pD3D = realBaseTexture; } - /*STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE;*/ STDMETHODIMP_(DWORD) D3D8Wrapper::IDirect3DBaseTexture8::SetLOD(DWORD LODNew) { LOG("IDirect3DBaseTexture8::SetLOD( " << LODNew << " )\n"); return m_pD3D->SetLOD(LODNew); } - /*STDMETHOD_(DWORD, GetLOD)(THIS) PURE;*/ STDMETHODIMP_(DWORD) D3D8Wrapper::IDirect3DBaseTexture8::GetLOD() { LOG("IDirect3DBaseTexture8::GetLOD()\n"); return m_pD3D->GetLOD(); } - /*STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE;*/ STDMETHODIMP_(DWORD) D3D8Wrapper::IDirect3DBaseTexture8::GetLevelCount() { LOG("IDirect3DBaseTexture8::GetLevelCount()\n"); diff --git a/libmupen64plus/D3D8Interceptor/Direct3DCubeTexture8Functions.cpp b/libmupen64plus/D3D8Interceptor/Direct3DCubeTexture8Functions.cpp index 3280d5ebfd..90bf5b163b 100644 --- a/libmupen64plus/D3D8Interceptor/Direct3DCubeTexture8Functions.cpp +++ b/libmupen64plus/D3D8Interceptor/Direct3DCubeTexture8Functions.cpp @@ -4,62 +4,49 @@ extern "C" { namespace D3D8Wrapper { - D3D8Wrapper::IDirect3DCubeTexture8::IDirect3DCubeTexture8(D3D8Base::IDirect3DCubeTexture8* pTexture) : IDirect3DBaseTexture8((D3D8Base::IDirect3DBaseTexture8*) pTexture) + D3D8Wrapper::IDirect3DCubeTexture8::IDirect3DCubeTexture8(D3D8Base::IDirect3DCubeTexture8* realCubeTexture) : IDirect3DBaseTexture8((D3D8Base::IDirect3DBaseTexture8*) realCubeTexture) { - LOG("IDirect3DCubeTexture8( " << pTexture << " )\n"); - m_pD3D = pTexture; + LOG("IDirect3DCubeTexture8( " << realCubeTexture << " )\n"); + m_pD3D = realCubeTexture; } - /*STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DCubeTexture8::GetLevelDesc(UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc) { LOG("IDirect3DCubeTexture8::GetLevelDesc( " << pDesc << " )\n"); - HRESULT hr = m_pD3D->GetLevelDesc(Level,pDesc); - - return hr; + return m_pD3D->GetLevelDesc(Level,pDesc); } - /*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( " << FaceType << " , " << Level << " , " << ppCubeMapSurface << " )\n"); - D3D8Base::IDirect3DSurface8* fd = NULL; + D3D8Base::IDirect3DSurface8* realD3D = NULL; - HRESULT hr = m_pD3D->GetCubeMapSurface(FaceType,Level,&fd);//ppCubeMapSurface); + HRESULT hr = m_pD3D->GetCubeMapSurface(FaceType,Level,&realD3D); - D3D8Wrapper::IDirect3DSurface8* f = D3D8Wrapper::IDirect3DSurface8::GetSurface(fd); + D3D8Wrapper::IDirect3DSurface8* wrappedD3D = D3D8Wrapper::IDirect3DSurface8::GetSurface(realD3D); - *ppCubeMapSurface = f; + *ppCubeMapSurface = wrappedD3D; return hr; } - /*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( " << FaceType << " , " << Level << " , " << pLockedRect << " , " << pRect << " , " << Flags << " )\n"); - HRESULT hr = m_pD3D->LockRect(FaceType,Level,pLockedRect,pRect,Flags); - - return hr; + return m_pD3D->LockRect(FaceType,Level,pLockedRect,pRect,Flags); } - /*STDMETHOD(UnlockRect)(THIS_ D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DCubeTexture8::UnlockRect(D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level) { LOG("IDirect3DCubeTexture8::UnlockRect( " << FaceType << " , " << Level << " )\n"); - HRESULT hr = m_pD3D->UnlockRect(FaceType,Level); - - return hr; + return m_pD3D->UnlockRect(FaceType,Level); } - /*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( " << FaceType << " , " << pDirtyRect << " )\n"); - HRESULT hr = m_pD3D->AddDirtyRect(FaceType,pDirtyRect); - - return hr; + return m_pD3D->AddDirtyRect(FaceType,pDirtyRect); } } } \ No newline at end of file diff --git a/libmupen64plus/D3D8Interceptor/Direct3DDevice8Functions.cpp b/libmupen64plus/D3D8Interceptor/Direct3DDevice8Functions.cpp index 6ec0c08dc4..72a962cde6 100644 --- a/libmupen64plus/D3D8Interceptor/Direct3DDevice8Functions.cpp +++ b/libmupen64plus/D3D8Interceptor/Direct3DDevice8Functions.cpp @@ -4,25 +4,27 @@ extern "C" { namespace D3D8Wrapper { - D3D8Wrapper::IDirect3DDevice8::IDirect3DDevice8(D3D8Base::IDirect3DDevice8* pDevice) : IDirect3DUnknown((IUnknown*) pDevice) + ThreadSafePointerSet IDirect3DDevice8::m_List; + + D3D8Wrapper::IDirect3DDevice8::IDirect3DDevice8(D3D8Base::IDirect3DDevice8* realDevice) : IDirect3DUnknown((IUnknown*) realDevice) { - LOG("IDirect3DDevice8::IDirect3DDevice8( " << pDevice << " )\n"); - m_pDevice = pDevice; + LOG("IDirect3DDevice8::IDirect3DDevice8( " << realDevice << " )\n"); + m_pDevice = realDevice; } - D3D8Wrapper::IDirect3DDevice8* D3D8Wrapper::IDirect3DDevice8::GetDirect3DDevice(D3D8Base::IDirect3DDevice8* pDevice) + D3D8Wrapper::IDirect3DDevice8* D3D8Wrapper::IDirect3DDevice8::GetDirect3DDevice(D3D8Base::IDirect3DDevice8* realDevice) { - LOG("IDirect3DDevice8::GetDirect3DDevice( " << pDevice << " )\n"); - D3D8Wrapper::IDirect3DDevice8* p = (D3D8Wrapper::IDirect3DDevice8*) m_List.GetDataPtr(pDevice); - if(p == NULL) + LOG("IDirect3DDevice8::GetDirect3DDevice( " << realDevice << " )\n"); + D3D8Wrapper::IDirect3DDevice8* wrappedDevice = (D3D8Wrapper::IDirect3DDevice8*) m_List.GetDataPtr(realDevice); + if(wrappedDevice == NULL) { - p = new D3D8Wrapper::IDirect3DDevice8(pDevice); - m_List.AddMember(pDevice, p); - return p; + wrappedDevice = new D3D8Wrapper::IDirect3DDevice8(realDevice); + m_List.AddMember(realDevice, wrappedDevice); + return wrappedDevice; } - p->m_ulRef++; - return p; + wrappedDevice->m_ulRef++; + return wrappedDevice; } STDMETHODIMP_(ULONG) D3D8Wrapper::IDirect3DDevice8::Release(THIS) @@ -318,34 +320,24 @@ extern "C" if (pSourceSurface->m_ulRef == 0 || (pSourceSurface->GetSurface()) == (pDestinationSurface->GetSurface())) { - LOG("WTF\n"); return D3DERR_INVALIDCALL; } - HRESULT hr = m_pDevice->CopyRects(pSourceSurface->GetSurface(),pSourceRectsArray,cRects,pDestinationSurface->GetSurface(),pDestPointsArray); - - return hr; + return m_pDevice->CopyRects(pSourceSurface->GetSurface(),pSourceRectsArray,cRects,pDestinationSurface->GetSurface(),pDestPointsArray); } - /*STDMETHOD(UpdateTexture)(THIS_ D3D8Base::IDirect3DBaseTexture8* pSourceTexture,D3D8Base::IDirect3DBaseTexture8* pDestinationTexture) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::UpdateTexture(D3D8Wrapper::IDirect3DBaseTexture8* pSourceTexture,D3D8Wrapper::IDirect3DBaseTexture8* pDestinationTexture) { LOG("IDirect3DDevice8::UpdateTexture( " << pSourceTexture << " , " << pDestinationTexture << " )\n"); - HRESULT hr = m_pDevice->UpdateTexture(pSourceTexture->GetBaseTexture(),pDestinationTexture->GetBaseTexture()); - - return hr; + return m_pDevice->UpdateTexture(pSourceTexture->GetBaseTexture(),pDestinationTexture->GetBaseTexture()); } - /*STDMETHOD(GetFrontBuffer)(THIS_ D3D8Base::IDirect3DSurface8* pDestSurface) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetFrontBuffer(D3D8Wrapper::IDirect3DSurface8* pDestSurface) { LOG("IDirect3DDevice8::GetFrontBuffer( " << pDestSurface << " )\n"); - HRESULT hr = m_pDevice->GetFrontBuffer(pDestSurface->GetSurface()); - - return hr; + return m_pDevice->GetFrontBuffer(pDestSurface->GetSurface()); } - /*STDMETHOD(SetRenderTarget)(THIS_ D3D8Base::IDirect3DSurface8* pRenderTarget,D3D8Base::IDirect3DSurface8* pNewZStencil) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetRenderTarget(D3D8Wrapper::IDirect3DSurface8* pRenderTarget,D3D8Wrapper::IDirect3DSurface8* pNewZStencil) { LOG("IDirect3DDevice8::SetRenderTarget( " << pRenderTarget << " , " << pNewZStencil << " )\n"); @@ -359,57 +351,48 @@ extern "C" return hr; } - /*STDMETHOD(GetRenderTarget)(THIS_ D3D8Base::IDirect3DSurface8** ppRenderTarget) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetRenderTarget(D3D8Wrapper::IDirect3DSurface8** ppRenderTarget) { LOG("IDirect3DDevice8::GetRenderTarget( " << ppRenderTarget << " )\n"); - D3D8Base::IDirect3DSurface8* fd = NULL; + D3D8Base::IDirect3DSurface8* realD3D = NULL; - HRESULT hr = m_pDevice->GetRenderTarget(&fd);//ppRenderTarget); + HRESULT hr = m_pDevice->GetRenderTarget(&realD3D); - D3D8Wrapper::IDirect3DSurface8* f = D3D8Wrapper::IDirect3DSurface8::GetSurface(fd); + D3D8Wrapper::IDirect3DSurface8* wrappedD3D = D3D8Wrapper::IDirect3DSurface8::GetSurface(realD3D); - *ppRenderTarget = f; + *ppRenderTarget = wrappedD3D; return hr; } - /*STDMETHOD(GetDepthStencilSurface)(THIS_ D3D8Base::IDirect3DSurface8** ppZStencilSurface) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetDepthStencilSurface(D3D8Wrapper::IDirect3DSurface8** ppZStencilSurface) { LOG("IDirect3DDevice8::GetDepthStencilSurface( " << ppZStencilSurface << " )\n"); - D3D8Base::IDirect3DSurface8* fd = NULL; + D3D8Base::IDirect3DSurface8* realD3D = NULL; - HRESULT hr = m_pDevice->GetDepthStencilSurface(&fd);//ppZStencilSurface); + HRESULT hr = m_pDevice->GetDepthStencilSurface(&realD3D); - D3D8Wrapper::IDirect3DSurface8* f = D3D8Wrapper::IDirect3DSurface8::GetSurface(fd); + D3D8Wrapper::IDirect3DSurface8* wrappedD3D = D3D8Wrapper::IDirect3DSurface8::GetSurface(realD3D); - *ppZStencilSurface = f; + *ppZStencilSurface = wrappedD3D; return hr; } - /*STDMETHOD(BeginScene)(THIS) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::BeginScene() { LOG("IDirect3DDevice8::BeginScene()\n"); - HRESULT hr = m_pDevice->BeginScene(); - - return hr; + return m_pDevice->BeginScene(); } - /*STDMETHOD(EndScene)(THIS) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::EndScene() { LOG("IDirect3DDevice8::EndScene()\n"); - HRESULT hr = m_pDevice->EndScene(); - - return hr; + return m_pDevice->EndScene(); } - /*STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3D8Base::D3DRECT* pRects,DWORD Flags,D3D8Base::D3DCOLOR Color,float Z,DWORD Stencil) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::Clear(DWORD Count,CONST D3D8Base::D3DRECT* pRects,DWORD Flags,D3D8Base::D3DCOLOR Color,float Z,DWORD Stencil) { #ifdef LOGGING @@ -421,48 +404,33 @@ extern "C" LOG(" , " << Flags << " , " << Color << " , " << Z << " , " << Stencil << " )\n"); #endif - HRESULT hr = m_pDevice->Clear(Count,pRects,Flags,Color,Z,Stencil); - - return hr; + return m_pDevice->Clear(Count,pRects,Flags,Color,Z,Stencil); } - /*STDMETHOD(SetTransform)(THIS_ D3D8Base::D3DTRANSFORMSTATETYPE State,CONST D3D8Base::D3DMATRIX* pMatrix) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetTransform(D3D8Base::D3DTRANSFORMSTATETYPE State,CONST D3D8Base::D3DMATRIX* pMatrix) { LOG("IDirect3DDevice8::SetTransform( " << State << " , " << pMatrix << " )\n"); - HRESULT hr = m_pDevice->SetTransform(State,pMatrix); - - return hr; + return m_pDevice->SetTransform(State,pMatrix); } - /*STDMETHOD(GetTransform)(THIS_ D3D8Base::D3DTRANSFORMSTATETYPE State,D3D8Base::D3DMATRIX* pMatrix) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetTransform(D3D8Base::D3DTRANSFORMSTATETYPE State,D3D8Base::D3DMATRIX* pMatrix) { LOG("IDirect3DDevice8::GetTransform( " << State << " , " << pMatrix << " )\n"); - HRESULT hr = m_pDevice->GetTransform(State,pMatrix); - - return hr; + return m_pDevice->GetTransform(State,pMatrix); } - /*STDMETHOD(MultiplyTransform)(THIS_ D3D8Base::D3DTRANSFORMSTATETYPE,CONST D3D8Base::D3DMATRIX*) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::MultiplyTransform(D3D8Base::D3DTRANSFORMSTATETYPE foo,CONST D3D8Base::D3DMATRIX* bar) { LOG("IDirect3DDevice8::MultiplyTransform( " << foo << " , " << bar << " )\n"); - HRESULT hr = m_pDevice->MultiplyTransform(foo, bar); - - return hr; + return m_pDevice->MultiplyTransform(foo, bar); } - /*STDMETHOD(SetViewport)(THIS_ CONST D3D8Base::D3DVIEWPORT8* pViewport) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetViewport(CONST D3D8Base::D3DVIEWPORT8* pViewport) { LOG("IDirect3DDevice8::SetViewport( " << pViewport << " )\n"); - - HRESULT hr = m_pDevice->SetViewport(pViewport); - return hr; + return m_pDevice->SetViewport(pViewport); } - /*STDMETHOD(GetViewport)(THIS_ D3D8Base::D3DVIEWPORT8* pViewport) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetViewport(D3D8Base::D3DVIEWPORT8* pViewport) { #ifdef LOGGING @@ -473,191 +441,132 @@ extern "C" } LOG(" )\n"); #endif - HRESULT hr = m_pDevice->GetViewport(pViewport); - - return hr; + return m_pDevice->GetViewport(pViewport); } - /*STDMETHOD(SetMaterial)(THIS_ CONST D3D8Base::D3DMATERIAL8* pMaterial) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetMaterial(CONST D3D8Base::D3DMATERIAL8* pMaterial) { LOG("IDirect3DDevice8::SetMaterial( " << pMaterial << " )\n"); - HRESULT hr = m_pDevice->SetMaterial(pMaterial); - - return hr; + return m_pDevice->SetMaterial(pMaterial); } - /*STDMETHOD(GetMaterial)(THIS_ D3D8Base::D3DMATERIAL8* pMaterial) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetMaterial(D3D8Base::D3DMATERIAL8* pMaterial) { LOG("IDirect3DDevice8::GetMaterial( " << pMaterial << " )\n"); - HRESULT hr = m_pDevice->GetMaterial(pMaterial); - - return hr; + return m_pDevice->GetMaterial(pMaterial); } - /*STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3D8Base::D3DLIGHT8*) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetLight(DWORD Index,CONST D3D8Base::D3DLIGHT8* foo) { LOG("IDirect3DDevice8::SetLight( " << Index << " , " << foo << " )\n"); - HRESULT hr = m_pDevice->SetLight(Index,foo); - - return hr; + return m_pDevice->SetLight(Index,foo); } - /*STDMETHOD(GetLight)(THIS_ DWORD Index,D3D8Base::D3DLIGHT8*) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetLight(DWORD Index,D3D8Base::D3DLIGHT8* foo) { LOG("IDirect3DDevice8::GetLight( " << Index << " , " << foo << " )\n"); - HRESULT hr = m_pDevice->GetLight(Index,foo); - - return hr; + return m_pDevice->GetLight(Index,foo); } - /*STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::LightEnable(DWORD Index,BOOL Enable) { LOG("IDirect3DDevice8::LightEnable( " << Index << " , " << Enable << " )\n"); - HRESULT hr = m_pDevice->LightEnable(Index,Enable); - - return hr; + return m_pDevice->LightEnable(Index,Enable); } - /*STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetLightEnable(DWORD Index,BOOL* pEnable) { LOG("IDirect3DDevice8::GetLightEnable( " << Index << " , " << pEnable << " )\n"); - HRESULT hr = m_pDevice->GetLightEnable(Index,pEnable); - - return hr; + return m_pDevice->GetLightEnable(Index,pEnable); } - /*STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetClipPlane(DWORD Index,CONST float* pPlane) { LOG("IDirect3DDevice8::SetClipPlane( " << Index << " , " << pPlane << " )\n"); - HRESULT hr = m_pDevice->SetClipPlane(Index,pPlane); - - return hr; + return m_pDevice->SetClipPlane(Index,pPlane); } - /*STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetClipPlane(DWORD Index,float* pPlane) { LOG("IDirect3DDevice8::GetClipPlane( " << Index << " , " << pPlane << " )\n"); - HRESULT hr = m_pDevice->GetClipPlane(Index,pPlane); - - return hr; + return m_pDevice->GetClipPlane(Index,pPlane); } - /*STDMETHOD(SetRenderState)(THIS_ D3D8Base::D3DRENDERSTATETYPE State,DWORD Value) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetRenderState(D3D8Base::D3DRENDERSTATETYPE State,DWORD Value) { LOG("IDirect3DDevice8::SetRenderState( " << State << " , " << Value << " )\n"); - - HRESULT hr = m_pDevice->SetRenderState(State,Value); - - return hr; + return m_pDevice->SetRenderState(State,Value); } - /*STDMETHOD(GetRenderState)(THIS_ D3D8Base::D3DRENDERSTATETYPE State,DWORD* pValue) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetRenderState(D3D8Base::D3DRENDERSTATETYPE State,DWORD* pValue) { LOG("IDirect3DDevice8::GetRenderState( " << State << " , " << pValue << " )\n"); - HRESULT hr = m_pDevice->GetRenderState(State,pValue); - - return hr; + return m_pDevice->GetRenderState(State,pValue); } - /*STDMETHOD(BeginStateBlock)(THIS) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::BeginStateBlock() { LOG("IDirect3DDevice8::BeginStateBlock()\n"); - HRESULT hr = m_pDevice->BeginStateBlock(); - - return hr; + return m_pDevice->BeginStateBlock(); } - /*STDMETHOD(EndStateBlock)(THIS_ DWORD* pToken) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::EndStateBlock(DWORD* pToken) { LOG("IDirect3DDevice8::EndStateBlock( " << pToken << " )\n"); - HRESULT hr = m_pDevice->EndStateBlock(pToken); - - return hr; + return m_pDevice->EndStateBlock(pToken); } - /*STDMETHOD(ApplyStateBlock)(THIS_ DWORD Token) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::ApplyStateBlock(DWORD Token) { LOG("IDirect3DDevice8::ApplyStateBlock( " << Token << " )\n"); - HRESULT hr = m_pDevice->ApplyStateBlock(Token); - - return hr; + return m_pDevice->ApplyStateBlock(Token); } - /*STDMETHOD(CaptureStateBlock)(THIS_ DWORD Token) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::CaptureStateBlock(DWORD Token) { LOG("IDirect3DDevice8::CaptureStateBlock( " << Token << " )\n"); - HRESULT hr = m_pDevice->CaptureStateBlock(Token); - - return hr; + return m_pDevice->CaptureStateBlock(Token); } - /*STDMETHOD(DeleteStateBlock)(THIS_ DWORD Token) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::DeleteStateBlock(DWORD Token) { LOG("IDirect3DDevice8::DeleteStateBlock( " << Token << " )\n"); - HRESULT hr = m_pDevice->DeleteStateBlock(Token); - - return hr; + return m_pDevice->DeleteStateBlock(Token); } - /*STDMETHOD(CreateStateBlock)(THIS_ D3D8Base::D3DSTATEBLOCKTYPE Type,DWORD* pToken) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::CreateStateBlock(D3D8Base::D3DSTATEBLOCKTYPE Type,DWORD* pToken) { LOG("IDirect3DDevice8::CreateStateBlock( " << Type << " , " << pToken << " )\n"); - HRESULT hr = m_pDevice->CreateStateBlock(Type,pToken); - - return hr; + return m_pDevice->CreateStateBlock(Type,pToken); } - /*STDMETHOD(SetClipStatus)(THIS_ CONST D3D8Base::D3DCLIPSTATUS8* pClipStatus) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetClipStatus(CONST D3D8Base::D3DCLIPSTATUS8* pClipStatus) { LOG("IDirect3DDevice8::SetClipStatus( " << pClipStatus << " )\n"); - HRESULT hr = m_pDevice->SetClipStatus(pClipStatus); - - return hr; + return m_pDevice->SetClipStatus(pClipStatus); } - /*STDMETHOD(GetClipStatus)(THIS_ D3D8Base::D3DCLIPSTATUS8* pClipStatus) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetClipStatus(D3D8Base::D3DCLIPSTATUS8* pClipStatus) { LOG("IDirect3DDevice8::GetClipStatus( " << pClipStatus << " )\n"); - HRESULT hr = m_pDevice->GetClipStatus(pClipStatus); - - return hr; + return m_pDevice->GetClipStatus(pClipStatus); } - /*STDMETHOD(GetTexture)(THIS_ DWORD Stage,D3D8Base::IDirect3DBaseTexture8** ppTexture) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetTexture(DWORD Stage,D3D8Wrapper::IDirect3DBaseTexture8** ppTexture) { LOG("IDirect3DDevice8::GetTexture( " << Stage << " , " << ppTexture << " )\n"); - D3D8Base::IDirect3DBaseTexture8* fd = NULL; + D3D8Base::IDirect3DBaseTexture8* realD3D = NULL; - HRESULT hr = m_pDevice->GetTexture(Stage,&fd);//ppTexture); + HRESULT hr = m_pDevice->GetTexture(Stage,&realD3D);//ppTexture); - D3D8Wrapper::IDirect3DBaseTexture8* f = new D3D8Wrapper::IDirect3DBaseTexture8(fd); + D3D8Wrapper::IDirect3DBaseTexture8* wrappedD3D = new D3D8Wrapper::IDirect3DBaseTexture8(realD3D); - *ppTexture = f; + *ppTexture = wrappedD3D; return hr; } - /*STDMETHOD(SetTexture)(THIS_ DWORD Stage,D3D8Base::IDirect3DBaseTexture8* pTexture) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetTexture(DWORD Stage,D3D8Wrapper::IDirect3DBaseTexture8* pTexture) { LOG("IDirect3DDevice8::SetTexture( " << Stage << " , " << pTexture << " )\n"); @@ -668,341 +577,236 @@ extern "C" } else { - //LOG(pTexture->GetResource() << "\n"); - //LOG(pTexture->GetBaseTexture() << "\n"); - HRESULT hr = m_pDevice->SetTexture(Stage,pTexture->GetBaseTexture()); - - return hr; + return m_pDevice->SetTexture(Stage,pTexture->GetBaseTexture()); } } - /*STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3D8Base::D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetTextureStageState(DWORD Stage,D3D8Base::D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) { LOG("IDirect3DDevice8::GetTextureStageState( " << Stage << " , " << Type << " , " << pValue << " )\n"); - HRESULT hr = m_pDevice->GetTextureStageState(Stage,Type,pValue); - - return hr; + return m_pDevice->GetTextureStageState(Stage,Type,pValue); } - /*STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3D8Base::D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetTextureStageState(DWORD Stage,D3D8Base::D3DTEXTURESTAGESTATETYPE Type,DWORD Value) { LOG("IDirect3DDevice8::SetTextureStageState( " << Stage << " , " << Type << " , " << Value << " )\n"); - HRESULT hr = m_pDevice->SetTextureStageState(Stage,Type,Value); - - return hr; + return m_pDevice->SetTextureStageState(Stage,Type,Value); } - /*STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::ValidateDevice(DWORD* pNumPasses) { LOG("IDirect3DDevice8::ValidateDevice( " << pNumPasses << " )\n"); - HRESULT hr = m_pDevice->ValidateDevice(pNumPasses); - - return hr; + return m_pDevice->ValidateDevice(pNumPasses); } - /*STDMETHOD(GetInfo)(THIS_ DWORD DevInfoID,void* pDevInfoStruct,DWORD DevInfoStructSize) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetInfo(DWORD DevInfoID,void* pDevInfoStruct,DWORD DevInfoStructSize) { LOG("IDirect3DDevice8::GetInfo( " << DevInfoID << " , " << pDevInfoStruct << " , " << DevInfoStructSize << " )\n"); - HRESULT hr = m_pDevice->GetInfo(DevInfoID,pDevInfoStruct,DevInfoStructSize); - - return hr; + return m_pDevice->GetInfo(DevInfoID,pDevInfoStruct,DevInfoStructSize); } - /*STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetPaletteEntries(UINT PaletteNumber,CONST PALETTEENTRY* pEntries) { LOG("IDirect3DDevice8::SetPaletteEntries( " << PaletteNumber << " , " << pEntries << " )\n"); - HRESULT hr = m_pDevice->SetPaletteEntries(PaletteNumber,pEntries); - - return hr; + return m_pDevice->SetPaletteEntries(PaletteNumber,pEntries); } - /*STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetPaletteEntries(UINT PaletteNumber,PALETTEENTRY* pEntries) { LOG("IDirect3DDevice8::GetPaletteEntries( " << PaletteNumber << " , " << pEntries << " )\n"); - HRESULT hr = m_pDevice->GetPaletteEntries(PaletteNumber,pEntries); - - return hr; + return m_pDevice->GetPaletteEntries(PaletteNumber,pEntries); } - /*STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetCurrentTexturePalette(UINT PaletteNumber) { LOG("IDirect3DDevice8::SetCurrentTexturePalette( " << PaletteNumber << " )\n"); - HRESULT hr = m_pDevice->SetCurrentTexturePalette(PaletteNumber); - - return hr; + return m_pDevice->SetCurrentTexturePalette(PaletteNumber); } - /*STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetCurrentTexturePalette(UINT *PaletteNumber) { LOG("IDirect3DDevice8::GetCurrentTexturePalette( " << PaletteNumber << " )\n"); - HRESULT hr = m_pDevice->GetCurrentTexturePalette(PaletteNumber); - - return hr; + return m_pDevice->GetCurrentTexturePalette(PaletteNumber); } - /*STDMETHOD(DrawPrimitive)(THIS_ D3D8Base::D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::DrawPrimitive(D3D8Base::D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) { LOG("IDirect3DDevice8::DrawPrimitive( " << PrimitiveType << " , " << StartVertex << " , " << PrimitiveCount << " )\n"); - HRESULT hr = m_pDevice->DrawPrimitive(PrimitiveType,StartVertex,PrimitiveCount); - - return hr; + return m_pDevice->DrawPrimitive(PrimitiveType,StartVertex,PrimitiveCount); } - /*STDMETHOD(DrawIndexedPrimitive)(THIS_ D3D8Base::D3DPRIMITIVETYPE,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::DrawIndexedPrimitive(D3D8Base::D3DPRIMITIVETYPE PrimitiveType,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount) { LOG("IDirect3DDevice8::DrawIndexedPrimitive( " << PrimitiveType << " , " << minIndex << " , " << NumVertices << " , " << startIndex << " , " << primCount << " )\n"); - HRESULT hr = m_pDevice->DrawIndexedPrimitive(PrimitiveType,minIndex,NumVertices,startIndex,primCount); - - return hr; + return m_pDevice->DrawIndexedPrimitive(PrimitiveType,minIndex,NumVertices,startIndex,primCount); } - /*STDMETHOD(DrawPrimitiveUP)(THIS_ D3D8Base::D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::DrawPrimitiveUP(D3D8Base::D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) { LOG("IDirect3DDevice8::DrawPrimitiveUP( " << PrimitiveType << " , " << PrimitiveCount << " , " << pVertexStreamZeroData << " , " << VertexStreamZeroStride << " )\n"); - HRESULT hr = m_pDevice->DrawPrimitiveUP(PrimitiveType,PrimitiveCount,pVertexStreamZeroData,VertexStreamZeroStride); - - return hr; + return m_pDevice->DrawPrimitiveUP(PrimitiveType,PrimitiveCount,pVertexStreamZeroData,VertexStreamZeroStride); } - /*STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3D8Base::D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData,D3D8Base::D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::DrawIndexedPrimitiveUP(D3D8Base::D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData,D3D8Base::D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) { LOG("IDirect3DDevice8::DrawIndexedPrimitiveUP( " << PrimitiveType << " , " << MinVertexIndex << " , " << NumVertexIndices << " , " << PrimitiveCount << " , " << pIndexData << " , " << IndexDataFormat << " , " << pVertexStreamZeroData << " , " << VertexStreamZeroStride << " )\n"); - HRESULT hr = m_pDevice->DrawIndexedPrimitiveUP(PrimitiveType,MinVertexIndex,NumVertexIndices,PrimitiveCount,pIndexData,IndexDataFormat,pVertexStreamZeroData,VertexStreamZeroStride); - - return hr; + return m_pDevice->DrawIndexedPrimitiveUP(PrimitiveType,MinVertexIndex,NumVertexIndices,PrimitiveCount,pIndexData,IndexDataFormat,pVertexStreamZeroData,VertexStreamZeroStride); } - /*STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,D3D8Base::IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,D3D8Wrapper::IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags) { LOG("IDirect3DDevice8::ProcessVertices( " << SrcStartIndex << " , " << DestIndex << " , " << VertexCount << " , " << pDestBuffer << " , " << Flags << " )\n"); - HRESULT hr = m_pDevice->ProcessVertices(SrcStartIndex,DestIndex,VertexCount,pDestBuffer->GetVertexBuffer(),Flags); - - return hr; + return m_pDevice->ProcessVertices(SrcStartIndex,DestIndex,VertexCount,pDestBuffer->GetVertexBuffer(),Flags); } - /*STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pDeclaration,CONST DWORD* pFunction,DWORD* pHandle,DWORD Usage) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::CreateVertexShader(CONST DWORD* pDeclaration,CONST DWORD* pFunction,DWORD* pHandle,DWORD Usage) { LOG("IDirect3DDevice8::CreateVertexShader( " << pDeclaration << " , " << pFunction << " , " << pHandle << " , " << Usage << " )\n"); - HRESULT hr = m_pDevice->CreateVertexShader(pDeclaration,pFunction,pHandle,Usage); - - return hr; + return m_pDevice->CreateVertexShader(pDeclaration,pFunction,pHandle,Usage); } - /*STDMETHOD(SetVertexShader)(THIS_ DWORD Handle) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetVertexShader(DWORD Handle) { LOG("IDirect3DDevice8::SetVertexShader( " << Handle << " )\n"); - HRESULT hr = m_pDevice->SetVertexShader(Handle); - - return hr; + return m_pDevice->SetVertexShader(Handle); } - /*STDMETHOD(GetVertexShader)(THIS_ DWORD* pHandle) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetVertexShader(DWORD* pHandle) { LOG("IDirect3DDevice8::GetVertexShader( " << pHandle << " )\n"); - HRESULT hr = m_pDevice->GetVertexShader(pHandle); - - return hr; + return m_pDevice->GetVertexShader(pHandle); } - /*STDMETHOD(DeleteVertexShader)(THIS_ DWORD Handle) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::DeleteVertexShader(DWORD Handle) { LOG("IDirect3DDevice8::DeleteVertexShader( " << Handle << " )\n"); - HRESULT hr = m_pDevice->DeleteVertexShader(Handle); - - return hr; + return m_pDevice->DeleteVertexShader(Handle); } - /*STDMETHOD(SetVertexShaderConstant)(THIS_ DWORD Register,CONST void* pConstantData,DWORD ConstantCount) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetVertexShaderConstant(DWORD Register,CONST void* pConstantData,DWORD ConstantCount) { LOG("IDirect3DDevice8::SetVertexShaderConstant( " << Register << " , " << pConstantData << " , " << ConstantCount << " )\n"); - HRESULT hr = m_pDevice->SetVertexShaderConstant(Register,pConstantData,ConstantCount); - - return hr; + return m_pDevice->SetVertexShaderConstant(Register,pConstantData,ConstantCount); } - /*STDMETHOD(GetVertexShaderConstant)(THIS_ DWORD Register,void* pConstantData,DWORD ConstantCount) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetVertexShaderConstant(DWORD Register,void* pConstantData,DWORD ConstantCount) { LOG("IDirect3DDevice8::GetVertexShaderConstant( " << Register << " , " << pConstantData << " , " << ConstantCount << " )\n"); - HRESULT hr = m_pDevice->GetVertexShaderConstant(Register,pConstantData,ConstantCount); - - return hr; + return m_pDevice->GetVertexShaderConstant(Register,pConstantData,ConstantCount); } - /*STDMETHOD(GetVertexShaderDeclaration)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetVertexShaderDeclaration(DWORD Handle,void* pData,DWORD* pSizeOfData) { LOG("IDirect3DDevice8::GetVertexShaderDeclaration( " << Handle << " , " << pData << " , " << pSizeOfData << " )\n"); - HRESULT hr = m_pDevice->GetVertexShaderDeclaration(Handle,pData,pSizeOfData); - - return hr; + return m_pDevice->GetVertexShaderDeclaration(Handle,pData,pSizeOfData); } - /*STDMETHOD(GetVertexShaderFunction)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetVertexShaderFunction(DWORD Handle,void* pData,DWORD* pSizeOfData) { LOG("IDirect3DDevice8::GetVertexShaderFunction( " << Handle << " , " << pData << " , " << pSizeOfData << " )\n"); - HRESULT hr = m_pDevice->GetVertexShaderFunction(Handle,pData,pSizeOfData); - - return hr; + return m_pDevice->GetVertexShaderFunction(Handle,pData,pSizeOfData); } - /*STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,D3D8Base::IDirect3DVertexBuffer8* pStreamData,UINT Stride) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetStreamSource(UINT StreamNumber,D3D8Wrapper::IDirect3DVertexBuffer8* pStreamData,UINT Stride) { LOG("IDirect3DDevice8::SetStreamSource( " << StreamNumber << " , " << pStreamData << " , " << Stride << " )\n"); - HRESULT hr = m_pDevice->SetStreamSource(StreamNumber,pStreamData->GetVertexBuffer(),Stride); - - return hr; + return m_pDevice->SetStreamSource(StreamNumber,pStreamData->GetVertexBuffer(),Stride); } - /*STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,D3D8Base::IDirect3DVertexBuffer8** ppStreamData,UINT* pStride) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetStreamSource(UINT StreamNumber,D3D8Wrapper::IDirect3DVertexBuffer8** ppStreamData,UINT* pStride) { LOG("IDirect3DDevice8::GetStreamSource( " << StreamNumber << " , " << ppStreamData << " , " << pStride << " )\n"); - D3D8Base::IDirect3DVertexBuffer8* fd = NULL; + D3D8Base::IDirect3DVertexBuffer8* realD3D = NULL; - HRESULT hr = m_pDevice->GetStreamSource(StreamNumber,&fd,pStride);//ppStreamData,pStride); + HRESULT hr = m_pDevice->GetStreamSource(StreamNumber,&realD3D,pStride); - D3D8Wrapper::IDirect3DVertexBuffer8* f = new D3D8Wrapper::IDirect3DVertexBuffer8(fd); + D3D8Wrapper::IDirect3DVertexBuffer8* wrappedD3D = new D3D8Wrapper::IDirect3DVertexBuffer8(realD3D); - *ppStreamData = f; + *ppStreamData = wrappedD3D; return hr; } - /*STDMETHOD(SetIndices)(THIS_ D3D8Base::IDirect3DIndexBuffer8* pIndexData,UINT BaseVertexIndex) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetIndices(D3D8Wrapper::IDirect3DIndexBuffer8* pIndexData,UINT BaseVertexIndex) { LOG("IDirect3DDevice8::SetIndices( " << pIndexData << " , " << BaseVertexIndex << " )\n"); - HRESULT hr = m_pDevice->SetIndices(pIndexData->GetIndexBuffer(),BaseVertexIndex); - - return hr; + return m_pDevice->SetIndices(pIndexData->GetIndexBuffer(),BaseVertexIndex); } - /*STDMETHOD(GetIndices)(THIS_ D3D8Base::IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetIndices(D3D8Wrapper::IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex) { LOG("IDirect3DDevice8::GetIndices( " << ppIndexData << " , " << pBaseVertexIndex << " )\n"); - D3D8Base::IDirect3DIndexBuffer8* fd = NULL; + D3D8Base::IDirect3DIndexBuffer8* realD3D = NULL; - HRESULT hr = m_pDevice->GetIndices(&fd,pBaseVertexIndex);// ppIndexData,pBaseVertexIndex); + HRESULT hr = m_pDevice->GetIndices(&realD3D,pBaseVertexIndex);// ppIndexData,pBaseVertexIndex); - D3D8Wrapper::IDirect3DIndexBuffer8* f = new D3D8Wrapper::IDirect3DIndexBuffer8(fd); + D3D8Wrapper::IDirect3DIndexBuffer8* wrappedD3D = new D3D8Wrapper::IDirect3DIndexBuffer8(realD3D); - *ppIndexData = f; + *ppIndexData = wrappedD3D; return hr; } - /*STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,DWORD* pHandle) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::CreatePixelShader(CONST DWORD* pFunction,DWORD* pHandle) { LOG("IDirect3DDevice8::CreatePixelShader( " << pFunction << " , " << pHandle << " )\n"); - HRESULT hr = m_pDevice->CreatePixelShader(pFunction,pHandle); - - return hr; + return m_pDevice->CreatePixelShader(pFunction,pHandle); } - /*STDMETHOD(SetPixelShader)(THIS_ DWORD Handle) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetPixelShader(DWORD Handle) { LOG("IDirect3DDevice8::SetPixelShader( " << Handle << " )\n"); - HRESULT hr = m_pDevice->SetPixelShader(Handle); - - return hr; + return m_pDevice->SetPixelShader(Handle); } - /*STDMETHOD(GetPixelShader)(THIS_ DWORD* pHandle) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetPixelShader(DWORD* pHandle) { LOG("IDirect3DDevice8::GetPixelShader( " << pHandle << " )\n"); - HRESULT hr = m_pDevice->GetPixelShader(pHandle); - - return hr; + return m_pDevice->GetPixelShader(pHandle); } - /*STDMETHOD(DeletePixelShader)(THIS_ DWORD Handle) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::DeletePixelShader(DWORD Handle) { LOG("IDirect3DDevice8::DeletePixelShader( " << Handle << " )\n"); - HRESULT hr = m_pDevice->DeletePixelShader(Handle); - - return hr; + return m_pDevice->DeletePixelShader(Handle); } - /*STDMETHOD(SetPixelShaderConstant)(THIS_ DWORD Register,CONST void* pConstantData,DWORD ConstantCount) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetPixelShaderConstant(DWORD Register,CONST void* pConstantData,DWORD ConstantCount) { LOG("IDirect3DDevice8::SetPixelShaderConstant( " << Register << " , " << pConstantData << " , " << ConstantCount << " )\n"); - HRESULT hr = m_pDevice->SetPixelShaderConstant(Register,pConstantData,ConstantCount); - - return hr; + return m_pDevice->SetPixelShaderConstant(Register,pConstantData,ConstantCount); } - /*STDMETHOD(GetPixelShaderConstant)(THIS_ DWORD Register,void* pConstantData,DWORD ConstantCount) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetPixelShaderConstant(DWORD Register,void* pConstantData,DWORD ConstantCount) { LOG("IDirect3DDevice8::GetPixelShaderConstant( " << Register << " , " << pConstantData << " , " << ConstantCount << " )\n"); - HRESULT hr = m_pDevice->GetPixelShaderConstant(Register,pConstantData,ConstantCount); - - return hr; + return m_pDevice->GetPixelShaderConstant(Register,pConstantData,ConstantCount); } - /*STDMETHOD(GetPixelShaderFunction)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetPixelShaderFunction(DWORD Handle,void* pData,DWORD* pSizeOfData) { LOG("IDirect3DDevice8::GetPixelShaderFunction( " << Handle << " , " << pData << " , " << pSizeOfData << " )\n"); - HRESULT hr = m_pDevice->GetPixelShaderFunction(Handle,pData,pSizeOfData); - - return hr; + return m_pDevice->GetPixelShaderFunction(Handle,pData,pSizeOfData); } - /*STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3D8Base::D3DRECTPATCH_INFO* pRectPatchInfo) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::DrawRectPatch(UINT Handle,CONST float* pNumSegs,CONST D3D8Base::D3DRECTPATCH_INFO* pRectPatchInfo) { LOG("IDirect3DDevice8::DrawRectPatch( " << Handle << " , " << pNumSegs << " , " << pRectPatchInfo << " )\n"); - HRESULT hr = m_pDevice->DrawRectPatch(Handle,pNumSegs,pRectPatchInfo); - - return hr; + return m_pDevice->DrawRectPatch(Handle,pNumSegs,pRectPatchInfo); } - /*STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3D8Base::D3DTRIPATCH_INFO* pTriPatchInfo) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::DrawTriPatch(UINT Handle,CONST float* pNumSegs,CONST D3D8Base::D3DTRIPATCH_INFO* pTriPatchInfo) { LOG("IDirect3DDevice8::DrawTriPatch( " << Handle << " , " << pNumSegs << " , " << pTriPatchInfo << " )\n"); - HRESULT hr = m_pDevice->DrawTriPatch(Handle,pNumSegs,pTriPatchInfo); - - return hr; + return m_pDevice->DrawTriPatch(Handle,pNumSegs,pTriPatchInfo); } - /*STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::DeletePatch(UINT Handle) { LOG("IDirect3DDevice8::DeletePatch( " << Handle << " )\n"); - HRESULT hr = m_pDevice->DeletePatch(Handle); - - return hr; + return m_pDevice->DeletePatch(Handle); } } } \ No newline at end of file diff --git a/libmupen64plus/D3D8Interceptor/Direct3DIndexBuffer8Functions.cpp b/libmupen64plus/D3D8Interceptor/Direct3DIndexBuffer8Functions.cpp index 1dd10ca5c7..92610deb1d 100644 --- a/libmupen64plus/D3D8Interceptor/Direct3DIndexBuffer8Functions.cpp +++ b/libmupen64plus/D3D8Interceptor/Direct3DIndexBuffer8Functions.cpp @@ -4,37 +4,28 @@ extern "C" { namespace D3D8Wrapper { - D3D8Wrapper::IDirect3DIndexBuffer8::IDirect3DIndexBuffer8(D3D8Base::IDirect3DIndexBuffer8* pTexture) : IDirect3DResource8((D3D8Base::IDirect3DResource8*) pTexture) + D3D8Wrapper::IDirect3DIndexBuffer8::IDirect3DIndexBuffer8(D3D8Base::IDirect3DIndexBuffer8* realIndexBuffer) : IDirect3DResource8((D3D8Base::IDirect3DResource8*) realIndexBuffer) { - LOG("IDirect3DIndexBuffer8( " << pTexture << " )\n"); - m_pD3D = pTexture; + LOG("IDirect3DIndexBuffer8( " << realIndexBuffer << " )\n"); + m_pD3D = realIndexBuffer; } - /*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( " << OffsetToLock << " , " << SizeToLock << " , " << ppbData << " , " << Flags << " )\n"); - HRESULT hr = m_pD3D->Lock(OffsetToLock,SizeToLock,ppbData,Flags); - - return hr; + return m_pD3D->Lock(OffsetToLock,SizeToLock,ppbData,Flags); } - /*STDMETHOD(Unlock)(THIS) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DIndexBuffer8::Unlock() { LOG("IDirect3DIndexBuffer8::Unlock()\n"); - HRESULT hr = m_pD3D->Unlock(); - - return hr; + return m_pD3D->Unlock(); } - /*STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DINDEXBUFFER_DESC *pDesc) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DIndexBuffer8::GetDesc(D3D8Base::D3DINDEXBUFFER_DESC *pDesc) { LOG("IDirect3DIndexBuffer8::GetDesc( " << pDesc << " )\n"); - HRESULT hr = m_pD3D->GetDesc(pDesc); - - return hr; + return m_pD3D->GetDesc(pDesc); } } } \ No newline at end of file diff --git a/libmupen64plus/D3D8Interceptor/Direct3DResource8Functions.cpp b/libmupen64plus/D3D8Interceptor/Direct3DResource8Functions.cpp index bfe43026bf..0fdd58ebd7 100644 --- a/libmupen64plus/D3D8Interceptor/Direct3DResource8Functions.cpp +++ b/libmupen64plus/D3D8Interceptor/Direct3DResource8Functions.cpp @@ -6,27 +6,25 @@ extern "C" { ThreadSafePointerSet D3D8Wrapper::IDirect3DResource8::m_List; - D3D8Wrapper::IDirect3DResource8::IDirect3DResource8(D3D8Base::IDirect3DResource8* pResource) : IDirect3DUnknown((IUnknown*) pResource) + D3D8Wrapper::IDirect3DResource8::IDirect3DResource8(D3D8Base::IDirect3DResource8* realResource) : IDirect3DUnknown((IUnknown*) realResource) { - LOG("IDirect3DResource8::IDirect3DResource8( " << pResource << " )\n"); - m_pD3D = pResource; + LOG("IDirect3DResource8::IDirect3DResource8( " << realResource << " )\n"); + m_pD3D = realResource; } - D3D8Wrapper::IDirect3DResource8* D3D8Wrapper::IDirect3DResource8::GetResource(D3D8Base::IDirect3DResource8* pSwapChain) + D3D8Wrapper::IDirect3DResource8* D3D8Wrapper::IDirect3DResource8::GetResource(D3D8Base::IDirect3DResource8* realResource) { - LOG("IDirect3DResource8::GetResource( " << pSwapChain << " )\n"); - D3D8Wrapper::IDirect3DResource8* p = (D3D8Wrapper::IDirect3DResource8*) m_List.GetDataPtr(pSwapChain); - if( p == NULL ) + LOG("IDirect3DResource8::GetResource( " << realResource << " )\n"); + D3D8Wrapper::IDirect3DResource8* wrappedResource = (D3D8Wrapper::IDirect3DResource8*) m_List.GetDataPtr(realResource); + if( wrappedResource == NULL ) { - p = new D3D8Wrapper::IDirect3DResource8(pSwapChain); - //LOG("IDirect3DResource8::GetResource " << pSwapChain << " created new " << p << "\n") - m_List.AddMember(pSwapChain, p); - return p; + wrappedResource = new D3D8Wrapper::IDirect3DResource8(realResource); + m_List.AddMember(realResource, wrappedResource); + return wrappedResource; } - p->m_ulRef++; - //LOG("IDirect3DResource8::GetResource " << pSwapChain << " found existing " << p << "\n") - return p; + wrappedResource->m_ulRef++; + return wrappedResource; } STDMETHODIMP_(ULONG) D3D8Wrapper::IDirect3DResource8::Release(THIS) @@ -44,70 +42,56 @@ extern "C" return ulRef; } - /*STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DResource8::GetDevice(D3D8Wrapper::IDirect3DDevice8** ppDevice) { LOG("IDirect3DResource8::GetDevice( " << ppDevice << " )\n"); - D3D8Base::IDirect3DDevice8* fd = NULL; + D3D8Base::IDirect3DDevice8* realD3D = NULL; - HRESULT hr = m_pD3D->GetDevice(&fd);//ppDevice); + HRESULT hr = m_pD3D->GetDevice(&realD3D); - D3D8Wrapper::IDirect3DDevice8* f = new D3D8Wrapper::IDirect3DDevice8(fd); + D3D8Wrapper::IDirect3DDevice8* wrappedD3D = new D3D8Wrapper::IDirect3DDevice8(realD3D); - *ppDevice = f; + *ppDevice = wrappedD3D; return hr; } - /*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( " << &refguid << " , " << pData << " , " << SizeOfData << " , " << Flags << " )\n"); - HRESULT hr = m_pD3D->SetPrivateData(refguid,pData,SizeOfData,Flags); - - return hr; + return m_pD3D->SetPrivateData(refguid,pData,SizeOfData,Flags); } - /*STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DResource8::GetPrivateData(REFGUID refguid,void* pData,DWORD* pSizeOfData) { LOG("IDirect3DResource8::GetPrivateData( " << &refguid << " , " << pData << " , " << pSizeOfData << " )\n"); - HRESULT hr = m_pD3D->GetPrivateData(refguid,pData,pSizeOfData); - - return hr; + return m_pD3D->GetPrivateData(refguid,pData,pSizeOfData); } - /*STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DResource8::FreePrivateData(REFGUID refguid) { LOG("IDirect3DResource8::FreePrivateData( " << &refguid << " )\n"); - HRESULT hr = m_pD3D->FreePrivateData(refguid); - - return hr; + return m_pD3D->FreePrivateData(refguid); } - /*STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE;*/ STDMETHODIMP_(DWORD) D3D8Wrapper::IDirect3DResource8::SetPriority(DWORD PriorityNew) { LOG("IDirect3DResource8::SetPriority( " << PriorityNew << " )\n"); return m_pD3D->SetPriority(PriorityNew); } - /*STDMETHOD_(DWORD, GetPriority)(THIS) PURE;*/ STDMETHODIMP_(DWORD) D3D8Wrapper::IDirect3DResource8::GetPriority() { LOG("IDirect3DResource8::GetPriority()\n"); return m_pD3D->GetPriority(); } - /*STDMETHOD_(void, PreLoad)(THIS) PURE;*/ STDMETHODIMP_(void) D3D8Wrapper::IDirect3DResource8::PreLoad() { LOG("IDirect3DResource8::PreLoad()\n"); return m_pD3D->PreLoad(); } - /*STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE;*/ STDMETHODIMP_(D3D8Base::D3DRESOURCETYPE) D3D8Wrapper::IDirect3DResource8::GetType() { LOG("IDirect3DResource8::GetType()\n"); diff --git a/libmupen64plus/D3D8Interceptor/Direct3DSurface8Functions.cpp b/libmupen64plus/D3D8Interceptor/Direct3DSurface8Functions.cpp index 308c4c54bc..dc6d860d49 100644 --- a/libmupen64plus/D3D8Interceptor/Direct3DSurface8Functions.cpp +++ b/libmupen64plus/D3D8Interceptor/Direct3DSurface8Functions.cpp @@ -4,25 +4,27 @@ extern "C" { namespace D3D8Wrapper { - D3D8Wrapper::IDirect3DSurface8::IDirect3DSurface8(D3D8Base::IDirect3DSurface8* pTexture) : IDirect3DUnknown((IUnknown*) pTexture) + ThreadSafePointerSet IDirect3DSurface8::m_List; + + D3D8Wrapper::IDirect3DSurface8::IDirect3DSurface8(D3D8Base::IDirect3DSurface8* realSurface) : IDirect3DUnknown((IUnknown*) realSurface) { - LOG("IDirect3DSurface8::IDirect3DSurface8( " << pTexture << " )\n"); - m_pD3D = pTexture; + LOG("IDirect3DSurface8::IDirect3DSurface8( " << realSurface << " )\n"); + m_pD3D = realSurface; } - D3D8Wrapper::IDirect3DSurface8* D3D8Wrapper::IDirect3DSurface8::GetSurface(D3D8Base::IDirect3DSurface8* pSurface) + D3D8Wrapper::IDirect3DSurface8* D3D8Wrapper::IDirect3DSurface8::GetSurface(D3D8Base::IDirect3DSurface8* realSurface) { - LOG("IDirect3DSurface8::GetSurface( " << pSurface << " )\n"); - D3D8Wrapper::IDirect3DSurface8* p = (D3D8Wrapper::IDirect3DSurface8*) m_List.GetDataPtr(pSurface); - if(p == NULL) + LOG("IDirect3DSurface8::GetSurface( " << realSurface << " )\n"); + D3D8Wrapper::IDirect3DSurface8* wrappedSurface = (D3D8Wrapper::IDirect3DSurface8*) m_List.GetDataPtr(realSurface); + if(wrappedSurface == NULL) { - p = new IDirect3DSurface8(pSurface); - m_List.AddMember(pSurface, p); - return p; + wrappedSurface = new IDirect3DSurface8(realSurface); + m_List.AddMember(realSurface, wrappedSurface); + return wrappedSurface; } - p->m_ulRef++; - return p; + wrappedSurface->m_ulRef++; + return wrappedSurface; } STDMETHODIMP_(ULONG) D3D8Wrapper::IDirect3DSurface8::Release(THIS) @@ -40,68 +42,51 @@ extern "C" return ulRef; } - /*STDMETHOD(GetDevice)(THIS_ D3D8Wrapper::IDirect3DDevice8** ppDevice) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::GetDevice(D3D8Wrapper::IDirect3DDevice8** ppDevice) { LOG("IDirect3DSurface8::GetDevice( " << ppDevice << " )\n"); - D3D8Base::IDirect3DDevice8* fd = NULL; + D3D8Base::IDirect3DDevice8* realD3D = NULL; - HRESULT hr = m_pD3D->GetDevice(&fd);//ppDevice); + HRESULT hr = m_pD3D->GetDevice(&realD3D); - D3D8Wrapper::IDirect3DDevice8* f = new D3D8Wrapper::IDirect3DDevice8(fd); + D3D8Wrapper::IDirect3DDevice8* wrappedD3D = new D3D8Wrapper::IDirect3DDevice8(realD3D); - *ppDevice = f; + *ppDevice = wrappedD3D; return hr; } - /*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( " << &refguid << " , " << pData << " , " << SizeOfData << " , " << Flags << " )\n"); - HRESULT hr = m_pD3D->SetPrivateData(refguid,pData,SizeOfData,Flags); - - return hr; + return m_pD3D->SetPrivateData(refguid,pData,SizeOfData,Flags); } - /*STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::GetPrivateData(REFGUID refguid,void* pData,DWORD* pSizeOfData) { LOG("IDirect3DSurface8::GetPrivateData( " << &refguid << " , " << pData << " , " << pSizeOfData << " )\n"); - HRESULT hr = m_pD3D->GetPrivateData(refguid,pData,pSizeOfData); - - return hr; + return m_pD3D->GetPrivateData(refguid,pData,pSizeOfData); } - /*STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::FreePrivateData(REFGUID refguid) { LOG("IDirect3DSurface8::FreePrivateData( " << &refguid << " )\n"); - HRESULT hr = m_pD3D->FreePrivateData(refguid); - - return hr; + return m_pD3D->FreePrivateData(refguid); } - /*STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::GetContainer(REFIID riid,void** ppContainer) { LOG("IDirect3DSurface8::GetContainer( " << &riid << " , " << ppContainer << " )\n"); - HRESULT hr = m_pD3D->GetContainer(riid,ppContainer); - - return hr; + return m_pD3D->GetContainer(riid,ppContainer); } - /*STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DSURFACE_DESC *pDesc) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::GetDesc(D3D8Base::D3DSURFACE_DESC *pDesc) { LOG("IDirect3DSurface8::GetDesc( " << pDesc << " )\n"); - HRESULT hr = m_pD3D->GetDesc(pDesc); - - return hr; + return m_pD3D->GetDesc(pDesc); } - /*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) { #ifdef LOGGING @@ -112,18 +97,13 @@ extern "C" } LOG(" , " << Flags << " )\n"); #endif - HRESULT hr = m_pD3D->LockRect(pLockedRect,pRect,Flags); - - return hr; + return m_pD3D->LockRect(pLockedRect,pRect,Flags); } - /*STDMETHOD(UnlockRect)(THIS) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DSurface8::UnlockRect() { LOG("IDirect3DSurface8::UnlockRect()\n"); - HRESULT hr = m_pD3D->UnlockRect(); - - return hr; + return m_pD3D->UnlockRect(); } } } \ No newline at end of file diff --git a/libmupen64plus/D3D8Interceptor/Direct3DSwapChain8Functions.cpp b/libmupen64plus/D3D8Interceptor/Direct3DSwapChain8Functions.cpp index 981f804c2b..7ecded448e 100644 --- a/libmupen64plus/D3D8Interceptor/Direct3DSwapChain8Functions.cpp +++ b/libmupen64plus/D3D8Interceptor/Direct3DSwapChain8Functions.cpp @@ -4,25 +4,27 @@ extern "C" { namespace D3D8Wrapper { - D3D8Wrapper::IDirect3DSwapChain8::IDirect3DSwapChain8(D3D8Base::IDirect3DSwapChain8* pSwapChain) : IDirect3DUnknown((IUnknown*) pSwapChain) + ThreadSafePointerSet IDirect3DSwapChain8::m_List; + + D3D8Wrapper::IDirect3DSwapChain8::IDirect3DSwapChain8(D3D8Base::IDirect3DSwapChain8* realSwapChain) : IDirect3DUnknown((IUnknown*) realSwapChain) { - LOG("IDirect3DSwapChain8::IDirect3DSwapChain8( " << pSwapChain << " )\n"); - m_pD3D = pSwapChain; + LOG("IDirect3DSwapChain8::IDirect3DSwapChain8( " << realSwapChain << " )\n"); + m_pD3D = realSwapChain; } - D3D8Wrapper::IDirect3DSwapChain8* D3D8Wrapper::IDirect3DSwapChain8::GetSwapChain(D3D8Base::IDirect3DSwapChain8* pSwapChain) + D3D8Wrapper::IDirect3DSwapChain8* D3D8Wrapper::IDirect3DSwapChain8::GetSwapChain(D3D8Base::IDirect3DSwapChain8* realSwapChain) { - LOG("IDirect3DSwapChain8::GetSwapChain( " << pSwapChain << " )\n"); - D3D8Wrapper::IDirect3DSwapChain8* p = (D3D8Wrapper::IDirect3DSwapChain8*) m_List.GetDataPtr(pSwapChain); - if( p == NULL ) + LOG("IDirect3DSwapChain8::GetSwapChain( " << realSwapChain << " )\n"); + D3D8Wrapper::IDirect3DSwapChain8* wrappedSwapChain = (D3D8Wrapper::IDirect3DSwapChain8*) m_List.GetDataPtr(realSwapChain); + if( wrappedSwapChain == NULL ) { - p = new D3D8Wrapper::IDirect3DSwapChain8(pSwapChain); - m_List.AddMember(pSwapChain, p); - return p; + wrappedSwapChain = new D3D8Wrapper::IDirect3DSwapChain8(realSwapChain); + m_List.AddMember(realSwapChain, wrappedSwapChain); + return wrappedSwapChain; } - p->m_ulRef++; - return p; + wrappedSwapChain->m_ulRef++; + return wrappedSwapChain; } STDMETHODIMP_(ULONG) D3D8Wrapper::IDirect3DSwapChain8::Release(THIS) @@ -43,22 +45,20 @@ extern "C" STDMETHODIMP D3D8Wrapper::IDirect3DSwapChain8::Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) { LOG("IDirect3DSwapChain8::Present( " << pSourceRect << " , " << pDestRect << " , " << hDestWindowOverride << " , " << pDirtyRegion << " )\n"); - HRESULT hr = m_pD3D->Present(pSourceRect,pDestRect,hDestWindowOverride,pDirtyRegion); - - return hr; + return m_pD3D->Present(pSourceRect,pDestRect,hDestWindowOverride,pDirtyRegion); } STDMETHODIMP D3D8Wrapper::IDirect3DSwapChain8::GetBackBuffer(UINT BackBuffer,D3D8Base::D3DBACKBUFFER_TYPE Type,D3D8Wrapper::IDirect3DSurface8** ppBackBuffer) { LOG("IDirect3DSwapChain8::GetBackBuffer( " << BackBuffer << " , " << Type << " , " << ppBackBuffer << " )\n"); - D3D8Base::IDirect3DSurface8* fd = NULL; + D3D8Base::IDirect3DSurface8* realD3D = NULL; - HRESULT hr = m_pD3D->GetBackBuffer(BackBuffer,Type,&fd);//ppBackBuffer); + HRESULT hr = m_pD3D->GetBackBuffer(BackBuffer,Type,&realD3D); - D3D8Wrapper::IDirect3DSurface8* f = D3D8Wrapper::IDirect3DSurface8::GetSurface(fd); + D3D8Wrapper::IDirect3DSurface8* wrappedD3D = D3D8Wrapper::IDirect3DSurface8::GetSurface(realD3D); - *ppBackBuffer = f; + *ppBackBuffer = wrappedD3D; return hr; } diff --git a/libmupen64plus/D3D8Interceptor/Direct3DTexture8Functions.cpp b/libmupen64plus/D3D8Interceptor/Direct3DTexture8Functions.cpp index 9ab2bfa1e5..39ed64713a 100644 --- a/libmupen64plus/D3D8Interceptor/Direct3DTexture8Functions.cpp +++ b/libmupen64plus/D3D8Interceptor/Direct3DTexture8Functions.cpp @@ -4,80 +4,64 @@ extern "C" { namespace D3D8Wrapper { - D3D8Wrapper::IDirect3DTexture8::IDirect3DTexture8(D3D8Base::IDirect3DTexture8* pTexture) : IDirect3DBaseTexture8((D3D8Base::IDirect3DBaseTexture8*) pTexture) + D3D8Wrapper::IDirect3DTexture8::IDirect3DTexture8(D3D8Base::IDirect3DTexture8* realTexture) : IDirect3DBaseTexture8((D3D8Base::IDirect3DBaseTexture8*) realTexture) { - LOG("IDirect3DTexture8::IDirect3DTexture8( " << pTexture << " )\n"); - m_pD3D = pTexture; + LOG("IDirect3DTexture8::IDirect3DTexture8( " << realTexture << " )\n"); + m_pD3D = realTexture; } - D3D8Wrapper::IDirect3DTexture8* D3D8Wrapper::IDirect3DTexture8::GetTexture(D3D8Base::IDirect3DTexture8* pTexture) + D3D8Wrapper::IDirect3DTexture8* D3D8Wrapper::IDirect3DTexture8::GetTexture(D3D8Base::IDirect3DTexture8* realTexture) { - LOG("IDirect3DTexture8::GetTexture( " << pTexture << " )\n"); - D3D8Wrapper::IDirect3DTexture8* p = (D3D8Wrapper::IDirect3DTexture8*) D3D8Wrapper::IDirect3DResource8::m_List.GetDataPtr(pTexture); - if( p == NULL ) + LOG("IDirect3DTexture8::GetTexture( " << realTexture << " )\n"); + D3D8Wrapper::IDirect3DTexture8* wrappedTexture = (D3D8Wrapper::IDirect3DTexture8*) D3D8Wrapper::IDirect3DResource8::m_List.GetDataPtr(realTexture); + if( wrappedTexture == NULL ) { - p = new D3D8Wrapper::IDirect3DTexture8(pTexture); - //LOG("IDirect3DTexture8::GetTexture " << pTexture << " created new " << p << "\n") - D3D8Wrapper::IDirect3DResource8::m_List.AddMember(pTexture, p); - return p; + wrappedTexture = new D3D8Wrapper::IDirect3DTexture8(realTexture); + D3D8Wrapper::IDirect3DResource8::m_List.AddMember(realTexture, wrappedTexture); + return wrappedTexture; } - p->m_ulRef++; - //LOG("IDirect3DTexture8::GetTexture " << pTexture << " found existing " << p << "\n") - return p; + wrappedTexture->m_ulRef++; + return wrappedTexture; } - - /*STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::GetLevelDesc(UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc) { LOG("IDirect3DTexture8::GetLevelDesc( " << Level << " , " << pDesc << " )\n"); - HRESULT hr = m_pD3D->GetLevelDesc(Level,pDesc); - - return hr; + return m_pD3D->GetLevelDesc(Level,pDesc); } - /*STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,D3D8Wrapper::IDirect3DSurface8** ppSurfaceLevel) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::GetSurfaceLevel(UINT Level,D3D8Wrapper::IDirect3DSurface8** ppSurfaceLevel) { LOG("IDirect3DTexture8::GetSurfaceLevel( " << Level << " , " << ppSurfaceLevel << " )\n"); - D3D8Base::IDirect3DSurface8* fd = NULL; + D3D8Base::IDirect3DSurface8* realD3D = NULL; - HRESULT hr = m_pD3D->GetSurfaceLevel(Level,&fd);//ppSurfaceLevel); + HRESULT hr = m_pD3D->GetSurfaceLevel(Level,&realD3D); - D3D8Wrapper::IDirect3DSurface8* f = D3D8Wrapper::IDirect3DSurface8::GetSurface(fd); + D3D8Wrapper::IDirect3DSurface8* wrappedD3D = D3D8Wrapper::IDirect3DSurface8::GetSurface(realD3D); - *ppSurfaceLevel = f; + *ppSurfaceLevel = wrappedD3D; 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( " << Level << " , " << pLockedRect << " , " << pRect << " , " << Flags << " )\n"); - HRESULT hr = m_pD3D->LockRect(Level,pLockedRect,pRect,Flags); - - return hr; + return m_pD3D->LockRect(Level,pLockedRect,pRect,Flags); } - /*STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::UnlockRect(UINT Level) { LOG("IDirect3DTexture8::UnlockRect()\n"); - HRESULT hr = m_pD3D->UnlockRect(Level); - - return hr; + return m_pD3D->UnlockRect(Level); } - /*STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DTexture8::AddDirtyRect(CONST RECT* pDirtyRect) { LOG("IDirect3DTexture8::AddDirtyRect( " << pDirtyRect << " )\n"); - HRESULT hr = m_pD3D->AddDirtyRect(pDirtyRect); - - return hr; + return m_pD3D->AddDirtyRect(pDirtyRect); } } } \ No newline at end of file diff --git a/libmupen64plus/D3D8Interceptor/Direct3DVertexBuffer8Functions.cpp b/libmupen64plus/D3D8Interceptor/Direct3DVertexBuffer8Functions.cpp index b44016bcd5..e886812721 100644 --- a/libmupen64plus/D3D8Interceptor/Direct3DVertexBuffer8Functions.cpp +++ b/libmupen64plus/D3D8Interceptor/Direct3DVertexBuffer8Functions.cpp @@ -4,37 +4,28 @@ extern "C" { namespace D3D8Wrapper { - D3D8Wrapper::IDirect3DVertexBuffer8::IDirect3DVertexBuffer8(D3D8Base::IDirect3DVertexBuffer8* pTexture) : IDirect3DResource8((D3D8Base::IDirect3DResource8*) pTexture) + D3D8Wrapper::IDirect3DVertexBuffer8::IDirect3DVertexBuffer8(D3D8Base::IDirect3DVertexBuffer8* realVertexBuffer) : IDirect3DResource8((D3D8Base::IDirect3DResource8*) realVertexBuffer) { - LOG("IDirect3DVertexBuffer8::IDirect3DVertexBuffer8( " << pTexture << " )\n"); - m_pD3D = pTexture; + LOG("IDirect3DVertexBuffer8::IDirect3DVertexBuffer8( " << realVertexBuffer << " )\n"); + m_pD3D = realVertexBuffer; } - /*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( " << OffsetToLock << " , " << SizeToLock << " , " << ppbData << " , " << Flags << " )\n"); - HRESULT hr = m_pD3D->Lock(OffsetToLock,SizeToLock,ppbData,Flags); - - return hr; + return m_pD3D->Lock(OffsetToLock,SizeToLock,ppbData,Flags); } - /*STDMETHOD(Unlock)(THIS) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DVertexBuffer8::Unlock() { LOG("IDirect3DVertexBuffer8::Unlock()\n"); - HRESULT hr = m_pD3D->Unlock(); - - return hr; + return m_pD3D->Unlock(); } - /*STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DVERTEXBUFFER_DESC *pDesc) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DVertexBuffer8::GetDesc(D3D8Base::D3DVERTEXBUFFER_DESC *pDesc) { LOG("IDirect3DVertexBuffer8::GetDesc( " << pDesc << " )\n"); - HRESULT hr = m_pD3D->GetDesc(pDesc); - - return hr; + return m_pD3D->GetDesc(pDesc); } } } \ No newline at end of file diff --git a/libmupen64plus/D3D8Interceptor/Direct3DVolume8Functions.cpp b/libmupen64plus/D3D8Interceptor/Direct3DVolume8Functions.cpp index e13c86b00a..1ac806bf1f 100644 --- a/libmupen64plus/D3D8Interceptor/Direct3DVolume8Functions.cpp +++ b/libmupen64plus/D3D8Interceptor/Direct3DVolume8Functions.cpp @@ -4,89 +4,67 @@ extern "C" { namespace D3D8Wrapper { - D3D8Wrapper::IDirect3DVolume8::IDirect3DVolume8(D3D8Base::IDirect3DVolume8* pTexture) : IDirect3DUnknown((IUnknown*) pTexture) + D3D8Wrapper::IDirect3DVolume8::IDirect3DVolume8(D3D8Base::IDirect3DVolume8* realVolume) : IDirect3DUnknown((IUnknown*) realVolume) { - LOG("IDirect3DVolume8::IDirect3DVolume8( " << pTexture << " )\n"); - m_pD3D = pTexture; + LOG("IDirect3DVolume8::IDirect3DVolume8( " << realVolume << " )\n"); + m_pD3D = realVolume; } - /*STDMETHOD(GetDevice)(THIS_ D3D8Wrapper::IDirect3DDevice8** ppDevice) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::GetDevice(D3D8Wrapper::IDirect3DDevice8** ppDevice) { LOG("IDirect3DVolume8::GetDevice( " << ppDevice << " )\n"); - D3D8Base::IDirect3DDevice8* fd = NULL; + D3D8Base::IDirect3DDevice8* realD3D = NULL; - HRESULT hr = m_pD3D->GetDevice(&fd);//ppDevice); + HRESULT hr = m_pD3D->GetDevice(&realD3D);//ppDevice); - D3D8Wrapper::IDirect3DDevice8* f = new D3D8Wrapper::IDirect3DDevice8(fd); + D3D8Wrapper::IDirect3DDevice8* wrappedD3D = new D3D8Wrapper::IDirect3DDevice8(realD3D); - *ppDevice = f; + *ppDevice = wrappedD3D; return hr; } - /*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( " << &refguid << " , " << pData << " , " << SizeOfData << " , " << Flags << " )\n"); - HRESULT hr = m_pD3D->SetPrivateData(refguid,pData,SizeOfData,Flags); - - return hr; + return m_pD3D->SetPrivateData(refguid,pData,SizeOfData,Flags); } - /*STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::GetPrivateData(REFGUID refguid,void* pData,DWORD* pSizeOfData) { LOG("IDirect3DVolume8::GetPrivateData( " << &refguid << " , " << pData << " , " << pSizeOfData << " )\n"); - HRESULT hr = m_pD3D->GetPrivateData(refguid,pData,pSizeOfData); - - return hr; + return m_pD3D->GetPrivateData(refguid,pData,pSizeOfData); } - /*STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::FreePrivateData(REFGUID refguid) { LOG("IDirect3DVolume8::FreePrivateData( " << &refguid << " )\n"); - HRESULT hr = m_pD3D->FreePrivateData(refguid); - - return hr; + return m_pD3D->FreePrivateData(refguid); } - /*STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::GetContainer(REFIID riid,void** ppContainer) { LOG("IDirect3DVolume8::GetContainer( " << &riid << " , " << ppContainer << " )\n"); - HRESULT hr = m_pD3D->GetContainer(riid,ppContainer); - - return hr; + return m_pD3D->GetContainer(riid,ppContainer); } - /*STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DVOLUME_DESC *pDesc) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::GetDesc(D3D8Base::D3DVOLUME_DESC *pDesc) { LOG("IDirect3DVolume8::GetDesc( " << pDesc << " )\n"); - HRESULT hr = m_pD3D->GetDesc(pDesc); - - return hr; + return m_pD3D->GetDesc(pDesc); } - /*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( " << pLockedVolume << " , " << pBox << " , " << Flags << " )\n"); - HRESULT hr = m_pD3D->LockBox(pLockedVolume,pBox,Flags); - - return hr; + return m_pD3D->LockBox(pLockedVolume,pBox,Flags); } - /*STDMETHOD(UnlockBox)(THIS) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DVolume8::UnlockBox() { LOG("IDirect3DVolume8::UnlockBox()\n"); - HRESULT hr = m_pD3D->UnlockBox(); - - return hr; + return m_pD3D->UnlockBox(); } } } \ No newline at end of file diff --git a/libmupen64plus/D3D8Interceptor/Direct3DVolumeTexture8Functions.cpp b/libmupen64plus/D3D8Interceptor/Direct3DVolumeTexture8Functions.cpp index 7a712bfc6e..1f1c071ff8 100644 --- a/libmupen64plus/D3D8Interceptor/Direct3DVolumeTexture8Functions.cpp +++ b/libmupen64plus/D3D8Interceptor/Direct3DVolumeTexture8Functions.cpp @@ -4,62 +4,49 @@ extern "C" { namespace D3D8Wrapper { - D3D8Wrapper::IDirect3DVolumeTexture8::IDirect3DVolumeTexture8(D3D8Base::IDirect3DVolumeTexture8* pTexture) : IDirect3DBaseTexture8((D3D8Base::IDirect3DBaseTexture8*) pTexture) + D3D8Wrapper::IDirect3DVolumeTexture8::IDirect3DVolumeTexture8(D3D8Base::IDirect3DVolumeTexture8* realVolumeTexture) : IDirect3DBaseTexture8((D3D8Base::IDirect3DBaseTexture8*) realVolumeTexture) { - LOG("IDirect3DVolumeTexture8( " << pTexture << " )\n"); - m_pD3D = pTexture; + LOG("IDirect3DVolumeTexture8( " << realVolumeTexture << " )\n"); + m_pD3D = realVolumeTexture; } - /*STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3D8Base::D3DVOLUME_DESC *pDesc) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DVolumeTexture8::GetLevelDesc(UINT Level,D3D8Base::D3DVOLUME_DESC *pDesc) { LOG("IDirect3DVolumeTexture8::GetLevelDesc( " << Level << " , " << pDesc << " )\n"); - HRESULT hr = m_pD3D->GetLevelDesc(Level,pDesc); - - return hr; + return m_pD3D->GetLevelDesc(Level,pDesc); } - /*STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,IDirect3DVolume8** ppVolumeLevel) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DVolumeTexture8::GetVolumeLevel(UINT Level,D3D8Wrapper::IDirect3DVolume8** ppVolumeLevel) { LOG("IDirect3DVolumeTexture8::GetVolumeLevel( " << Level << " , " << ppVolumeLevel << " )\n"); - D3D8Base::IDirect3DVolume8* fd = NULL; + D3D8Base::IDirect3DVolume8* realD3D = NULL; - HRESULT hr = m_pD3D->GetVolumeLevel(Level,&fd);//ppVolumeLevel); + HRESULT hr = m_pD3D->GetVolumeLevel(Level,&realD3D); - D3D8Wrapper::IDirect3DVolume8* f = new D3D8Wrapper::IDirect3DVolume8(fd); + D3D8Wrapper::IDirect3DVolume8* wrappedD3D = new D3D8Wrapper::IDirect3DVolume8(realD3D); - *ppVolumeLevel = f; + *ppVolumeLevel = wrappedD3D; return hr; } - /*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( " << Level << " , " << pLockedVolume << " , " << pBox << " , " << Flags << " )\n"); - HRESULT hr = m_pD3D->LockBox(Level,pLockedVolume,pBox,Flags); - - return hr; + return m_pD3D->LockBox(Level,pLockedVolume,pBox,Flags); } - /*STDMETHOD(UnlockBox)(THIS_ UINT Level) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DVolumeTexture8::UnlockBox(UINT Level) { LOG("IDirect3DVolumeTexture8::UnlockBox( " << Level << " )\n"); - HRESULT hr = m_pD3D->UnlockBox(Level); - - return hr; + return m_pD3D->UnlockBox(Level); } - /*STDMETHOD(AddDirtyBox)(THIS_ CONST D3D8Base::D3DBOX* pDirtyBox) PURE;*/ STDMETHODIMP D3D8Wrapper::IDirect3DVolumeTexture8::AddDirtyBox(CONST D3D8Base::D3DBOX* pDirtyBox) { LOG("IDirect3DVolumeTexture8::AddDirtyBox( " << pDirtyBox << " )\n"); - HRESULT hr = m_pD3D->AddDirtyBox(pDirtyBox); - - return hr; + return m_pD3D->AddDirtyBox(pDirtyBox); } } } \ No newline at end of file diff --git a/libmupen64plus/D3D8Interceptor/d3d8Wrapper.cpp b/libmupen64plus/D3D8Interceptor/d3d8Wrapper.cpp index 2887a91484..03f850b19f 100644 --- a/libmupen64plus/D3D8Interceptor/d3d8Wrapper.cpp +++ b/libmupen64plus/D3D8Interceptor/d3d8Wrapper.cpp @@ -4,16 +4,6 @@ D3D8Base::LPDIRECT3D8 g_D3D=NULL; HMODULE realDLL; -ThreadSafePointerSet D3D8Wrapper::IDirect3DDevice8::m_List; -ThreadSafePointerSet D3D8Wrapper::IDirect3DBaseTexture8::m_List; -ThreadSafePointerSet D3D8Wrapper::IDirect3DVolumeTexture8::m_List; -ThreadSafePointerSet D3D8Wrapper::IDirect3DCubeTexture8::m_List; -ThreadSafePointerSet D3D8Wrapper::IDirect3DVertexBuffer8::m_List; -ThreadSafePointerSet D3D8Wrapper::IDirect3DIndexBuffer8::m_List; -ThreadSafePointerSet D3D8Wrapper::IDirect3DSurface8::m_List; -ThreadSafePointerSet D3D8Wrapper::IDirect3DVolume8::m_List; -ThreadSafePointerSet D3D8Wrapper::IDirect3DSwapChain8::m_List; - extern "C" { namespace D3D8Wrapper @@ -109,7 +99,7 @@ extern "C" //TODO - allow bizhawk to handle flipped images.... nonetheless, it might not handle images with unusual pitches, although maybe we should consider that. //so this code will probably remain for quite some time int dest_row = desc.Height - 1; - for (int from_row = 0; from_row < desc.Height; from_row++) + for (UINT from_row = 0; from_row < desc.Height; from_row++) { memcpy((char*)dest + (dest_row * desc.Width*4),(char*)locked.pBits + from_row * locked.Pitch, desc.Width*4); dest_row--; diff --git a/libmupen64plus/D3D8Interceptor/d3d8Wrapper.h b/libmupen64plus/D3D8Interceptor/d3d8Wrapper.h index 56d37c7be2..78fe41bdf1 100644 --- a/libmupen64plus/D3D8Interceptor/d3d8Wrapper.h +++ b/libmupen64plus/D3D8Interceptor/d3d8Wrapper.h @@ -14,8 +14,6 @@ #define LOG(x) #endif -#define TESTDLL_API __declspec(dllexport) - namespace D3D8Base { #include "d3d8base/d3d8.h" @@ -129,10 +127,8 @@ extern "C" /*** IDirect3DUnknown methods ***/ STDMETHOD_(ULONG,Release)(THIS); - IDirect3DDevice8(D3D8Base::IDirect3DDevice8*); - /*** IDirect3DDevice8 methods ***/ STDMETHOD(TestCooperativeLevel)(THIS); STDMETHOD_(UINT, GetAvailableTextureMem)(THIS); @@ -285,16 +281,6 @@ extern "C" inline D3D8Base::IDirect3DBaseTexture8* GetBaseTexture() { return m_pD3D; } - /* - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3D8Base::D3DRESOURCETYPE, GetType)(THIS) PURE; - */ STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew); STDMETHOD_(DWORD, GetLOD)(THIS); STDMETHOD_(DWORD, GetLevelCount)(THIS); @@ -312,20 +298,6 @@ extern "C" static D3D8Wrapper::IDirect3DTexture8* GetTexture(D3D8Base::IDirect3DTexture8*); - /* - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; - STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; - STDMETHOD_(DWORD, GetLOD)(THIS) PURE; - STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; - */ - STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc); STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,D3D8Wrapper::IDirect3DSurface8** ppSurfaceLevel); STDMETHOD(LockRect)(THIS_ UINT Level,D3D8Base::D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags); @@ -344,20 +316,6 @@ extern "C" IDirect3DVolumeTexture8(D3D8Base::IDirect3DVolumeTexture8*); - /* - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; - STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; - STDMETHOD_(DWORD, GetLOD)(THIS) PURE; - STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; - */ - STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3D8Base::D3DVOLUME_DESC *pDesc); STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,D3D8Wrapper::IDirect3DVolume8** ppVolumeLevel); STDMETHOD(LockBox)(THIS_ UINT Level,D3D8Base::D3DLOCKED_BOX* pLockedVolume,CONST D3D8Base::D3DBOX* pBox,DWORD Flags); @@ -376,19 +334,6 @@ extern "C" IDirect3DCubeTexture8(D3D8Base::IDirect3DCubeTexture8*); - /* - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; - STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; - STDMETHOD_(DWORD, GetLOD)(THIS) PURE; - STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; - */ STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc); STDMETHOD(GetCubeMapSurface)(THIS_ D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level,D3D8Wrapper::IDirect3DSurface8** ppCubeMapSurface); STDMETHOD(LockRect)(THIS_ D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level,D3D8Base::D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags); @@ -408,16 +353,6 @@ extern "C" inline D3D8Base::IDirect3DVertexBuffer8* GetVertexBuffer() { return m_pD3D; } - /* - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; - */ STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags); STDMETHOD(Unlock)(THIS); STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DVERTEXBUFFER_DESC *pDesc); @@ -436,16 +371,6 @@ extern "C" inline D3D8Base::IDirect3DIndexBuffer8* GetIndexBuffer() { return m_pD3D; } - /* - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; - */ STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags); STDMETHOD(Unlock)(THIS); STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DINDEXBUFFER_DESC *pDesc); diff --git a/output/dll/d3d8.dll b/output/dll/d3d8.dll index 45b609115789ce994c4b49f2946ccb15bf2dd47c..6d5a97aed9214f332677182dbef29b93a99b18a8 100644 GIT binary patch delta 3856 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 REYMBFS-C3CU%j+i_iutQ(N6#X