mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
achievement_menu: replace erroneous quotation marks with apostrophes
This commit is contained in:
parent
27eab0af66
commit
b9bd137659
4 changed files with 42 additions and 1 deletions
|
|
@ -75,7 +75,7 @@ constexpr size_t FirstBitLow(TValue value)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::unique_ptr<uint8_t[]> ReadAllBytes(const char* filePath, size_t& fileSize)
|
inline static std::unique_ptr<uint8_t[]> ReadAllBytes(const char* filePath, size_t& fileSize)
|
||||||
{
|
{
|
||||||
FILE* file = fopen(filePath, "rb");
|
FILE* file = fopen(filePath, "rb");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,36 @@
|
||||||
|
|
||||||
extern XDBFWrapper g_xdbfWrapper;
|
extern XDBFWrapper g_xdbfWrapper;
|
||||||
extern std::unordered_map<uint16_t, GuestTexture*> g_xdbfTextureCache;
|
extern std::unordered_map<uint16_t, GuestTexture*> g_xdbfTextureCache;
|
||||||
|
|
||||||
|
namespace xdbf
|
||||||
|
{
|
||||||
|
inline static std::string& FixInvalidSequences(std::string& str)
|
||||||
|
{
|
||||||
|
static std::vector<std::string> invalidSequences =
|
||||||
|
{
|
||||||
|
"\xE2\x80\x99"
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::vector<std::string> replaceSequences =
|
||||||
|
{
|
||||||
|
"'"
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < invalidSequences.size(); i++)
|
||||||
|
{
|
||||||
|
size_t pos = 0;
|
||||||
|
|
||||||
|
auto& invalidSeq = invalidSequences[i];
|
||||||
|
auto& replaceSeq = replaceSequences[i];
|
||||||
|
|
||||||
|
while ((pos = str.find(invalidSequences[i], pos)) != std::string::npos)
|
||||||
|
{
|
||||||
|
str = str.replace(pos, invalidSeq.length(), replaceSeq);
|
||||||
|
|
||||||
|
pos += replaceSeq.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -794,7 +794,12 @@ void AchievementMenu::Open()
|
||||||
g_achievements.clear();
|
g_achievements.clear();
|
||||||
|
|
||||||
for (auto& achievement : g_xdbfWrapper.GetAchievements((EXDBFLanguage)Config::Language.Value))
|
for (auto& achievement : g_xdbfWrapper.GetAchievements((EXDBFLanguage)Config::Language.Value))
|
||||||
|
{
|
||||||
|
if (Config::Language == ELanguage::English)
|
||||||
|
achievement.Name = xdbf::FixInvalidSequences(achievement.Name);
|
||||||
|
|
||||||
g_achievements.push_back(std::make_tuple(achievement, AchievementData::GetTimestamp(achievement.ID)));
|
g_achievements.push_back(std::make_tuple(achievement, AchievementData::GetTimestamp(achievement.ID)));
|
||||||
|
}
|
||||||
|
|
||||||
std::sort(g_achievements.begin(), g_achievements.end(), [](const auto& a, const auto& b)
|
std::sort(g_achievements.begin(), g_achievements.end(), [](const auto& a, const auto& b)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -178,6 +178,9 @@ void AchievementOverlay::Open(int id)
|
||||||
g_appearTime = ImGui::GetTime();
|
g_appearTime = ImGui::GetTime();
|
||||||
g_achievement = g_xdbfWrapper.GetAchievement((EXDBFLanguage)Config::Language.Value, id);
|
g_achievement = g_xdbfWrapper.GetAchievement((EXDBFLanguage)Config::Language.Value, id);
|
||||||
|
|
||||||
|
if (Config::Language == ELanguage::English)
|
||||||
|
g_achievement.Name = xdbf::FixInvalidSequences(g_achievement.Name);
|
||||||
|
|
||||||
Game_PlaySound("obj_navi_appear");
|
Game_PlaySound("obj_navi_appear");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue