Merge pull request #163 from igor725/features

Fix language detection for trophies
This commit is contained in:
SysRay 2024-05-22 23:00:23 +02:00 committed by GitHub
commit e06f0890b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -168,15 +168,11 @@ class Trophies: public ITrophies {
if (!std::equal(lwfile.begin(), lwfile.end(), name.begin(), name.end(), caseequal)) return ErrCodes::CONTINUE; if (!std::equal(lwfile.begin(), lwfile.end(), name.begin(), name.end(), caseequal)) return ErrCodes::CONTINUE;
} else if (!m_bIgnoreMissingLocale) { } else if (!m_bIgnoreMissingLocale) {
static std::string_view dfile("trop.esfm"); static std::string_view dfile("trop.esfm");
if (m_localizedTrophyFile.length() == 0) { // Trying to find localized trophy
// No localized trophy needed, using the English one if (!std::equal(name.begin(), name.end(), m_localizedTrophyFile.begin(), m_localizedTrophyFile.end(), caseequal)) {
if (!std::equal(name.begin(), name.end(), dfile.begin(), dfile.end(), caseequal)) return ErrCodes::CONTINUE; // Save the default one to `dent` variable. It will be used if no localized trophy configuration file found
} else { if (std::equal(name.begin(), name.end(), dfile.begin(), dfile.end(), caseequal)) dent = ent;
// Trying to find localized trophy return ErrCodes::CONTINUE;
if (!std::equal(name.begin(), name.end(), m_localizedTrophyFile.begin(), m_localizedTrophyFile.end(), caseequal)) {
if (std::equal(name.begin(), name.end(), dfile.begin(), dfile.end(), caseequal)) dent = ent;
return ErrCodes::CONTINUE;
}
} }
} }
@ -499,7 +495,7 @@ class Trophies: public ITrophies {
systemlang = SystemParamLang::EnglishUS; systemlang = SystemParamLang::EnglishUS;
} }
if (systemlang != SystemParamLang::EnglishUS) m_localizedTrophyFile = std::format("TROP_{:02}.ESFM", (uint32_t)systemlang); m_localizedTrophyFile = std::format("TROP_{:02}.ESFM", (uint32_t)systemlang);
} }
m_npidCachePath = accessFileManager().getGameFilesDir() / ".npcommid"; m_npidCachePath = accessFileManager().getGameFilesDir() / ".npcommid";