Merge pull request #3459 from JosJuice/custom-texture-all-regions-2

HiresTextures: Refactor getting directory
This commit is contained in:
Mathew Maidment 2016-01-06 14:19:33 -05:00
commit 87e753b104
2 changed files with 10 additions and 9 deletions

View File

@ -87,12 +87,7 @@ void HiresTexture::Update()
}
const std::string& game_id = SConfig::GetInstance().m_strUniqueID;
std::string texture_directory = GetTextureFolder(game_id);
// If there's no directory with the region-specific ID, look for a 3-character region-free one
if (!File::Exists(texture_directory))
texture_directory = GetTextureFolder(game_id.substr(0, 3));
const std::string texture_directory = GetTextureDirectory(game_id);
std::vector<std::string> extensions {
".png",
".bmp",
@ -439,9 +434,15 @@ std::unique_ptr<HiresTexture> HiresTexture::Load(const std::string& base_filenam
return ret;
}
std::string HiresTexture::GetTextureFolder(const std::string& game_id)
std::string HiresTexture::GetTextureDirectory(const std::string& game_id)
{
return File::GetUserPath(D_HIRESTEXTURES_IDX) + game_id;
const std::string texture_directory = File::GetUserPath(D_HIRESTEXTURES_IDX) + game_id;
// If there's no directory with the region-specific ID, look for a 3-character region-free one
if (!File::Exists(texture_directory))
return File::GetUserPath(D_HIRESTEXTURES_IDX) + game_id.substr(0, 3);
return texture_directory;
}
HiresTexture::~HiresTexture()

View File

@ -51,7 +51,7 @@ private:
static std::unique_ptr<HiresTexture> Load(const std::string& base_filename, u32 width, u32 height);
static void Prefetch();
static std::string GetTextureFolder(const std::string& game_id);
static std::string GetTextureDirectory(const std::string& game_id);
HiresTexture() {}