From f8885bc12e0f9c295a174319314e37cae310b192 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Thu, 25 Aug 2022 00:27:26 +0100 Subject: Rename `configurables.cpp` to `nsprefix.cpp` (#253) --- NorthstarDLL/NorthstarDLL.vcxproj | 4 ++-- NorthstarDLL/NorthstarDLL.vcxproj.filters | 4 ++-- NorthstarDLL/bansystem.cpp | 2 +- NorthstarDLL/configurables.cpp | 38 ------------------------------- NorthstarDLL/configurables.h | 7 ------ NorthstarDLL/dllmain.cpp | 2 +- NorthstarDLL/logging.cpp | 2 +- NorthstarDLL/modmanager.cpp | 2 +- NorthstarDLL/nsprefix.cpp | 38 +++++++++++++++++++++++++++++++ NorthstarDLL/nsprefix.h | 7 ++++++ NorthstarDLL/serverauthentication.cpp | 2 +- 11 files changed, 54 insertions(+), 54 deletions(-) delete mode 100644 NorthstarDLL/configurables.cpp delete mode 100644 NorthstarDLL/configurables.h create mode 100644 NorthstarDLL/nsprefix.cpp create mode 100644 NorthstarDLL/nsprefix.h diff --git a/NorthstarDLL/NorthstarDLL.vcxproj b/NorthstarDLL/NorthstarDLL.vcxproj index 76560b42..19444e8d 100644 --- a/NorthstarDLL/NorthstarDLL.vcxproj +++ b/NorthstarDLL/NorthstarDLL.vcxproj @@ -127,7 +127,7 @@ - + @@ -580,7 +580,7 @@ - + diff --git a/NorthstarDLL/NorthstarDLL.vcxproj.filters b/NorthstarDLL/NorthstarDLL.vcxproj.filters index b0da9874..d0613408 100644 --- a/NorthstarDLL/NorthstarDLL.vcxproj.filters +++ b/NorthstarDLL/NorthstarDLL.vcxproj.filters @@ -1458,7 +1458,7 @@ Header Files\Shared - + Header Files\Client @@ -1649,7 +1649,7 @@ Source Files\Server - + Source Files\Client diff --git a/NorthstarDLL/bansystem.cpp b/NorthstarDLL/bansystem.cpp index b96e69e3..df98464e 100644 --- a/NorthstarDLL/bansystem.cpp +++ b/NorthstarDLL/bansystem.cpp @@ -4,7 +4,7 @@ #include "concommand.h" #include "miscserverscript.h" #include -#include "configurables.h" +#include "nsprefix.h" #include const char* BANLIST_PATH_SUFFIX = "/banlist.txt"; diff --git a/NorthstarDLL/configurables.cpp b/NorthstarDLL/configurables.cpp deleted file mode 100644 index 389e6e0b..00000000 --- a/NorthstarDLL/configurables.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include "pch.h" -#include "configurables.h" - -std::string GetNorthstarPrefix() -{ - return NORTHSTAR_FOLDER_PREFIX; -} - -void parseConfigurables() -{ - 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"; - } -} diff --git a/NorthstarDLL/configurables.h b/NorthstarDLL/configurables.h deleted file mode 100644 index cc98e15e..00000000 --- a/NorthstarDLL/configurables.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once -#include - -static std::string NORTHSTAR_FOLDER_PREFIX; - -std::string GetNorthstarPrefix(); -void parseConfigurables(); diff --git a/NorthstarDLL/dllmain.cpp b/NorthstarDLL/dllmain.cpp index 273bf9c7..020ab1cd 100644 --- a/NorthstarDLL/dllmain.cpp +++ b/NorthstarDLL/dllmain.cpp @@ -32,7 +32,7 @@ #include "languagehooks.h" #include "audio.h" #include "buildainfile.h" -#include "configurables.h" +#include "nsprefix.h" #include "serverchathooks.h" #include "clientchathooks.h" #include "localchatwriter.h" diff --git a/NorthstarDLL/logging.cpp b/NorthstarDLL/logging.cpp index fe340b29..8c7c82ec 100644 --- a/NorthstarDLL/logging.cpp +++ b/NorthstarDLL/logging.cpp @@ -7,7 +7,7 @@ #include "convar.h" #include #include -#include "configurables.h" +#include "nsprefix.h" #include // This needs to be called after hooks are loaded so we can access the command line args diff --git a/NorthstarDLL/modmanager.cpp b/NorthstarDLL/modmanager.cpp index 3c349d1c..868d6cff 100644 --- a/NorthstarDLL/modmanager.cpp +++ b/NorthstarDLL/modmanager.cpp @@ -15,7 +15,7 @@ #include #include "filesystem.h" #include "rpakfilesystem.h" -#include "configurables.h" +#include "nsprefix.h" ModManager* g_ModManager; diff --git a/NorthstarDLL/nsprefix.cpp b/NorthstarDLL/nsprefix.cpp new file mode 100644 index 00000000..4c165e05 --- /dev/null +++ b/NorthstarDLL/nsprefix.cpp @@ -0,0 +1,38 @@ +#include +#include "pch.h" +#include "nsprefix.h" + +std::string GetNorthstarPrefix() +{ + return NORTHSTAR_FOLDER_PREFIX; +} + +void parseConfigurables() +{ + 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"; + } +} diff --git a/NorthstarDLL/nsprefix.h b/NorthstarDLL/nsprefix.h new file mode 100644 index 00000000..cc98e15e --- /dev/null +++ b/NorthstarDLL/nsprefix.h @@ -0,0 +1,7 @@ +#pragma once +#include + +static std::string NORTHSTAR_FOLDER_PREFIX; + +std::string GetNorthstarPrefix(); +void parseConfigurables(); diff --git a/NorthstarDLL/serverauthentication.cpp b/NorthstarDLL/serverauthentication.cpp index 463bd0ba..9fc41372 100644 --- a/NorthstarDLL/serverauthentication.cpp +++ b/NorthstarDLL/serverauthentication.cpp @@ -13,7 +13,7 @@ #include #include #include -#include "configurables.h" +#include "nsprefix.h" #include "nsmem.h" const char* AUTHSERVER_VERIFY_STRING = "I am a northstar server!"; -- cgit v1.2.3