aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/languagehooks.cpp
diff options
context:
space:
mode:
authorNorthstar <northstar@northstar.tf>2022-02-03 22:09:08 -0300
committerBarichello <artur@barichello.me>2022-02-03 22:09:08 -0300
commit75bf194b2fca06de805a7bc025c6dd8379250fa5 (patch)
treec9327ac7921ae80bb2d91381bb7db11b47ca2403 /NorthstarDedicatedTest/languagehooks.cpp
parente9f93ba2e8b9df280aed20131a1606d731d2dbbe (diff)
downloadNorthstarLauncher-75bf194b2fca06de805a7bc025c6dd8379250fa5.tar.gz
NorthstarLauncher-75bf194b2fca06de805a7bc025c6dd8379250fa5.zip
Format project
Diffstat (limited to 'NorthstarDedicatedTest/languagehooks.cpp')
-rw-r--r--NorthstarDedicatedTest/languagehooks.cpp26
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);