From b6cfaf56539cf0fc5a7dc2a552ded30683428c3e Mon Sep 17 00:00:00 2001 From: death2droid Date: Fri, 15 May 2009 12:28:32 +0000 Subject: [PATCH] Added features to hires loading and texture dumping so it now dumps the files into a specific folder like for Mario Party 7 the textures will be dumped into a folder named Mario Party 7. For texture loading it now only checks the folder with the same name as the game. Like same as before moddified texture of Mario Party 7 would go in the folder named Mario Party 7 :P git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3241 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/VideoCommon/Src/HiresTextures.cpp | 10 ++++++++-- Source/Core/VideoCommon/Src/HiresTextures.h | 2 +- .../Plugin_VideoOGL/Src/TextureMngr.cpp | 20 ++++++++++++++++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Source/Core/VideoCommon/Src/HiresTextures.cpp b/Source/Core/VideoCommon/Src/HiresTextures.cpp index 61dbe7b57f..d0526b11e8 100644 --- a/Source/Core/VideoCommon/Src/HiresTextures.cpp +++ b/Source/Core/VideoCommon/Src/HiresTextures.cpp @@ -30,10 +30,16 @@ namespace HiresTextures std::map textureMap; -void Init(const char *gameCode) +void Init(const char *gameCode,const char *gameName) { + static bool bCheckedDir; + CFileSearch::XStringVector Directories; - Directories.push_back(std::string(FULL_HIRES_TEXTURES_DIR)); + //Directories.push_back(std::string(FULL_HIRES_TEXTURES_DIR)); + char szDir[MAX_PATH]; + sprintf(szDir,"%s/%s",FULL_HIRES_TEXTURES_DIR,gameName); + Directories.push_back(std::string(szDir)); + for (u32 i = 0; i < Directories.size(); i++) { diff --git a/Source/Core/VideoCommon/Src/HiresTextures.h b/Source/Core/VideoCommon/Src/HiresTextures.h index 8b5d51fec7..ae2c96e959 100644 --- a/Source/Core/VideoCommon/Src/HiresTextures.h +++ b/Source/Core/VideoCommon/Src/HiresTextures.h @@ -24,7 +24,7 @@ namespace HiresTextures { -void Init(const char *gameCode); +void Init(const char *gameCode,const char *gameName); void Shutdown(); PC_TexFormat GetHiresTex(const char *fileName, int *pWidth, int *pHeight, int texformat, u8 *data); }; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp index 807ad30202..0f9aa7c5c6 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp @@ -160,7 +160,7 @@ void TextureMngr::Init() { temp = (u8*)AllocateMemoryPages(TEMP_SIZE); TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable, g_Config.bTexFmtOverlayCenter); - HiresTextures::Init(((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.GetUniqueID().c_str()); + HiresTextures::Init(((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.GetUniqueID().c_str(),((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.m_strName.c_str()); } void TextureMngr::Invalidate(bool shutdown) @@ -340,6 +340,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width char texPathTemp[MAX_PATH]; int oldWidth = width; int oldHeight = height; + sprintf(texPathTemp, "%s_%08x_%i", ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.GetUniqueID().c_str(), texHash, tex_format); dfmt = HiresTextures::GetHiresTex(texPathTemp, &width, &height, tex_format, temp); @@ -459,9 +460,22 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width if (g_Config.bDumpTextures) // dump texture to file { + char szTemp[MAX_PATH]; - - sprintf(szTemp, "%s/%s_%08x_%i.tga", FULL_DUMP_TEXTURES_DIR, ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.GetUniqueID().c_str(), texHash, tex_format); + char szDir[MAX_PATH]; + static bool bCheckedDir; + int check; + + sprintf(szDir,"%s/%s",FULL_DUMP_TEXTURES_DIR,((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.m_strName.c_str()); + + if(!bCheckedDir) + { + File::CreateDir(szDir); + bCheckedDir = true; + + } + + sprintf(szTemp, "%s/%s_%08x_%i.tga",szDir, ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.GetUniqueID().c_str(), texHash, tex_format); if (!File::Exists(szTemp)) { SaveTexture(szTemp, target, entry.texture, expandedWidth, expandedHeight);