diff options
Diffstat (limited to 'NorthstarDedicatedTest/languagehooks.cpp')
-rw-r--r-- | NorthstarDedicatedTest/languagehooks.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/NorthstarDedicatedTest/languagehooks.cpp b/NorthstarDedicatedTest/languagehooks.cpp index 3a69df9d..43547e82 100644 --- a/NorthstarDedicatedTest/languagehooks.cpp +++ b/NorthstarDedicatedTest/languagehooks.cpp @@ -10,13 +10,13 @@ namespace fs = std::filesystem; typedef char* (*GetGameLanguageType)(); char* GetGameLanguage(); -typedef LANGID(*Tier0_DetectDefaultLanguageType)(); +typedef LANGID (*Tier0_DetectDefaultLanguageType)(); GetGameLanguageType GetGameLanguageOriginal; bool CheckLangAudioExists(char* lang) { - std::string path{ "r2\\sound\\general_" }; + std::string path{"r2\\sound\\general_"}; path += lang; path += ".mstr"; return fs::exists(path); @@ -32,7 +32,7 @@ std::vector<std::string> file_list(fs::path dir, std::regex ext_pattern) using iterator = fs::directory_iterator; const iterator end; - for (iterator iter{ dir }; iter != end; ++iter) + for (iterator iter{dir}; iter != end; ++iter) { const std::string filename = iter->path().filename().string(); std::smatch matches; @@ -65,7 +65,10 @@ char* GetGameLanguageHook() { if (!CheckLangAudioExists((char*)forcedLanguage)) { - spdlog::info("User tried to force the language (-language) to \"{}\", but audio for this language doesn't exist and the game is bound to error, falling back to next option...", forcedLanguage); + spdlog::info( + "User tried to force the language (-language) to \"{}\", but audio for this language doesn't exist and the game is bound " + "to error, falling back to next option...", + forcedLanguage); } else { @@ -80,9 +83,10 @@ char* GetGameLanguageHook() auto lang = GetGameLanguageOriginal(); if (!CheckLangAudioExists(lang)) { - if (strcmp(lang, "russian") != 0) // don't log for "russian" since it's the default and that means Origin detection just didn't change it most likely - spdlog::info("Origin detected language \"{}\", but we do not have audio for it installed, falling back to the next option", lang); - + if (strcmp(lang, "russian") != + 0) // don't log for "russian" since it's the default and that means Origin detection just didn't change it most likely + spdlog::info( + "Origin detected language \"{}\", but we do not have audio for it installed, falling back to the next option", lang); } else { @@ -91,13 +95,15 @@ char* GetGameLanguageHook() } } - Tier0_DetectDefaultLanguageType(); // force the global in tier0 to be populated with language inferred from user's system rather than defaulting to Russian - canOriginDictateLang = false; // Origin has no say anymore, we will fallback to user's system setup language + Tier0_DetectDefaultLanguageType(); // force the global in tier0 to be populated with language inferred from user's system rather than + // defaulting to Russian + canOriginDictateLang = false; // Origin has no say anymore, we will fallback to user's system setup language auto lang = GetGameLanguageOriginal(); spdlog::info("Detected system language: {}", lang); if (!CheckLangAudioExists(lang)) { - spdlog::warn("Caution, audio for this language does NOT exist. You might want to override your game language with -language command line option."); + spdlog::warn("Caution, audio for this language does NOT exist. You might want to override your game language with -language " + "command line option."); auto lang = GetAnyInstalledAudioLanguage(); spdlog::warn("Falling back to the first installed audio language: {}", lang.c_str()); strncpy(ingameLang1, lang.c_str(), 256); |