N64: Some d3d8 wrapper code cleanup

This commit is contained in:
pjgat09 2014-07-22 01:05:39 +00:00
parent 95583cd518
commit ac52487106
8 changed files with 26 additions and 99 deletions

View File

@ -6,23 +6,10 @@ extern "C"
{
D3D8Wrapper::IDirect3DBaseTexture8::IDirect3DBaseTexture8(D3D8Base::IDirect3DBaseTexture8* pTexture) : IDirect3DResource8((D3D8Base::IDirect3DResource8*) pTexture)
{
LOG("IDirect3DBaseTexture8 -- 1");
LOG("IDirect3DBaseTexture8");
m_pD3D = pTexture;
}
D3D8Wrapper::IDirect3DBaseTexture8::IDirect3DBaseTexture8(D3D8Wrapper::IDirect3DBaseTexture8* pTexture) : IDirect3DResource8((D3D8Wrapper::IDirect3DResource8*) pTexture)
{
LOG("IDirect3DBaseTexture8 -- 2");
m_pD3D = pTexture->getReal2();
}
D3D8Base::IDirect3DBaseTexture8* D3D8Wrapper::IDirect3DBaseTexture8::getReal2()
{
LOG("IDirect3DBaseTexture8::getReal2");
return m_pD3D;
}
/*STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE;*/
STDMETHODIMP_(DWORD) D3D8Wrapper::IDirect3DBaseTexture8::SetLOD(DWORD LODNew)
{

View File

@ -42,12 +42,6 @@ extern "C"
return ulRef;
}
D3D8Base::IDirect3DSurface8* D3D8Wrapper::IDirect3DSurface8::getReal()
{
return m_pD3D;
}
/*STDMETHOD(TestCooperativeLevel)(THIS) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::TestCooperativeLevel()
@ -123,7 +117,7 @@ extern "C"
STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetCursorProperties(UINT XHotSpot,UINT YHotSpot,D3D8Wrapper::IDirect3DSurface8* pCursorBitmap)
{
LOG("SetCursorProperties");
HRESULT hr = m_pDevice->SetCursorProperties(XHotSpot,YHotSpot,pCursorBitmap->GetSurface8());
HRESULT hr = m_pDevice->SetCursorProperties(XHotSpot,YHotSpot,pCursorBitmap->GetSurface());
return hr;
}
@ -374,26 +368,26 @@ extern "C"
{
LOG("CopyRects");
LOG(pSourceSurface);
LOG(pSourceSurface->getReal());
LOG(pSourceSurface->GetSurface());
LOG(pDestinationSurface);
LOG(pDestinationSurface->getReal());
LOG(pDestinationSurface->GetSurface());
if (pSourceSurface->m_ulRef == 0 || (pSourceSurface->GetSurface8()) == (pDestinationSurface->GetSurface8()))
if (pSourceSurface->m_ulRef == 0 || (pSourceSurface->GetSurface()) == (pDestinationSurface->GetSurface()))
{
LOG("WTF");
return D3DERR_INVALIDCALL;
}
HRESULT hr = m_pDevice->CopyRects(pSourceSurface->GetSurface8(),pSourceRectsArray,cRects,pDestinationSurface->GetSurface8(),pDestPointsArray);
HRESULT hr = m_pDevice->CopyRects(pSourceSurface->GetSurface(),pSourceRectsArray,cRects,pDestinationSurface->GetSurface(),pDestPointsArray);
LOG("Back??");
LOG(hr);
LOG(pSourceSurface);
LOG(pSourceSurface->getReal());
LOG(pSourceSurface->GetSurface());
LOG(pDestinationSurface);
LOG(pDestinationSurface->getReal());
LOG(pDestinationSurface->GetSurface());
return hr;
}
@ -401,7 +395,7 @@ extern "C"
STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::UpdateTexture(D3D8Wrapper::IDirect3DBaseTexture8* pSourceTexture,D3D8Wrapper::IDirect3DBaseTexture8* pDestinationTexture)
{
LOG("UpdateTexture");
HRESULT hr = m_pDevice->UpdateTexture(pSourceTexture->getReal2(),pDestinationTexture->getReal2());
HRESULT hr = m_pDevice->UpdateTexture(pSourceTexture->GetBaseTexture(),pDestinationTexture->GetBaseTexture());
return hr;
}
@ -410,7 +404,7 @@ extern "C"
STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::GetFrontBuffer(D3D8Wrapper::IDirect3DSurface8* pDestSurface)
{
LOG("GetFrontBuffer");
HRESULT hr = m_pDevice->GetFrontBuffer(pDestSurface->GetSurface8());
HRESULT hr = m_pDevice->GetFrontBuffer(pDestSurface->GetSurface());
return hr;
}
@ -421,7 +415,7 @@ extern "C"
LOG("SetRenderTarget");
LOG(pRenderTarget);
LOG(pNewZStencil);
HRESULT hr = m_pDevice->SetRenderTarget(pRenderTarget->GetSurface8(),pNewZStencil->GetSurface8());
HRESULT hr = m_pDevice->SetRenderTarget(pRenderTarget->GetSurface(),pNewZStencil->GetSurface());
/*if (this->rTarget != NULL)
{
@ -547,27 +541,8 @@ extern "C"
STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetViewport(CONST D3D8Base::D3DVIEWPORT8* pViewport)
{
LOG("SetViewport");
LOG(pViewport);
if (pViewport != NULL)
{
LOG(pViewport->X);
LOG(pViewport->Y);
LOG(pViewport->Width);
LOG(pViewport->Height);
LOG(pViewport->MinZ);
LOG(pViewport->MaxZ);
}
D3D8Base::D3DVIEWPORT8 blah;
blah.X = 0;
blah.Y = 0;
blah.Width = 800;
blah.Height = 600;
blah.MinZ = 0;
blah.MaxZ = 1;
//HRESULT hr = m_pDevice->SetViewport(pViewport);
HRESULT hr = m_pDevice->SetViewport(&blah);
HRESULT hr = m_pDevice->SetViewport(pViewport);
LOG(hr);
return hr;
}
@ -784,9 +759,9 @@ extern "C"
}
else
{
LOG(pTexture->getReal());
LOG(pTexture->getReal2());
HRESULT hr = m_pDevice->SetTexture(Stage,pTexture->getReal2());
LOG(pTexture->GetResource());
LOG(pTexture->GetBaseTexture());
HRESULT hr = m_pDevice->SetTexture(Stage,pTexture->GetBaseTexture());
return hr;
}
@ -904,7 +879,7 @@ extern "C"
STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,D3D8Wrapper::IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags)
{
LOG("ProcessVertices");
HRESULT hr = m_pDevice->ProcessVertices(SrcStartIndex,DestIndex,VertexCount,pDestBuffer->getReal2(),Flags);
HRESULT hr = m_pDevice->ProcessVertices(SrcStartIndex,DestIndex,VertexCount,pDestBuffer->GetVertexBuffer(),Flags);
return hr;
}
@ -985,7 +960,7 @@ extern "C"
STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetStreamSource(UINT StreamNumber,D3D8Wrapper::IDirect3DVertexBuffer8* pStreamData,UINT Stride)
{
LOG("SetStreamSource");
HRESULT hr = m_pDevice->SetStreamSource(StreamNumber,pStreamData->getReal2(),Stride);
HRESULT hr = m_pDevice->SetStreamSource(StreamNumber,pStreamData->GetVertexBuffer(),Stride);
return hr;
}
@ -1010,7 +985,7 @@ extern "C"
STDMETHODIMP D3D8Wrapper::IDirect3DDevice8::SetIndices(D3D8Wrapper::IDirect3DIndexBuffer8* pIndexData,UINT BaseVertexIndex)
{
LOG("SetIndices");
HRESULT hr = m_pDevice->SetIndices(pIndexData->getReal2(),BaseVertexIndex);
HRESULT hr = m_pDevice->SetIndices(pIndexData->GetIndexBuffer(),BaseVertexIndex);
return hr;
}

View File

@ -10,12 +10,6 @@ extern "C"
m_pD3D = pTexture;
}
D3D8Base::IDirect3DIndexBuffer8* D3D8Wrapper::IDirect3DIndexBuffer8::getReal2()
{
LOG("IDirect3DIndexBuffer8::getReal2");
return m_pD3D;
}
/*STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DIndexBuffer8::Lock(UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags)
{

View File

@ -12,12 +12,6 @@ extern "C"
m_pD3D = pResource;
}
D3D8Wrapper::IDirect3DResource8::IDirect3DResource8(D3D8Wrapper::IDirect3DResource8* pResource) : IDirect3DUnknown((IUnknown*) pResource)
{
LOG("IDirect3DResource8 from wrapped " << pResource << " made " << this);
m_pD3D = pResource->getReal();
}
D3D8Wrapper::IDirect3DResource8* D3D8Wrapper::IDirect3DResource8::GetResource(D3D8Base::IDirect3DResource8* pSwapChain)
{
D3D8Wrapper::IDirect3DResource8* p = (D3D8Wrapper::IDirect3DResource8*) m_List.GetDataPtr(pSwapChain);
@ -49,12 +43,6 @@ extern "C"
return ulRef;
}
D3D8Base::IDirect3DResource8* D3D8Wrapper::IDirect3DResource8::getReal()
{
LOG("IDirect3DResource8::getReal");
return m_pD3D;
}
/*STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DResource8::GetDevice(D3D8Wrapper::IDirect3DDevice8** ppDevice)
{

View File

@ -36,7 +36,7 @@ extern "C"
ULONG ulRef = --m_ulRef;
if(ulRef == 0)
{
m_List.DeleteMember(GetSurface8());
m_List.DeleteMember(GetSurface());
delete this;
return 0;
}

View File

@ -50,7 +50,7 @@ extern "C"
*ppSurfaceLevel = f;
LOG(f);
LOG(f->GetSurface8());
LOG(f->GetSurface());
LOG(hr);
return hr;

View File

@ -10,12 +10,6 @@ extern "C"
m_pD3D = pTexture;
}
D3D8Base::IDirect3DVertexBuffer8* D3D8Wrapper::IDirect3DVertexBuffer8::getReal2()
{
LOG("IDirect3DVertexBuffer8::getReal2");
return m_pD3D;
}
/*STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags) PURE;*/
STDMETHODIMP D3D8Wrapper::IDirect3DVertexBuffer8::Lock(UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags)
{

View File

@ -6,8 +6,8 @@
#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 LOG(x)
#define LOG(x) { std::ofstream myfile; myfile.open ("d3d8_wrapper_log.txt", std::ios::app); myfile << x << "\n"; myfile.close(); }
//#define LOG(x)
#define TESTDLL_API __declspec(dllexport)
@ -260,10 +260,6 @@ extern "C"
IDirect3DResource8(D3D8Base::IDirect3DResource8*);
IDirect3DResource8(D3D8Wrapper::IDirect3DResource8*);
D3D8Base::IDirect3DResource8* getReal();
STDMETHOD(GetDevice)(THIS_ D3D8Wrapper::IDirect3DDevice8** ppDevice);
STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags);
STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData);
@ -285,9 +281,7 @@ extern "C"
IDirect3DBaseTexture8(D3D8Base::IDirect3DBaseTexture8*);
IDirect3DBaseTexture8(D3D8Wrapper::IDirect3DBaseTexture8*);
D3D8Base::IDirect3DBaseTexture8* getReal2();
inline D3D8Base::IDirect3DBaseTexture8* GetBaseTexture() { return m_pD3D; }
/*
STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE;
@ -316,9 +310,6 @@ extern "C"
static D3D8Wrapper::IDirect3DTexture8* GetTexture(D3D8Base::IDirect3DTexture8*);
//D3D8Base::IDirect3DTexture8* getReal2();
/*
STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE;
STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE;
@ -413,7 +404,7 @@ extern "C"
IDirect3DVertexBuffer8(D3D8Base::IDirect3DVertexBuffer8*);
D3D8Base::IDirect3DVertexBuffer8* getReal2();
inline D3D8Base::IDirect3DVertexBuffer8* GetVertexBuffer() { return m_pD3D; }
/*
STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE;
@ -441,7 +432,7 @@ extern "C"
IDirect3DIndexBuffer8(D3D8Base::IDirect3DIndexBuffer8*);
D3D8Base::IDirect3DIndexBuffer8* getReal2();
inline D3D8Base::IDirect3DIndexBuffer8* GetIndexBuffer() { return m_pD3D; }
/*
STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE;
@ -470,13 +461,11 @@ extern "C"
IDirect3DSurface8(D3D8Base::IDirect3DSurface8*);
static IDirect3DSurface8* GetSurface(D3D8Base::IDirect3DSurface8* pSurface);
inline D3D8Base::IDirect3DSurface8* GetSurface8() { return m_pD3D; }
inline D3D8Base::IDirect3DSurface8* GetSurface() { return m_pD3D; }
/*** IDirect3DUnknown methods ***/
STDMETHOD_(ULONG, Release)(THIS);
D3D8Base::IDirect3DSurface8* getReal();
STDMETHOD(GetDevice)(THIS_ D3D8Wrapper::IDirect3DDevice8** ppDevice);
STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags);
STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData);