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
This commit is contained in:
death2droid 2009-05-15 12:28:32 +00:00
parent c684a77394
commit b6cfaf5653
3 changed files with 26 additions and 6 deletions

View File

@ -30,10 +30,16 @@ namespace HiresTextures
std::map<std::string, std::string> textureMap; std::map<std::string, std::string> textureMap;
void Init(const char *gameCode) void Init(const char *gameCode,const char *gameName)
{ {
static bool bCheckedDir;
CFileSearch::XStringVector Directories; 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++) for (u32 i = 0; i < Directories.size(); i++)
{ {

View File

@ -24,7 +24,7 @@
namespace HiresTextures namespace HiresTextures
{ {
void Init(const char *gameCode); void Init(const char *gameCode,const char *gameName);
void Shutdown(); void Shutdown();
PC_TexFormat GetHiresTex(const char *fileName, int *pWidth, int *pHeight, int texformat, u8 *data); PC_TexFormat GetHiresTex(const char *fileName, int *pWidth, int *pHeight, int texformat, u8 *data);
}; };

View File

@ -160,7 +160,7 @@ void TextureMngr::Init()
{ {
temp = (u8*)AllocateMemoryPages(TEMP_SIZE); temp = (u8*)AllocateMemoryPages(TEMP_SIZE);
TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable, g_Config.bTexFmtOverlayCenter); 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) void TextureMngr::Invalidate(bool shutdown)
@ -340,6 +340,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
char texPathTemp[MAX_PATH]; char texPathTemp[MAX_PATH];
int oldWidth = width; int oldWidth = width;
int oldHeight = height; int oldHeight = height;
sprintf(texPathTemp, "%s_%08x_%i", ((struct SConfig *)globals->config)->m_LocalCoreStartupParameter.GetUniqueID().c_str(), texHash, tex_format); 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); 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 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 szTemp[MAX_PATH];
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)) if (!File::Exists(szTemp))
{ {
SaveTexture(szTemp, target, entry.texture, expandedWidth, expandedHeight); SaveTexture(szTemp, target, entry.texture, expandedWidth, expandedHeight);