mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 13:55:38 +00:00
Achievements: Fix badge download bug
Where it would download the incorrect icon if the locked badge was the first image seen.
This commit is contained in:
parent
1003192d7e
commit
a9342195d3
|
@ -312,6 +312,7 @@ std::string Achievements::GetGameHash(CDImage* image)
|
||||||
std::string Achievements::GetLocalImagePath(const std::string_view image_name, int type)
|
std::string Achievements::GetLocalImagePath(const std::string_view image_name, int type)
|
||||||
{
|
{
|
||||||
std::string_view prefix;
|
std::string_view prefix;
|
||||||
|
std::string_view suffix;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case RC_IMAGE_TYPE_GAME:
|
case RC_IMAGE_TYPE_GAME:
|
||||||
|
@ -323,7 +324,14 @@ std::string Achievements::GetLocalImagePath(const std::string_view image_name, i
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RC_IMAGE_TYPE_ACHIEVEMENT: // https://media.retroachievements.org/Badge/{}.png
|
case RC_IMAGE_TYPE_ACHIEVEMENT: // https://media.retroachievements.org/Badge/{}.png
|
||||||
|
prefix = "badge";
|
||||||
|
break;
|
||||||
|
|
||||||
case RC_IMAGE_TYPE_ACHIEVEMENT_LOCKED:
|
case RC_IMAGE_TYPE_ACHIEVEMENT_LOCKED:
|
||||||
|
prefix = "badge";
|
||||||
|
suffix = "_lock";
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
prefix = "badge";
|
prefix = "badge";
|
||||||
break;
|
break;
|
||||||
|
@ -332,8 +340,8 @@ std::string Achievements::GetLocalImagePath(const std::string_view image_name, i
|
||||||
std::string ret;
|
std::string ret;
|
||||||
if (!image_name.empty())
|
if (!image_name.empty())
|
||||||
{
|
{
|
||||||
ret = fmt::format("{}" FS_OSPATH_SEPARATOR_STR "{}" FS_OSPATH_SEPARATOR_STR "{}_{}.png", EmuFolders::Cache,
|
ret = fmt::format("{}" FS_OSPATH_SEPARATOR_STR "{}" FS_OSPATH_SEPARATOR_STR "{}_{}{}.png", EmuFolders::Cache,
|
||||||
CACHE_SUBDIRECTORY_NAME, prefix, Path::SanitizeFileName(image_name));
|
CACHE_SUBDIRECTORY_NAME, prefix, Path::SanitizeFileName(image_name), suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue