diff options
author | Emma Miler <emma.pi@protonmail.com> | 2022-12-19 19:32:16 +0100 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-01-04 14:45:48 +0100 |
commit | 27afb0ba38dcf0e74a4d09ba43e73261542b8e96 (patch) | |
tree | 28c737bdecc761fc8ca5257adfafaf2b325e1918 /NorthstarDLL/config | |
parent | af64117f09ba9b70d27c6b6da885d0474180849b (diff) | |
download | NorthstarLauncher-27afb0ba38dcf0e74a4d09ba43e73261542b8e96.tar.gz NorthstarLauncher-27afb0ba38dcf0e74a4d09ba43e73261542b8e96.zip |
Restructuring (#365)
* Remove launcher proxy
* Restructuring
* More restructuring
* Fix include dirs
* Fix merge
* Remove clang thing
* Filters
* Oops
Diffstat (limited to 'NorthstarDLL/config')
-rw-r--r-- | NorthstarDLL/config/profile.cpp | 44 | ||||
-rw-r--r-- | NorthstarDLL/config/profile.h | 7 |
2 files changed, 51 insertions, 0 deletions
diff --git a/NorthstarDLL/config/profile.cpp b/NorthstarDLL/config/profile.cpp new file mode 100644 index 00000000..7518a2b3 --- /dev/null +++ b/NorthstarDLL/config/profile.cpp @@ -0,0 +1,44 @@ +#include "pch.h" +#include "config/profile.h" +#include "dedicated/dedicated.h" +#include <string> + +std::string GetNorthstarPrefix() +{ + return NORTHSTAR_FOLDER_PREFIX; +} + +void InitialiseNorthstarPrefix() +{ + char* clachar = strstr(GetCommandLineA(), "-profile="); + if (clachar) + { + std::string cla = std::string(clachar); + if (strncmp(cla.substr(9, 1).c_str(), "\"", 1)) + { + int space = cla.find(" "); + std::string dirname = cla.substr(9, space - 9); + spdlog::info("Found profile in command line arguments: " + dirname); + NORTHSTAR_FOLDER_PREFIX = dirname; + } + else + { + std::string quote = "\""; + int quote1 = cla.find(quote); + int quote2 = (cla.substr(quote1 + 1)).find(quote); + std::string dirname = cla.substr(quote1 + 1, quote2); + spdlog::info("Found profile in command line arguments: " + dirname); + NORTHSTAR_FOLDER_PREFIX = dirname; + } + } + else + { + spdlog::info("Profile was not found in command line arguments. Using default: R2Northstar"); + NORTHSTAR_FOLDER_PREFIX = "R2Northstar"; + } + + // set the console title to show the current profile + // dont do this on dedi as title contains useful information on dedi and setting title breaks it as well + if (!IsDedicatedServer()) + SetConsoleTitleA((std::string("NorthstarLauncher | ") + NORTHSTAR_FOLDER_PREFIX).c_str()); +} diff --git a/NorthstarDLL/config/profile.h b/NorthstarDLL/config/profile.h new file mode 100644 index 00000000..9f3087fb --- /dev/null +++ b/NorthstarDLL/config/profile.h @@ -0,0 +1,7 @@ +#pragma once +#include <string> + +static std::string NORTHSTAR_FOLDER_PREFIX; + +void InitialiseNorthstarPrefix(); +std::string GetNorthstarPrefix(); |