summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
diff options
context:
space:
mode:
authorNeoBrainX <NeoBrainX@gmail.com>2012-05-12 13:25:13 +0200
committerNeoBrainX <NeoBrainX@gmail.com>2012-05-13 17:41:03 +0200
commit3ecc5e879c2ca82a021ca7ebbfd4299d192ba178 (patch)
treea82bb72e5a43e114da6716f60374fe55f7f2f45c /Source/Core/VideoCommon/Src/TextureCacheBase.cpp
parentb27f47148809ff027e7bdfef6cd0a16fb69a69eb (diff)
TextureCacheBase: Move custom texture loading to a helper function
Diffstat (limited to 'Source/Core/VideoCommon/Src/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/TextureCacheBase.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
index 00ff9610be..34d4020c86 100644
--- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
@@ -178,6 +178,23 @@ void TextureCache::ClearRenderTargets()
iter->second->type = TCET_NORMAL;
}
+PC_TexFormat TextureCache::LoadCustomTexture(u64 tex_hash, int texformat, unsigned int& width, unsigned int& height, u8* dest)
+{
+ char texPathTemp[MAX_PATH];
+ unsigned int newWidth = 0;
+ unsigned int newHeight = 0;
+
+ sprintf(texPathTemp, "%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (tex_hash & 0x00000000FFFFFFFFLL), texformat);
+ PC_TexFormat ret = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, texformat, dest);
+
+ if (ret != PC_TEX_FMT_NONE)
+ {
+ width = newWidth;
+ height = newHeight;
+ }
+ return ret;
+}
+
TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
u32 address, unsigned int width, unsigned int height, int texformat,
unsigned int tlutaddr, int tlutfmt, bool UseNativeMips, unsigned int maxlevel, bool from_tmem)
@@ -272,21 +289,14 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
}
}
+
if (g_ActiveConfig.bHiresTextures)
{
- // Load Custom textures
- char texPathTemp[MAX_PATH];
-
- unsigned int newWidth = width;
- unsigned int newHeight = height;
-
- sprintf(texPathTemp, "%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (tex_hash & 0x00000000FFFFFFFFLL), texformat);
- pcfmt = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, texformat, temp);
-
+ pcfmt = LoadCustomTexture(tex_hash, texformat, width, height, temp);
if (pcfmt != PC_TEX_FMT_NONE)
{
- expandedWidth = width = newWidth;
- expandedHeight = height = newHeight;
+ expandedWidth = width;
+ expandedHeight = height;
}
}