summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
diff options
context:
space:
mode:
authorNeoBrainX <NeoBrainX@gmail.com>2012-05-12 13:31:09 +0200
committerNeoBrainX <NeoBrainX@gmail.com>2012-05-13 17:41:03 +0200
commita8ad59ee3e4345b9cc2fcf9bfe28e385a7e443c6 (patch)
treeb5a546ed43f16f051603e0cb65c3805db3b3379e /Source/Core/VideoCommon/Src/TextureCacheBase.cpp
parent3ecc5e879c2ca82a021ca7ebbfd4299d192ba178 (diff)
TextureCacheBase: Move texture dumping to a helper function.
Diffstat (limited to 'Source/Core/VideoCommon/Src/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/TextureCacheBase.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
index 34d4020c86..d01a68954c 100644
--- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp
@@ -195,6 +195,24 @@ PC_TexFormat TextureCache::LoadCustomTexture(u64 tex_hash, int texformat, unsign
return ret;
}
+void TextureCache::DumpTexture(TCacheEntryBase* entry)
+{
+ char szTemp[MAX_PATH];
+ std::string szDir = File::GetUserPath(D_DUMPTEXTURES_IDX) +
+ SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID;
+
+ // make sure that the directory exists
+ if (false == File::Exists(szDir) || false == File::IsDirectory(szDir))
+ File::CreateDir(szDir.c_str());
+
+ sprintf(szTemp, "%s/%s_%08x_%i.png", szDir.c_str(),
+ SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(),
+ (u32) (entry->hash & 0x00000000FFFFFFFFLL), entry->format & 0xFFFF); // TODO: TLUT format should actually be here as well? :/
+
+ if (false == File::Exists(szTemp))
+ entry->Save(szTemp);
+}
+
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)
@@ -379,24 +397,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
}
// TODO: won't this cause loaded hires textures to be dumped as well?
- // dump texture to file
if (g_ActiveConfig.bDumpTextures)
- {
- char szTemp[MAX_PATH];
- std::string szDir = File::GetUserPath(D_DUMPTEXTURES_IDX) +
- SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID;
-
- // make sure that the directory exists
- if (false == File::Exists(szDir) || false == File::IsDirectory(szDir))
- File::CreateDir(szDir.c_str());
-
- sprintf(szTemp, "%s/%s_%08x_%i.png", szDir.c_str(),
- SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(),
- (u32) (tex_hash & 0x00000000FFFFFFFFLL), texformat);
-
- if (false == File::Exists(szTemp))
- entry->Save(szTemp);
- }
+ DumpTexture(entry);
INCSTAT(stats.numTexturesCreated);
SETSTAT(stats.numTexturesAlive, textures.size());