diff --git a/desmume/src/OGLRender.cpp b/desmume/src/OGLRender.cpp index bf703e5da..e758bb588 100644 --- a/desmume/src/OGLRender.cpp +++ b/desmume/src/OGLRender.cpp @@ -2981,7 +2981,7 @@ Render3DError OpenGLRenderer_1_2::SetupTexture(const POLY &thePoly, bool enableT if (theTexture->IsLoadNeeded()) { - theTexture->Unpack((u32 *)this->_workingTextureUnpackBuffer); + theTexture->Load(this->_workingTextureUnpackBuffer); const u32 *textureSrc = (u32 *)this->_workingTextureUnpackBuffer; size_t texWidth = theTexture->GetWidth(); @@ -4647,7 +4647,7 @@ Render3DError OpenGLRenderer_2_0::SetupTexture(const POLY &thePoly, bool enableT if (theTexture->IsLoadNeeded()) { - theTexture->Unpack((u32 *)this->_workingTextureUnpackBuffer); + theTexture->Load(this->_workingTextureUnpackBuffer); const u32 *textureSrc = (u32 *)this->_workingTextureUnpackBuffer; size_t texWidth = theTexture->GetWidth(); diff --git a/desmume/src/OGLRender_3_2.cpp b/desmume/src/OGLRender_3_2.cpp index 5626b677a..e4a0f7226 100644 --- a/desmume/src/OGLRender_3_2.cpp +++ b/desmume/src/OGLRender_3_2.cpp @@ -1708,7 +1708,7 @@ Render3DError OpenGLRenderer_3_2::SetupTexture(const POLY &thePoly, bool enableT if (theTexture->IsLoadNeeded()) { - theTexture->Unpack((u32 *)this->_workingTextureUnpackBuffer); + theTexture->Load(this->_workingTextureUnpackBuffer); const u32 *textureSrc = (u32 *)this->_workingTextureUnpackBuffer; const NDSTextureFormat packFormat = theTexture->GetPackFormat(); diff --git a/desmume/src/rasterize.cpp b/desmume/src/rasterize.cpp index faa3eca82..138851d60 100644 --- a/desmume/src/rasterize.cpp +++ b/desmume/src/rasterize.cpp @@ -1170,6 +1170,11 @@ SoftRasterizerTexture::~SoftRasterizerTexture() free_aligned(this->_unpackData); } +void SoftRasterizerTexture::Load(void *targetBuffer) +{ + this->Unpack((u32 *)targetBuffer); +} + u32* SoftRasterizerTexture::GetUnpackData() { return this->_unpackData; @@ -1436,7 +1441,7 @@ void SoftRasterizerRenderer::setupTextures() if (lastTexItem->IsLoadNeeded()) { - lastTexItem->Unpack(lastTexItem->GetUnpackData()); + lastTexItem->Load(lastTexItem->GetUnpackData()); } for (size_t i = 0; i < this->_clippedPolyCount; i++) @@ -1459,7 +1464,7 @@ void SoftRasterizerRenderer::setupTextures() if (lastTexItem->IsLoadNeeded()) { - lastTexItem->Unpack(lastTexItem->GetUnpackData()); + lastTexItem->Load(lastTexItem->GetUnpackData()); } lastTexParams = thePoly.texParam; diff --git a/desmume/src/rasterize.h b/desmume/src/rasterize.h index 1582c2a27..8629b85bb 100644 --- a/desmume/src/rasterize.h +++ b/desmume/src/rasterize.h @@ -54,6 +54,8 @@ public: SoftRasterizerTexture(u32 texAttributes, u32 palAttributes); virtual ~SoftRasterizerTexture(); + virtual void Load(void *targetBuffer); + u32* GetUnpackData(); u32 GetRenderWidth() const; u32 GetRenderHeight() const; diff --git a/desmume/src/texcache.cpp b/desmume/src/texcache.cpp index a8f3534e8..ed45a9f70 100644 --- a/desmume/src/texcache.cpp +++ b/desmume/src/texcache.cpp @@ -655,6 +655,11 @@ void TextureStore::Unpack(u32 *unpackBuffer) this->_isLoadNeeded = false; } +void TextureStore::Load(void *targetBuffer) +{ + this->Unpack((u32 *)targetBuffer); +} + bool TextureStore::IsSuspectedInvalid() const { return this->_suspectedInvalid; diff --git a/desmume/src/texcache.h b/desmume/src/texcache.h index 255558eef..9af1baf7f 100644 --- a/desmume/src/texcache.h +++ b/desmume/src/texcache.h @@ -149,6 +149,8 @@ public: size_t GetUnpackSizeUsingFormat(const TextureStoreUnpackFormat texCacheFormat) const; template void Unpack(u32 *unpackBuffer); + virtual void Load(void *targetBuffer); + bool IsSuspectedInvalid() const; void SetSuspectedInvalid();