diff options
| author | Lioncash <mathew1800@gmail.com> | 2014-06-03 01:08:54 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2014-06-18 19:53:38 -0400 |
| commit | ce54c1e571a7f79c173dd8f949003255ba95670a (patch) | |
| tree | a8a50407af01bd5da5b9ba122e02a756ac73119d /Source/Core/VideoCommon/TextureCacheBase.cpp | |
| parent | dccd9ead7dd23bf3b463a8e4043bdc63de6a7a9f (diff) | |
Kill off replaceable usages of s[n]printf.
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 33ac8e604b..edb0f49ac2 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -3,9 +3,11 @@ // Refer to the license.txt file included. #include <algorithm> +#include <string> #include "Common/FileUtil.h" #include "Common/MemoryUtil.h" +#include "Common/StringUtil.h" #include "Core/ConfigManager.h" #include "Core/HW/Memmap.h" @@ -227,36 +229,34 @@ bool TextureCache::CheckForCustomTextureLODs(u64 tex_hash, int texformat, unsign return false; // Just checking if the necessary files exist, if they can't be loaded or have incorrect dimensions LODs will be black - char texBasePathTemp[MAX_PATH]; - char texPathTemp[MAX_PATH]; - - sprintf(texBasePathTemp, "%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (tex_hash & 0x00000000FFFFFFFFLL), texformat); + std::string texBasePathTemp = StringFromFormat("%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (tex_hash & 0x00000000FFFFFFFFLL), texformat); for (unsigned int level = 1; level < levels; ++level) { - sprintf(texPathTemp, "%s_mip%u", texBasePathTemp, level); + std::string texPathTemp = StringFromFormat("%s_mip%u", texBasePathTemp.c_str(), level); if (!HiresTextures::HiresTexExists(texPathTemp)) { if (level > 1) - WARN_LOG(VIDEO, "Couldn't find custom texture LOD with index %u (filename: %s), disabling custom LODs for this texture", level, texPathTemp); + WARN_LOG(VIDEO, "Couldn't find custom texture LOD with index %u (filename: %s), disabling custom LODs for this texture", level, texPathTemp.c_str()); return false; } } + return true; } PC_TexFormat TextureCache::LoadCustomTexture(u64 tex_hash, int texformat, unsigned int level, unsigned int& width, unsigned int& height) { - char texPathTemp[MAX_PATH]; + std::string texPathTemp; unsigned int newWidth = 0; unsigned int newHeight = 0; u32 tex_hash_u32 = tex_hash & 0x00000000FFFFFFFFLL; if (level == 0) - sprintf(texPathTemp, "%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), tex_hash_u32, texformat); + texPathTemp = StringFromFormat("%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), tex_hash_u32, texformat); else - sprintf(texPathTemp, "%s_%08x_%i_mip%u", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), tex_hash_u32, texformat, level); + texPathTemp = StringFromFormat("%s_%08x_%i_mip%u", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), tex_hash_u32, texformat, level); unsigned int required_size = 0; PC_TexFormat ret = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, &required_size, texformat, temp_size, temp); @@ -273,11 +273,11 @@ PC_TexFormat TextureCache::LoadCustomTexture(u64 tex_hash, int texformat, unsign if (ret != PC_TEX_FMT_NONE) { if (level > 0 && (newWidth != width || newHeight != height)) - ERROR_LOG(VIDEO, "Invalid custom texture size %dx%d for texture %s. This mipmap layer _must_ be %dx%d.", newWidth, newHeight, texPathTemp, width, height); + ERROR_LOG(VIDEO, "Invalid custom texture size %dx%d for texture %s. This mipmap layer _must_ be %dx%d.", newWidth, newHeight, texPathTemp.c_str(), width, height); if (newWidth * height != newHeight * width) - ERROR_LOG(VIDEO, "Invalid custom texture size %dx%d for texture %s. The aspect differs from the native size %dx%d.", newWidth, newHeight, texPathTemp, width, height); + ERROR_LOG(VIDEO, "Invalid custom texture size %dx%d for texture %s. The aspect differs from the native size %dx%d.", newWidth, newHeight, texPathTemp.c_str(), width, height); if (newWidth % width || newHeight % height) - WARN_LOG(VIDEO, "Invalid custom texture size %dx%d for texture %s. Please use an integer upscaling factor based on the native size %dx%d.", newWidth, newHeight, texPathTemp, width, height); + WARN_LOG(VIDEO, "Invalid custom texture size %dx%d for texture %s. Please use an integer upscaling factor based on the native size %dx%d.", newWidth, newHeight, texPathTemp.c_str(), width, height); width = newWidth; height = newHeight; |
