CustomTextures: Drop format convertion.
This commit is contained in:
parent
71b5519688
commit
0b466249e0
|
@ -38,8 +38,6 @@ const ConfigInfo<bool> GFX_OVERLAY_STATS{{System::GFX, "Settings", "OverlayStats
|
|||
const ConfigInfo<bool> GFX_OVERLAY_PROJ_STATS{{System::GFX, "Settings", "OverlayProjStats"}, false};
|
||||
const ConfigInfo<bool> GFX_DUMP_TEXTURES{{System::GFX, "Settings", "DumpTextures"}, false};
|
||||
const ConfigInfo<bool> GFX_HIRES_TEXTURES{{System::GFX, "Settings", "HiresTextures"}, false};
|
||||
const ConfigInfo<bool> GFX_CONVERT_HIRES_TEXTURES{{System::GFX, "Settings", "ConvertHiresTextures"},
|
||||
false};
|
||||
const ConfigInfo<bool> GFX_CACHE_HIRES_TEXTURES{{System::GFX, "Settings", "CacheHiresTextures"},
|
||||
false};
|
||||
const ConfigInfo<bool> GFX_DUMP_EFB_TARGET{{System::GFX, "Settings", "DumpEFBTarget"}, false};
|
||||
|
|
|
@ -32,7 +32,6 @@ extern const ConfigInfo<bool> GFX_OVERLAY_STATS;
|
|||
extern const ConfigInfo<bool> GFX_OVERLAY_PROJ_STATS;
|
||||
extern const ConfigInfo<bool> GFX_DUMP_TEXTURES;
|
||||
extern const ConfigInfo<bool> GFX_HIRES_TEXTURES;
|
||||
extern const ConfigInfo<bool> GFX_CONVERT_HIRES_TEXTURES;
|
||||
extern const ConfigInfo<bool> GFX_CACHE_HIRES_TEXTURES;
|
||||
extern const ConfigInfo<bool> GFX_DUMP_EFB_TARGET;
|
||||
extern const ConfigInfo<bool> GFX_DUMP_XFB_TARGET;
|
||||
|
|
|
@ -33,7 +33,6 @@ bool IsSettingSaveable(const Config::ConfigLocation& config_location)
|
|||
Config::GFX_SHOW_NETPLAY_MESSAGES.location, Config::GFX_LOG_RENDER_TIME_TO_FILE.location,
|
||||
Config::GFX_OVERLAY_STATS.location, Config::GFX_OVERLAY_PROJ_STATS.location,
|
||||
Config::GFX_DUMP_TEXTURES.location, Config::GFX_HIRES_TEXTURES.location,
|
||||
Config::GFX_CONVERT_HIRES_TEXTURES.location, Config::GFX_CACHE_HIRES_TEXTURES.location,
|
||||
Config::GFX_DUMP_EFB_TARGET.location, Config::GFX_DUMP_FRAMES_AS_IMAGES.location,
|
||||
Config::GFX_FREE_LOOK.location, Config::GFX_USE_FFV1.location,
|
||||
Config::GFX_DUMP_FORMAT.location, Config::GFX_DUMP_CODEC.location,
|
||||
|
|
|
@ -229,7 +229,6 @@ std::string HiresTexture::GenBaseName(const u8* texture, size_t texture_size, co
|
|||
bool has_mipmaps, bool dump)
|
||||
{
|
||||
std::string name = "";
|
||||
bool convert = false;
|
||||
if (!dump && s_check_native_format)
|
||||
{
|
||||
// try to load the old format first
|
||||
|
@ -242,14 +241,11 @@ std::string HiresTexture::GenBaseName(const u8* texture, size_t texture_size, co
|
|||
(u32)(tex_hash ^ tlut_hash), (u16)format);
|
||||
if (s_textureMap.find(name) != s_textureMap.end())
|
||||
{
|
||||
if (g_ActiveConfig.bConvertHiresTextures)
|
||||
convert = true;
|
||||
else
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
if (dump || s_check_new_format || convert)
|
||||
if (dump || s_check_new_format)
|
||||
{
|
||||
// checking for min/max on paletted textures
|
||||
u32 min = 0xffff;
|
||||
|
@ -297,75 +293,6 @@ std::string HiresTexture::GenBaseName(const u8* texture, size_t texture_size, co
|
|||
std::string formatname = StringFromFormat("_%d", static_cast<int>(format));
|
||||
std::string fullname = basename + tlutname + formatname;
|
||||
|
||||
for (int level = 0; level < 10 && convert; level++)
|
||||
{
|
||||
std::string oldname = name;
|
||||
if (level)
|
||||
oldname += StringFromFormat("_mip%d", level);
|
||||
|
||||
// skip not existing levels
|
||||
if (s_textureMap.find(oldname) == s_textureMap.end())
|
||||
continue;
|
||||
|
||||
for (int i = 0;; i++)
|
||||
{
|
||||
// for hash collisions, padd with an integer
|
||||
std::string newname = fullname;
|
||||
if (level)
|
||||
newname += StringFromFormat("_mip%d", level);
|
||||
if (i)
|
||||
newname += StringFromFormat(".%d", i);
|
||||
|
||||
// new texture
|
||||
if (s_textureMap.find(newname) == s_textureMap.end())
|
||||
{
|
||||
std::string src = s_textureMap[oldname].path;
|
||||
size_t postfix = src.find_last_of('.');
|
||||
std::string dst = src.substr(0, postfix - oldname.length()) + newname +
|
||||
src.substr(postfix, src.length() - postfix);
|
||||
if (File::Rename(src, dst))
|
||||
{
|
||||
s_textureMap.erase(oldname);
|
||||
s_textureMap[newname] = {dst, false};
|
||||
s_check_new_format = true;
|
||||
OSD::AddMessage(StringFromFormat("Rename custom texture %s to %s", oldname.c_str(),
|
||||
newname.c_str()),
|
||||
5000);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(VIDEO, "rename failed");
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// dst fail already exist, compare content
|
||||
std::string a, b;
|
||||
File::ReadFileToString(s_textureMap[oldname].path, a);
|
||||
File::ReadFileToString(s_textureMap[newname].path, b);
|
||||
|
||||
if (a == b && a != "")
|
||||
{
|
||||
// equal, so remove
|
||||
if (File::Delete(s_textureMap[oldname].path))
|
||||
{
|
||||
s_textureMap.erase(oldname);
|
||||
OSD::AddMessage(
|
||||
StringFromFormat("Delete double old custom texture %s", oldname.c_str()), 5000);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(VIDEO, "delete failed");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// else continue in this loop with the next higher padding variable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// try to match a wildcard template
|
||||
if (!dump && s_textureMap.find(basename + "_*" + formatname) != s_textureMap.end())
|
||||
return basename + "_*" + formatname;
|
||||
|
|
|
@ -75,7 +75,6 @@ void VideoConfig::Refresh()
|
|||
bOverlayProjStats = Config::Get(Config::GFX_OVERLAY_PROJ_STATS);
|
||||
bDumpTextures = Config::Get(Config::GFX_DUMP_TEXTURES);
|
||||
bHiresTextures = Config::Get(Config::GFX_HIRES_TEXTURES);
|
||||
bConvertHiresTextures = Config::Get(Config::GFX_CONVERT_HIRES_TEXTURES);
|
||||
bCacheHiresTextures = Config::Get(Config::GFX_CACHE_HIRES_TEXTURES);
|
||||
bDumpEFBTarget = Config::Get(Config::GFX_DUMP_EFB_TARGET);
|
||||
bDumpXFBTarget = Config::Get(Config::GFX_DUMP_XFB_TARGET);
|
||||
|
|
|
@ -93,7 +93,6 @@ struct VideoConfig final
|
|||
// Utility
|
||||
bool bDumpTextures;
|
||||
bool bHiresTextures;
|
||||
bool bConvertHiresTextures;
|
||||
bool bCacheHiresTextures;
|
||||
bool bDumpEFBTarget;
|
||||
bool bDumpXFBTarget;
|
||||
|
|
Loading…
Reference in New Issue