From 407bcc764731cae00e29c6a00d23ec01fb588d0b Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Fri, 17 Nov 2023 22:06:03 +0100 Subject: [PATCH 01/30] Update link for verified mods JSON file (#600) File was moved with https://github.com/R2Northstar/VerifiedMods/pull/8 --- NorthstarDLL/mods/autodownload/moddownloader.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NorthstarDLL/mods/autodownload/moddownloader.h b/NorthstarDLL/mods/autodownload/moddownloader.h index edaf090bf..ae4f603aa 100644 --- a/NorthstarDLL/mods/autodownload/moddownloader.h +++ b/NorthstarDLL/mods/autodownload/moddownloader.h @@ -4,7 +4,7 @@ class ModDownloader const char* VERIFICATION_FLAG = "-disablemodverification"; const char* CUSTOM_MODS_URL_FLAG = "-customverifiedurl="; const char* STORE_URL = "https://gcdn.thunderstore.io/live/repository/packages/"; - const char* DEFAULT_MODS_LIST_URL = "https://raw.githubusercontent.com/R2Northstar/VerifiedMods/master/mods.json"; + const char* DEFAULT_MODS_LIST_URL = "https://raw.githubusercontent.com/R2Northstar/VerifiedMods/master/verified-mods.json"; char* modsListUrl; struct VerifiedModVersion @@ -83,7 +83,7 @@ class ModDownloader * The Northstar auto-downloading feature does NOT allow automatically installing * all mods for various (notably security) reasons; mods that are candidate to * auto-downloading are rather listed on a GitHub repository - * (https://raw.githubusercontent.com/R2Northstar/VerifiedMods/master/mods.json), + * (https://raw.githubusercontent.com/R2Northstar/VerifiedMods/master/verified-mods.json), * which this method gets via a HTTP call to load into local state. * * If list fetching fails, local mods list will be initialized as empty, thus From 86c20013c85fd70370044d4a13e45436fb5f7069 Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Mon, 20 Nov 2023 23:54:07 +0000 Subject: [PATCH 02/30] Don't log masterserver registration errors in the lobby (#543) The main purpose of this PR is to not flood the console with errors that aren't really errors, thus preventing various tickets or misleading users. --- NorthstarDLL/masterserver/masterserver.cpp | 41 +++++++++++++++------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/NorthstarDLL/masterserver/masterserver.cpp b/NorthstarDLL/masterserver/masterserver.cpp index 64f172c98..21b76f73e 100644 --- a/NorthstarDLL/masterserver/masterserver.cpp +++ b/NorthstarDLL/masterserver/masterserver.cpp @@ -8,6 +8,7 @@ #include "shared/misccommands.h" #include "util/version.h" #include "server/auth/bansystem.h" +#include "dedicated/dedicated.h" #include "rapidjson/document.h" #include "rapidjson/stringbuffer.h" @@ -1128,7 +1129,9 @@ void MasterServerPresenceReporter::RunFrame(double flCurrentTime, const ServerPr if (m_nNumRegistrationAttempts >= MAX_REGISTRATION_ATTEMPTS) { - spdlog::error("Reached max ms server registration attempts."); + spdlog::log( + IsDedicatedServer() ? spdlog::level::level_enum::err : spdlog::level::level_enum::warn, + "Reached max ms server registration attempts."); } } else if (updateServerFuture.valid()) @@ -1181,7 +1184,7 @@ void MasterServerPresenceReporter::InternalAddServer(const ServerPresence* pServ addServerFuture = std::async( std::launch::async, - [threadedPresence, modInfo, hostname] + [threadedPresence, modInfo, hostname, pServerPresence] { CURL* curl = curl_easy_init(); SetCommonHttpClientOptions(curl); @@ -1209,6 +1212,11 @@ void MasterServerPresenceReporter::InternalAddServer(const ServerPresence* pServ return data; }; + // don't log errors if we wouldn't actually show up in the server list anyway (stop tickets) + // except for dedis, for which this error logging is actually pretty important + bool shouldLogError = IsDedicatedServer() || (!strstr(pServerPresence->m_MapName, "mp_lobby") && + strstr(pServerPresence->m_PlaylistName, "private_match")); + curl_mime_data(part, modInfo.c_str(), modInfo.size()); curl_mime_name(part, "modinfo"); curl_mime_filename(part, "modinfo.json"); @@ -1258,22 +1266,27 @@ void MasterServerPresenceReporter::InternalAddServer(const ServerPresence* pServ // No retry. if (serverAddedJson.HasParseError()) { - spdlog::error( - "Failed reading masterserver authentication response: encountered parse error \"{}\"", - rapidjson::GetParseError_En(serverAddedJson.GetParseError())); + if (shouldLogError) + spdlog::error( + "Failed reading masterserver authentication response: encountered parse error \"{}\"", + rapidjson::GetParseError_En(serverAddedJson.GetParseError())); return ReturnCleanup(MasterServerReportPresenceResult::FailedNoRetry); } if (!serverAddedJson.IsObject()) { - spdlog::error("Failed reading masterserver authentication response: root object is not an object"); + if (shouldLogError) + spdlog::error("Failed reading masterserver authentication response: root object is not an object"); return ReturnCleanup(MasterServerReportPresenceResult::FailedNoRetry); } if (serverAddedJson.HasMember("error")) { - spdlog::error("Failed reading masterserver response: got fastify error response"); - spdlog::error(readBuffer); + if (shouldLogError) + { + spdlog::error("Failed reading masterserver response: got fastify error response"); + spdlog::error(readBuffer); + } // If this is DUPLICATE_SERVER, we'll retry adding the server every 20 seconds. // The master server will only update its internal server list and clean up dead servers on certain events. @@ -1282,7 +1295,8 @@ void MasterServerPresenceReporter::InternalAddServer(const ServerPresence* pServ if (serverAddedJson["error"].HasMember("enum") && strcmp(serverAddedJson["error"]["enum"].GetString(), "DUPLICATE_SERVER") == 0) { - spdlog::error("Cooling down while the master server cleans the dead server entry, if any."); + if (shouldLogError) + spdlog::error("Cooling down while the master server cleans the dead server entry, if any."); return ReturnCleanup(MasterServerReportPresenceResult::FailedDuplicateServer); } @@ -1292,14 +1306,16 @@ void MasterServerPresenceReporter::InternalAddServer(const ServerPresence* pServ if (!serverAddedJson["success"].IsTrue()) { - spdlog::error("Adding server to masterserver failed: \"success\" is not true"); + if (shouldLogError) + spdlog::error("Adding server to masterserver failed: \"success\" is not true"); return ReturnCleanup(MasterServerReportPresenceResult::FailedNoRetry); } if (!serverAddedJson.HasMember("id") || !serverAddedJson["id"].IsString() || !serverAddedJson.HasMember("serverAuthToken") || !serverAddedJson["serverAuthToken"].IsString()) { - spdlog::error("Failed reading masterserver response: malformed json object"); + if (shouldLogError) + spdlog::error("Failed reading masterserver response: malformed json object"); return ReturnCleanup(MasterServerReportPresenceResult::FailedNoRetry); } @@ -1311,7 +1327,8 @@ void MasterServerPresenceReporter::InternalAddServer(const ServerPresence* pServ } else { - spdlog::error("Failed adding self to server list: error {}", curl_easy_strerror(result)); + if (shouldLogError) + spdlog::error("Failed adding self to server list: error {}", curl_easy_strerror(result)); return ReturnCleanup(MasterServerReportPresenceResult::FailedNoConnect); } }); From aeecd7a69be8de3afdca124ab624677bfd5582cf Mon Sep 17 00:00:00 2001 From: Cyn <70904206+itscynxx@users.noreply.github.com> Date: Mon, 20 Nov 2023 18:14:37 -0600 Subject: [PATCH 03/30] Add mod versions when logging that a mod has loaded (#596) Prints the version of the mod when loaded succesfully --- NorthstarDLL/mods/modmanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NorthstarDLL/mods/modmanager.cpp b/NorthstarDLL/mods/modmanager.cpp index 8ad832c1d..b7194d046 100644 --- a/NorthstarDLL/mods/modmanager.cpp +++ b/NorthstarDLL/mods/modmanager.cpp @@ -696,9 +696,9 @@ void ModManager::LoadMods() if (mod.m_bWasReadSuccessfully) { if (mod.m_bEnabled) - spdlog::info("'{}' loaded successfully", mod.Name); + spdlog::info("'{}' loaded successfully, version {}", mod.Name, mod.Version); else - spdlog::info("'{}' loaded successfully (DISABLED)", mod.Name); + spdlog::info("'{}' loaded successfully, version {} (DISABLED)", mod.Name, mod.Version); m_LoadedMods.push_back(mod); } From 90e0376ebcc3373d511adf0989f4b63be717d08a Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 22 Nov 2023 02:16:22 +0100 Subject: [PATCH 04/30] Improve replacing `xinput1_3` with `xinput9_1` (#583) The previous logic incorrectly loaded compared the whole argument, which may be a path, to the string literal. This fix checks if the argument ends with the string literal instead. --- NorthstarDLL/core/hooks.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/NorthstarDLL/core/hooks.cpp b/NorthstarDLL/core/hooks.cpp index da7f9f3e5..26b3fe578 100644 --- a/NorthstarDLL/core/hooks.cpp +++ b/NorthstarDLL/core/hooks.cpp @@ -10,6 +10,8 @@ #include #include +#define XINPUT1_3_DLL "XInput1_3.dll" + AUTOHOOK_INIT() // called from the ON_DLL_LOAD macros @@ -393,8 +395,11 @@ HMODULE, WINAPI, (LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)) { HMODULE moduleAddress; + LPCSTR lpLibFileNameEnd = lpLibFileName + strlen(lpLibFileName); + LPCSTR lpLibName = lpLibFileNameEnd - strlen(XINPUT1_3_DLL); + // replace xinput dll with one that has ASLR - if (!strncmp(lpLibFileName, "XInput1_3.dll", 14)) + if (lpLibFileName <= lpLibName && !strncmp(lpLibName, XINPUT1_3_DLL, strlen(XINPUT1_3_DLL) + 1)) { moduleAddress = _LoadLibraryExA("XInput9_1_0.dll", hFile, dwFlags); From 17217a39681c7fed35bee95195bdba7eaf508911 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Tue, 21 Nov 2023 20:17:35 -0500 Subject: [PATCH 05/30] Move player auth to `CServer::ConnectClient` (#548) Fixes bots crashing servers when they are the first to connect to it. Also moves player auth to `CServer::ConnectClient`. This allows the removal of `iNextPlayerUid` and `pNextPlayerToken` which were the cause of issues previously since they were not initialized by bots. --- .../server/auth/serverauthentication.cpp | 89 +++++++++++-------- .../server/auth/serverauthentication.h | 4 +- 2 files changed, 56 insertions(+), 37 deletions(-) diff --git a/NorthstarDLL/server/auth/serverauthentication.cpp b/NorthstarDLL/server/auth/serverauthentication.cpp index d5653dccf..14e166bdd 100644 --- a/NorthstarDLL/server/auth/serverauthentication.cpp +++ b/NorthstarDLL/server/auth/serverauthentication.cpp @@ -25,6 +25,9 @@ AUTOHOOK_INIT() ServerAuthenticationManager* g_pServerAuthentication; CBaseServer__RejectConnectionType CBaseServer__RejectConnection; +typedef void (*CBaseServer__PushDisconnectReasonType)(void*, int32_t, void*, const char*); +CBaseServer__PushDisconnectReasonType CBaseServer__PushDisconnectReason; + void ServerAuthenticationManager::AddRemotePlayer(std::string token, uint64_t uid, std::string username, std::string pdata) { std::string uidS = std::to_string(uid); @@ -101,7 +104,7 @@ bool ServerAuthenticationManager::IsDuplicateAccount(R2::CBaseClient* pPlayer, c return false; } -bool ServerAuthenticationManager::CheckAuthentication(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken) +bool ServerAuthenticationManager::CheckAuthentication(R2::CBaseClient* pPlayer, uint64_t iUid, const char* pAuthToken) { std::string sUid = std::to_string(iUid); @@ -126,7 +129,7 @@ bool ServerAuthenticationManager::CheckAuthentication(R2::CBaseClient* pPlayer, return false; } -void ServerAuthenticationManager::AuthenticatePlayer(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken) +void ServerAuthenticationManager::AuthenticatePlayer(R2::CBaseClient* pPlayer, uint64_t iUid, const char* pAuthToken) { // for bot players, generate a new uid if (pPlayer->m_bFakePlayer) @@ -202,14 +205,9 @@ void ServerAuthenticationManager::WritePersistentData(R2::CBaseClient* pPlayer) // auth hooks -// store these in vars so we can use them in CBaseClient::Connect -// this is fine because ptrs won't decay by the time we use this, just don't use it outside of calls from cbaseclient::connectclient -char* pNextPlayerToken; -uint64_t iNextPlayerUid; - // clang-format off AUTOHOOK(CBaseServer__ConnectClient, engine.dll + 0x114430, -void*,, ( +R2::CBaseClient*,, ( void* self, void* addr, void* a3, @@ -229,51 +227,71 @@ void*,, ( uint32_t a17)) // clang-format on { - // auth tokens are sent with serverfilter, can't be accessed from player struct to my knowledge, so have to do this here - pNextPlayerToken = serverFilter; - iNextPlayerUid = uid; + // try to connect the client to get a client object + R2::CBaseClient* client = + CBaseServer__ConnectClient(self, addr, a3, a4, a5, a6, a7, playerName, serverFilter, a10, a11, a12, a13, a14, uid, a16, a17); + if (!client) + return nullptr; - return CBaseServer__ConnectClient(self, addr, a3, a4, a5, a6, a7, playerName, serverFilter, a10, a11, a12, a13, a14, uid, a16, a17); -} - -ConVar* Cvar_ns_allowuserclantags; - -// clang-format off -AUTOHOOK(CBaseClient__Connect, engine.dll + 0x101740, -bool,, (R2::CBaseClient* self, char* pName, void* pNetChannel, char bFakePlayer, void* a5, char pDisconnectReason[256], void* a7)) -// clang-format on -{ const char* pAuthenticationFailure = nullptr; char pVerifiedName[64]; + const char* authToken = serverFilter; - if (!bFakePlayer) + if (!client->m_bFakePlayer) { - if (!g_pServerAuthentication->VerifyPlayerName(pNextPlayerToken, pName, pVerifiedName)) + if (!g_pServerAuthentication->VerifyPlayerName(authToken, playerName, pVerifiedName)) pAuthenticationFailure = "Invalid Name."; - else if (!g_pBanSystem->IsUIDAllowed(iNextPlayerUid)) + else if (!g_pBanSystem->IsUIDAllowed(uid)) pAuthenticationFailure = "Banned From server."; - else if (!g_pServerAuthentication->CheckAuthentication(self, iNextPlayerUid, pNextPlayerToken)) + else if (!g_pServerAuthentication->CheckAuthentication(client, uid, authToken)) pAuthenticationFailure = "Authentication Failed."; } - else // need to copy name for bots still - strncpy_s(pVerifiedName, pName, 63); + else + { + spdlog::error("A bot called CBaseServer__ConnectClient, should be impossible!"); + + CBaseServer__PushDisconnectReason(self, (int32_t)((uintptr_t)self + 0xc), addr, "A bot was init in CServer__ConnectClient"); + return nullptr; + } if (pAuthenticationFailure) { - spdlog::info("{}'s (uid {}) connection was rejected: \"{}\"", pName, iNextPlayerUid, pAuthenticationFailure); + spdlog::info("{}'s (uid {}) connection was rejected: \"{}\"", playerName, uid, pAuthenticationFailure); - strncpy_s(pDisconnectReason, 256, pAuthenticationFailure, 255); - return false; + CBaseServer__PushDisconnectReason(self, (int32_t)((uintptr_t)self + 0xc), addr, pAuthenticationFailure); + return nullptr; } - // try to actually connect the player - if (!CBaseClient__Connect(self, pVerifiedName, pNetChannel, bFakePlayer, a5, pDisconnectReason, a7)) - return false; + // write name into the client + strncpy_s(pVerifiedName, client->m_Name, 63); // we already know this player's authentication data is legit, actually write it to them now - g_pServerAuthentication->AuthenticatePlayer(self, iNextPlayerUid, pNextPlayerToken); + g_pServerAuthentication->AuthenticatePlayer(client, uid, authToken); + + g_pServerAuthentication->AddPlayer(client, authToken); + g_pServerLimits->AddPlayer(client); +} + +ConVar* Cvar_ns_allowuserclantags; + +// clang-format off +AUTOHOOK(CBaseClient__Connect, engine.dll + 0x101740, +bool,, (R2::CBaseClient* self, char* pName, void* pNetChannel, char bFakePlayer, void* a5, char pDisconnectReason[256], void* a7)) +// clang-format on +{ + // only remains to count bots in player count, + // since bots take player slots and it will give if not counted a false player count on the server browser. + + if (!bFakePlayer) + return CBaseClient__Connect(self, pName, pNetChannel, bFakePlayer, a5, pDisconnectReason, a7); + + // try to actually connect the bot + if (!CBaseClient__Connect(self, pName, pNetChannel, bFakePlayer, a5, pDisconnectReason, a7)) + return false; + + g_pServerAuthentication->AuthenticatePlayer(self, 0, "0"); - g_pServerAuthentication->AddPlayer(self, pNextPlayerToken); + g_pServerAuthentication->AddPlayer(self, "0"); g_pServerLimits->AddPlayer(self); return true; @@ -369,6 +387,7 @@ ON_DLL_LOAD_RELIESON("engine.dll", ServerAuthentication, (ConCommand, ConVar), ( module.Offset(0x101012).Patch("E9 90 00"); CBaseServer__RejectConnection = module.Offset(0x1182E0).RCast(); + CBaseServer__PushDisconnectReason = module.Offset(0x1155D0).RCast(); if (Tier0::CommandLine()->CheckParm("-allowdupeaccounts")) { diff --git a/NorthstarDLL/server/auth/serverauthentication.h b/NorthstarDLL/server/auth/serverauthentication.h index dd0e13af7..34680bd6c 100644 --- a/NorthstarDLL/server/auth/serverauthentication.h +++ b/NorthstarDLL/server/auth/serverauthentication.h @@ -48,9 +48,9 @@ class ServerAuthenticationManager bool VerifyPlayerName(const char* pAuthToken, const char* pName, char pOutVerifiedName[64]); bool IsDuplicateAccount(R2::CBaseClient* pPlayer, const char* pUid); - bool CheckAuthentication(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken); + bool CheckAuthentication(R2::CBaseClient* pPlayer, uint64_t iUid, const char* pAuthToken); - void AuthenticatePlayer(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken); + void AuthenticatePlayer(R2::CBaseClient* pPlayer, uint64_t iUid, const char* pAuthToken); bool RemovePlayerAuthData(R2::CBaseClient* pPlayer); void WritePersistentData(R2::CBaseClient* pPlayer); }; From cfc53081ff38a7a0e29cc0b89644760a7ade33a1 Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 23 Nov 2023 18:53:04 +0100 Subject: [PATCH 06/30] Replace audio event fetching with hook (#603) Takes the previous audio event code, which relied on reading out a register using masm, and replaces it with a new hook. Adapted from NorthstarPrime https://github.com/F1F7Y/NorthstarPrime Co-authored-by: F1F7Y --- NorthstarDLL/CMakeLists.txt | 1 - NorthstarDLL/audio_asm.asm | 8 -------- NorthstarDLL/client/audio.cpp | 33 +++++++++++---------------------- 3 files changed, 11 insertions(+), 31 deletions(-) delete mode 100644 NorthstarDLL/audio_asm.asm diff --git a/NorthstarDLL/CMakeLists.txt b/NorthstarDLL/CMakeLists.txt index 5c275887c..d238f61fe 100644 --- a/NorthstarDLL/CMakeLists.txt +++ b/NorthstarDLL/CMakeLists.txt @@ -148,7 +148,6 @@ add_library(NorthstarDLL SHARED "util/version.h" "util/wininfo.cpp" "util/wininfo.h" - "audio_asm.asm" "dllmain.cpp" "dllmain.h" "ns_version.h" diff --git a/NorthstarDLL/audio_asm.asm b/NorthstarDLL/audio_asm.asm deleted file mode 100644 index 1b2d3f8d4..000000000 --- a/NorthstarDLL/audio_asm.asm +++ /dev/null @@ -1,8 +0,0 @@ -public Audio_GetParentEvent - -.code -Audio_GetParentEvent proc - mov rax, r12 - ret -Audio_GetParentEvent endp -end diff --git a/NorthstarDLL/client/audio.cpp b/NorthstarDLL/client/audio.cpp index 66d344046..aa32e390d 100644 --- a/NorthstarDLL/client/audio.cpp +++ b/NorthstarDLL/client/audio.cpp @@ -10,11 +10,7 @@ AUTOHOOK_INIT() -extern "C" -{ - // should be called only in LoadSampleMetadata_Hook - extern void* __fastcall Audio_GetParentEvent(); -} +static const char* pszAudioEventName; ConVar* Cvar_mileslog_enable; ConVar* Cvar_ns_print_played_sounds; @@ -366,32 +362,16 @@ bool ShouldPlayAudioEvent(const char* eventName, const std::shared_ptrGetInt() > 0) spdlog::info("[AUDIO] Playing event {}", eventName); @@ -490,6 +470,15 @@ bool __declspec(noinline) __fastcall LoadSampleMetadata_Internal( return res; } +// clang-format off +AUTOHOOK(sub_1800294C0, mileswin64.dll + 0x294C0, +void*, __fastcall, (void* a1, void* a2)) +// clang-format on +{ + pszAudioEventName = reinterpret_cast((*((__int64*)a2 + 6))); + return sub_1800294C0(a1, a2); +} + // clang-format off AUTOHOOK(MilesLog, client.dll + 0x57DAD0, void, __fastcall, (int level, const char* string)) From c427fe4abc3df657dd4b924343bc6f464e4cd05e Mon Sep 17 00:00:00 2001 From: Maya <11448698+RoyalBlue1@users.noreply.github.com> Date: Mon, 27 Nov 2023 23:50:38 +0100 Subject: [PATCH 07/30] Load plugin dependencies from lib folder (#590) Disables recursive search for plugins in plugin folders and if it exists adds lib folder within plugin folder to DLL load dirs --- NorthstarDLL/plugins/plugins.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/NorthstarDLL/plugins/plugins.cpp b/NorthstarDLL/plugins/plugins.cpp index 121512e56..d8087e5cb 100644 --- a/NorthstarDLL/plugins/plugins.cpp +++ b/NorthstarDLL/plugins/plugins.cpp @@ -134,7 +134,8 @@ std::optional PluginManager::LoadPlugin(fs::path path, PluginInitFuncs* } // Passed all checks, going to actually load it now - HMODULE pluginLib = LoadLibraryW(wpptr); // Load the DLL as a data file + HMODULE pluginLib = + LoadLibraryExW(wpptr, 0, LOAD_LIBRARY_SEARCH_USER_DIRS | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); // Load the DLL with lib folders if (pluginLib == NULL) { NS::log::PLUGINSYS->info("Failed to load library '{}': ", std::system_category().message(GetLastError())); @@ -197,7 +198,7 @@ inline void FindPlugins(fs::path pluginPath, std::vector& paths) return; } - for (const fs::directory_entry& entry : fs::recursive_directory_iterator(pluginPath)) + for (const fs::directory_entry& entry : fs::directory_iterator(pluginPath)) { if (fs::is_regular_file(entry) && entry.path().extension() == ".dll") paths.emplace_back(entry.path()); @@ -229,6 +230,10 @@ bool PluginManager::LoadPlugins() data.version = ns_version.c_str(); data.northstarModule = g_NorthstarModule; + fs::path libPath = fs::absolute(pluginPath + "\\lib"); + if (fs::exists(libPath) && fs::is_directory(libPath)) + AddDllDirectory(libPath.wstring().c_str()); + FindPlugins(pluginPath, paths); // Special case for Thunderstore mods dir @@ -244,6 +249,11 @@ bool PluginManager::LoadPlugins() spdlog::warn("The following directory did not match 'AUTHOR-MOD-VERSION': {}", dir.path().string()); continue; // skip loading package that doesn't match } + + fs::path libDir = fs::absolute(pluginsDir / "lib"); + if (fs::exists(libDir) && fs::is_directory(libDir)) + AddDllDirectory(libDir.wstring().c_str()); + FindPlugins(pluginsDir, paths); } From da7061a846759cd63dd1907a9df163f4c5b17cf6 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Tue, 28 Nov 2023 00:05:42 +0100 Subject: [PATCH 08/30] Add a safeguard to map command (#564) Adds safeguard to the `map` command that prevents it from executing if the requested map is invalid or no map argument is given. Retry of #529 Co-authored-by: cat_or_not <41955154+catornot@users.noreply.github.com> --- NorthstarDLL/util/printmaps.cpp | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/NorthstarDLL/util/printmaps.cpp b/NorthstarDLL/util/printmaps.cpp index 5b406c4c8..bf9f1dece 100644 --- a/NorthstarDLL/util/printmaps.cpp +++ b/NorthstarDLL/util/printmaps.cpp @@ -31,6 +31,12 @@ struct MapVPKInfo // our current list of maps in the game std::vector vMapList; +typedef void (*Host_Map_helperType)(const CCommand&, void*); +typedef void (*Host_Changelevel_fType)(const CCommand&); + +Host_Map_helperType Host_Map_helper; +Host_Changelevel_fType Host_Changelevel_f; + void RefreshMapList() { // Only update the maps list every 10 seconds max to we avoid constantly reading fs @@ -188,6 +194,30 @@ void ConCommand_maps(const CCommand& args) spdlog::info("({}) {}", PrintMapSource.at(map.source), map.name); } +// clang-format off +AUTOHOOK(Host_Map_f, engine.dll + 0x15B340, void, __fastcall, (const CCommand& args)) +// clang-format on +{ + RefreshMapList(); + + if (args.ArgC() > 1 && + std::find_if(vMapList.begin(), vMapList.end(), [&](MapVPKInfo map) -> bool { return map.name == args.Arg(1); }) == vMapList.end()) + { + spdlog::warn("Map load failed: {} not found or invalid", args.Arg(1)); + return; + } + else if (args.ArgC() == 1) + { + spdlog::warn("Map load failed: no map name provided"); + return; + } + + if (*R2::g_pServerState >= R2::server_state_t::ss_active) + return Host_Changelevel_f(args); + else + return Host_Map_helper(args, nullptr); +} + void InitialiseMapsPrint() { AUTOHOOK_DISPATCH() @@ -195,3 +225,9 @@ void InitialiseMapsPrint() ConCommand* mapsCommand = R2::g_pCVar->FindCommand("maps"); mapsCommand->m_pCommandCallback = ConCommand_maps; } + +ON_DLL_LOAD("engine.dll", Host_Map_f, (CModule module)) +{ + Host_Map_helper = module.Offset(0x15AEF0).RCast(); + Host_Changelevel_f = module.Offset(0x15AAD0).RCast(); +} From a27c702b7d2189f80c5c441eb44a8a5b6922c538 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Fri, 1 Dec 2023 21:31:20 +0100 Subject: [PATCH 09/30] Revert "Move player auth to `CServer::ConnectClient` (#548)" (#610) This reverts commit 17217a39681c7fed35bee95195bdba7eaf508911 (PR #548) which introduced a regression allowing auth to progress further than intended. --- .../server/auth/serverauthentication.cpp | 89 ++++++++----------- .../server/auth/serverauthentication.h | 4 +- 2 files changed, 37 insertions(+), 56 deletions(-) diff --git a/NorthstarDLL/server/auth/serverauthentication.cpp b/NorthstarDLL/server/auth/serverauthentication.cpp index 14e166bdd..d5653dccf 100644 --- a/NorthstarDLL/server/auth/serverauthentication.cpp +++ b/NorthstarDLL/server/auth/serverauthentication.cpp @@ -25,9 +25,6 @@ AUTOHOOK_INIT() ServerAuthenticationManager* g_pServerAuthentication; CBaseServer__RejectConnectionType CBaseServer__RejectConnection; -typedef void (*CBaseServer__PushDisconnectReasonType)(void*, int32_t, void*, const char*); -CBaseServer__PushDisconnectReasonType CBaseServer__PushDisconnectReason; - void ServerAuthenticationManager::AddRemotePlayer(std::string token, uint64_t uid, std::string username, std::string pdata) { std::string uidS = std::to_string(uid); @@ -104,7 +101,7 @@ bool ServerAuthenticationManager::IsDuplicateAccount(R2::CBaseClient* pPlayer, c return false; } -bool ServerAuthenticationManager::CheckAuthentication(R2::CBaseClient* pPlayer, uint64_t iUid, const char* pAuthToken) +bool ServerAuthenticationManager::CheckAuthentication(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken) { std::string sUid = std::to_string(iUid); @@ -129,7 +126,7 @@ bool ServerAuthenticationManager::CheckAuthentication(R2::CBaseClient* pPlayer, return false; } -void ServerAuthenticationManager::AuthenticatePlayer(R2::CBaseClient* pPlayer, uint64_t iUid, const char* pAuthToken) +void ServerAuthenticationManager::AuthenticatePlayer(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken) { // for bot players, generate a new uid if (pPlayer->m_bFakePlayer) @@ -205,9 +202,14 @@ void ServerAuthenticationManager::WritePersistentData(R2::CBaseClient* pPlayer) // auth hooks +// store these in vars so we can use them in CBaseClient::Connect +// this is fine because ptrs won't decay by the time we use this, just don't use it outside of calls from cbaseclient::connectclient +char* pNextPlayerToken; +uint64_t iNextPlayerUid; + // clang-format off AUTOHOOK(CBaseServer__ConnectClient, engine.dll + 0x114430, -R2::CBaseClient*,, ( +void*,, ( void* self, void* addr, void* a3, @@ -227,71 +229,51 @@ R2::CBaseClient*,, ( uint32_t a17)) // clang-format on { - // try to connect the client to get a client object - R2::CBaseClient* client = - CBaseServer__ConnectClient(self, addr, a3, a4, a5, a6, a7, playerName, serverFilter, a10, a11, a12, a13, a14, uid, a16, a17); - if (!client) - return nullptr; + // auth tokens are sent with serverfilter, can't be accessed from player struct to my knowledge, so have to do this here + pNextPlayerToken = serverFilter; + iNextPlayerUid = uid; + return CBaseServer__ConnectClient(self, addr, a3, a4, a5, a6, a7, playerName, serverFilter, a10, a11, a12, a13, a14, uid, a16, a17); +} + +ConVar* Cvar_ns_allowuserclantags; + +// clang-format off +AUTOHOOK(CBaseClient__Connect, engine.dll + 0x101740, +bool,, (R2::CBaseClient* self, char* pName, void* pNetChannel, char bFakePlayer, void* a5, char pDisconnectReason[256], void* a7)) +// clang-format on +{ const char* pAuthenticationFailure = nullptr; char pVerifiedName[64]; - const char* authToken = serverFilter; - if (!client->m_bFakePlayer) + if (!bFakePlayer) { - if (!g_pServerAuthentication->VerifyPlayerName(authToken, playerName, pVerifiedName)) + if (!g_pServerAuthentication->VerifyPlayerName(pNextPlayerToken, pName, pVerifiedName)) pAuthenticationFailure = "Invalid Name."; - else if (!g_pBanSystem->IsUIDAllowed(uid)) + else if (!g_pBanSystem->IsUIDAllowed(iNextPlayerUid)) pAuthenticationFailure = "Banned From server."; - else if (!g_pServerAuthentication->CheckAuthentication(client, uid, authToken)) + else if (!g_pServerAuthentication->CheckAuthentication(self, iNextPlayerUid, pNextPlayerToken)) pAuthenticationFailure = "Authentication Failed."; } - else - { - spdlog::error("A bot called CBaseServer__ConnectClient, should be impossible!"); - - CBaseServer__PushDisconnectReason(self, (int32_t)((uintptr_t)self + 0xc), addr, "A bot was init in CServer__ConnectClient"); - return nullptr; - } + else // need to copy name for bots still + strncpy_s(pVerifiedName, pName, 63); if (pAuthenticationFailure) { - spdlog::info("{}'s (uid {}) connection was rejected: \"{}\"", playerName, uid, pAuthenticationFailure); + spdlog::info("{}'s (uid {}) connection was rejected: \"{}\"", pName, iNextPlayerUid, pAuthenticationFailure); - CBaseServer__PushDisconnectReason(self, (int32_t)((uintptr_t)self + 0xc), addr, pAuthenticationFailure); - return nullptr; + strncpy_s(pDisconnectReason, 256, pAuthenticationFailure, 255); + return false; } - // write name into the client - strncpy_s(pVerifiedName, client->m_Name, 63); - - // we already know this player's authentication data is legit, actually write it to them now - g_pServerAuthentication->AuthenticatePlayer(client, uid, authToken); - - g_pServerAuthentication->AddPlayer(client, authToken); - g_pServerLimits->AddPlayer(client); -} - -ConVar* Cvar_ns_allowuserclantags; - -// clang-format off -AUTOHOOK(CBaseClient__Connect, engine.dll + 0x101740, -bool,, (R2::CBaseClient* self, char* pName, void* pNetChannel, char bFakePlayer, void* a5, char pDisconnectReason[256], void* a7)) -// clang-format on -{ - // only remains to count bots in player count, - // since bots take player slots and it will give if not counted a false player count on the server browser. - - if (!bFakePlayer) - return CBaseClient__Connect(self, pName, pNetChannel, bFakePlayer, a5, pDisconnectReason, a7); - - // try to actually connect the bot - if (!CBaseClient__Connect(self, pName, pNetChannel, bFakePlayer, a5, pDisconnectReason, a7)) + // try to actually connect the player + if (!CBaseClient__Connect(self, pVerifiedName, pNetChannel, bFakePlayer, a5, pDisconnectReason, a7)) return false; - g_pServerAuthentication->AuthenticatePlayer(self, 0, "0"); + // we already know this player's authentication data is legit, actually write it to them now + g_pServerAuthentication->AuthenticatePlayer(self, iNextPlayerUid, pNextPlayerToken); - g_pServerAuthentication->AddPlayer(self, "0"); + g_pServerAuthentication->AddPlayer(self, pNextPlayerToken); g_pServerLimits->AddPlayer(self); return true; @@ -387,7 +369,6 @@ ON_DLL_LOAD_RELIESON("engine.dll", ServerAuthentication, (ConCommand, ConVar), ( module.Offset(0x101012).Patch("E9 90 00"); CBaseServer__RejectConnection = module.Offset(0x1182E0).RCast(); - CBaseServer__PushDisconnectReason = module.Offset(0x1155D0).RCast(); if (Tier0::CommandLine()->CheckParm("-allowdupeaccounts")) { diff --git a/NorthstarDLL/server/auth/serverauthentication.h b/NorthstarDLL/server/auth/serverauthentication.h index 34680bd6c..dd0e13af7 100644 --- a/NorthstarDLL/server/auth/serverauthentication.h +++ b/NorthstarDLL/server/auth/serverauthentication.h @@ -48,9 +48,9 @@ class ServerAuthenticationManager bool VerifyPlayerName(const char* pAuthToken, const char* pName, char pOutVerifiedName[64]); bool IsDuplicateAccount(R2::CBaseClient* pPlayer, const char* pUid); - bool CheckAuthentication(R2::CBaseClient* pPlayer, uint64_t iUid, const char* pAuthToken); + bool CheckAuthentication(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken); - void AuthenticatePlayer(R2::CBaseClient* pPlayer, uint64_t iUid, const char* pAuthToken); + void AuthenticatePlayer(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken); bool RemovePlayerAuthData(R2::CBaseClient* pPlayer); void WritePersistentData(R2::CBaseClient* pPlayer); }; From ad1b6ae61b4f1d9728fc088106ae508b2a23245f Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Mon, 4 Dec 2023 12:20:47 +0100 Subject: [PATCH 10/30] Bump clang format action to 0.16.2 (#609) Current is 0.13 which was released October 2021. This bumps it latest at the time of writing, i.e. 0.16.2 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09af4df79..b40088431 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: DoozyX/clang-format-lint-action@v0.13 + - uses: DoozyX/clang-format-lint-action@v0.16.2 with: source: 'NorthstarDLL NorthstarLauncher' exclude: 'NorthstarDLL/include loader_launcher_proxy loader_wsock32_proxy' From 2a30a0d58e31a6142a6077e7bd9da85d53e7a329 Mon Sep 17 00:00:00 2001 From: uniboi <64006268+uniboi@users.noreply.github.com> Date: Thu, 7 Dec 2023 21:17:50 +0100 Subject: [PATCH 11/30] Add clang-format config to pack constructor initializers (#608) The setting will set each initializer in a new line if all of them don't fit in one line --- .clang-format | 2 ++ .github/workflows/ci.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 0c08cabd6..cb98dfc0e 100644 --- a/.clang-format +++ b/.clang-format @@ -34,3 +34,5 @@ IndentExternBlock: Indent PointerAlignment: Left SortIncludes: false NamespaceIndentation: All +PackConstructorInitializers: NextLine +BreakConstructorInitializersBeforeComma: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b40088431..e4aa37aab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,5 +46,5 @@ jobs: source: 'NorthstarDLL NorthstarLauncher' exclude: 'NorthstarDLL/include loader_launcher_proxy loader_wsock32_proxy' extensions: 'h,cpp' - clangFormatVersion: 13 + clangFormatVersion: 16 style: file From de5a5006f16eb792033dc2ba48b0ec67f180f55b Mon Sep 17 00:00:00 2001 From: Northstar Date: Thu, 7 Dec 2023 21:20:15 +0100 Subject: [PATCH 12/30] Format project --- NorthstarDLL/core/memalloc.h | 2 +- NorthstarDLL/logging/crashhandler.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/NorthstarDLL/core/memalloc.h b/NorthstarDLL/core/memalloc.h index 7df684297..97f60012c 100644 --- a/NorthstarDLL/core/memalloc.h +++ b/NorthstarDLL/core/memalloc.h @@ -1,7 +1,7 @@ #pragma once #include "rapidjson/document.h" -//#include "include/rapidjson/allocators.h" +// #include "include/rapidjson/allocators.h" extern "C" void* _malloc_base(size_t size); extern "C" void* _calloc_base(size_t const count, size_t const size); diff --git a/NorthstarDLL/logging/crashhandler.cpp b/NorthstarDLL/logging/crashhandler.cpp index 5dec315ab..a01de5a1d 100644 --- a/NorthstarDLL/logging/crashhandler.cpp +++ b/NorthstarDLL/logging/crashhandler.cpp @@ -98,8 +98,12 @@ BOOL WINAPI ConsoleCtrlRoutine(DWORD dwCtrlType) // Purpose: Constructor //----------------------------------------------------------------------------- CCrashHandler::CCrashHandler() - : m_hExceptionFilter(nullptr), m_pExceptionInfos(nullptr), m_bHasSetConsolehandler(false), m_bAllExceptionsFatal(false), - m_bHasShownCrashMsg(false), m_bState(false) + : m_hExceptionFilter(nullptr) + , m_pExceptionInfos(nullptr) + , m_bHasSetConsolehandler(false) + , m_bAllExceptionsFatal(false) + , m_bHasShownCrashMsg(false) + , m_bState(false) { Init(); } From 8a4107191b782d087a94511e9fb6f85fcb7c43d9 Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 13 Dec 2023 14:56:23 +0100 Subject: [PATCH 13/30] Disable more compression methods for minizip (#602) Only use the absolute necessary compression methods in order to still allow compilation under Wine. --- cmake/Findminizip.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/Findminizip.cmake b/cmake/Findminizip.cmake index 17489061b..15cfa3732 100644 --- a/cmake/Findminizip.cmake +++ b/cmake/Findminizip.cmake @@ -2,7 +2,13 @@ if(NOT minizip_FOUND) check_init_submodule(${PROJECT_SOURCE_DIR}/thirdparty/minizip) + set(MZ_ZLIB ON CACHE BOOL "Enable ZLIB compression, needed for DEFLATE") + set(MZ_BZIP2 OFF CACHE BOOL "Disable BZIP2 compression") set(MZ_LZMA OFF CACHE BOOL "Disable LZMA & XZ compression") + set(MZ_PKCRYPT OFF CACHE BOOL "Disable PKWARE traditional encryption") + set(MZ_WZAES OFF CACHE BOOL "Disable WinZIP AES encryption") + set(MZ_ZSTD OFF CACHE BOOL "Disable ZSTD compression") + set(MZ_SIGNING OFF CACHE BOOL "Disable zip signing support") add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/minizip minizip) set(minizip_FOUND 1 PARENT_SCOPE) From 0976a3500e6774258322ab2bc80ebd515c175e77 Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:00:26 +0000 Subject: [PATCH 14/30] Rework `-vanilla` to be a vanilla compatibility mode (#601) Old `-vanilla` behaviour is now handled by `-nonorthstardll`. New squirrel constant called `VANILLA`. Set to true when in vanilla compatibility mode. Differences when in vanilla compatibility mode: - Doesn't restrict server commands (same as `-norestrictservercommands`) - Doesn't block FairFight screenshot functions - Doesn't do Atlas-related stuff (except for mainmenupromos) --- NorthstarDLL/client/clientauthhooks.cpp | 11 ++++++- NorthstarDLL/core/vanilla.h | 29 +++++++++++++++++++ NorthstarDLL/dllmain.cpp | 5 ++++ NorthstarDLL/masterserver/masterserver.cpp | 7 +++-- .../shared/exploit_fixes/exploitfixes.cpp | 8 +++++ NorthstarDLL/squirrel/squirrel.cpp | 4 +++ NorthstarLauncher/main.cpp | 2 +- 7 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 NorthstarDLL/core/vanilla.h diff --git a/NorthstarDLL/client/clientauthhooks.cpp b/NorthstarDLL/client/clientauthhooks.cpp index e66da6c8f..adb2ab225 100644 --- a/NorthstarDLL/client/clientauthhooks.cpp +++ b/NorthstarDLL/client/clientauthhooks.cpp @@ -1,6 +1,7 @@ #include "masterserver/masterserver.h" #include "core/convar/convar.h" #include "client/r2client.h" +#include "core/vanilla.h" AUTOHOOK_INIT() @@ -16,6 +17,14 @@ AUTOHOOK(AuthWithStryder, engine.dll + 0x1843A0, void, __fastcall, (void* a1)) // clang-format on { + // don't attempt to do Atlas auth if we are in vanilla compatibility mode + // this prevents users from joining untrustworthy servers (unless they use a concommand or something) + if (g_pVanillaCompatibility->GetVanillaCompatibility()) + { + AuthWithStryder(a1); + return; + } + // game will call this forever, until it gets a valid auth key // so, we need to manually invalidate our key until we're authed with northstar, then we'll allow game to auth with stryder if (!g_pMasterServerManager->m_bOriginAuthWithMasterServerDone && Cvar_ns_has_agreed_to_send_token->GetInt() != DISAGREED_TO_SEND_TOKEN) @@ -39,7 +48,7 @@ AUTOHOOK(Auth3PToken, engine.dll + 0x183760, char*, __fastcall, ()) // clang-format on { - if (g_pMasterServerManager->m_sOwnClientAuthToken[0]) + if (!g_pVanillaCompatibility->GetVanillaCompatibility() && g_pMasterServerManager->m_sOwnClientAuthToken[0]) { memset(p3PToken, 0x0, 1024); strcpy(p3PToken, "Protocol 3: Protect the Pilot"); diff --git a/NorthstarDLL/core/vanilla.h b/NorthstarDLL/core/vanilla.h new file mode 100644 index 000000000..fb809a1aa --- /dev/null +++ b/NorthstarDLL/core/vanilla.h @@ -0,0 +1,29 @@ +#pragma once + +/// Determines if we are in vanilla-compatibility mode. +/// In this mode we shouldn't auth with Atlas, which prevents users from joining a +/// non-trusted server. This means that we can unrestrict client/server commands +/// as well as various other small changes for compatibility +class VanillaCompatibility +{ + public: + void SetVanillaCompatibility(bool isVanilla) + { + static bool bInitialised = false; + if (bInitialised) + return; + + bInitialised = true; + m_bIsVanillaCompatible = isVanilla; + } + + bool GetVanillaCompatibility() + { + return m_bIsVanillaCompatible; + } + + private: + bool m_bIsVanillaCompatible = false; +}; + +inline VanillaCompatibility* g_pVanillaCompatibility; diff --git a/NorthstarDLL/dllmain.cpp b/NorthstarDLL/dllmain.cpp index d82c9ffbb..3d9bdc974 100644 --- a/NorthstarDLL/dllmain.cpp +++ b/NorthstarDLL/dllmain.cpp @@ -2,6 +2,7 @@ #include "logging/logging.h" #include "logging/crashhandler.h" #include "core/memalloc.h" +#include "core/vanilla.h" #include "config/profile.h" #include "plugins/plugin_abi.h" #include "plugins/plugins.h" @@ -53,6 +54,10 @@ bool InitialiseNorthstar() bool bAllFatal = strstr(GetCommandLineA(), "-crash_handle_all") != NULL; g_pCrashHandler->SetAllFatal(bAllFatal); + // determine if we are in vanilla-compatibility mode + g_pVanillaCompatibility = new VanillaCompatibility(); + g_pVanillaCompatibility->SetVanillaCompatibility(strstr(GetCommandLineA(), "-vanilla") != NULL); + // Write launcher version to log StartupLog(); diff --git a/NorthstarDLL/masterserver/masterserver.cpp b/NorthstarDLL/masterserver/masterserver.cpp index 21b76f73e..53a5fa9a8 100644 --- a/NorthstarDLL/masterserver/masterserver.cpp +++ b/NorthstarDLL/masterserver/masterserver.cpp @@ -3,6 +3,7 @@ #include "shared/playlist.h" #include "server/auth/serverauthentication.h" #include "core/tier0.h" +#include "core/vanilla.h" #include "engine/r2engine.h" #include "mods/modmanager.h" #include "shared/misccommands.h" @@ -88,7 +89,7 @@ size_t CurlWriteToStringBufferCallback(char* contents, size_t size, size_t nmemb void MasterServerManager::AuthenticateOriginWithMasterServer(const char* uid, const char* originToken) { - if (m_bOriginAuthWithMasterServerInProgress) + if (m_bOriginAuthWithMasterServerInProgress || g_pVanillaCompatibility->GetVanillaCompatibility()) return; // do this here so it's instantly set @@ -466,7 +467,7 @@ void MasterServerManager::RequestMainMenuPromos() void MasterServerManager::AuthenticateWithOwnServer(const char* uid, const char* playerToken) { // dont wait, just stop if we're trying to do 2 auth requests at once - if (m_bAuthenticatingWithGameServer) + if (m_bAuthenticatingWithGameServer || g_pVanillaCompatibility->GetVanillaCompatibility()) return; m_bAuthenticatingWithGameServer = true; @@ -601,7 +602,7 @@ void MasterServerManager::AuthenticateWithOwnServer(const char* uid, const char* void MasterServerManager::AuthenticateWithServer(const char* uid, const char* playerToken, RemoteServerInfo server, const char* password) { // dont wait, just stop if we're trying to do 2 auth requests at once - if (m_bAuthenticatingWithGameServer) + if (m_bAuthenticatingWithGameServer || g_pVanillaCompatibility->GetVanillaCompatibility()) return; m_bAuthenticatingWithGameServer = true; diff --git a/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp b/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp index 2a0a9c2ca..8821a40df 100644 --- a/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp +++ b/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp @@ -5,6 +5,7 @@ #include "engine/r2engine.h" #include "client/r2client.h" #include "core/math/vector.h" +#include "core/vanilla.h" AUTOHOOK_INIT() @@ -33,6 +34,8 @@ AUTOHOOK(CLC_Screenshot_WriteToBuffer, engine.dll + 0x22AF20, bool, __fastcall, (void* thisptr, void* buffer)) // 48 89 5C 24 ? 57 48 83 EC 20 8B 42 10 // clang-format on { + if (g_pVanillaCompatibility->GetVanillaCompatibility()) + return CLC_Screenshot_WriteToBuffer(thisptr, buffer); return false; } @@ -41,6 +44,8 @@ AUTOHOOK(CLC_Screenshot_ReadFromBuffer, engine.dll + 0x221F00, bool, __fastcall, (void* thisptr, void* buffer)) // 48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 48 8B DA 48 8B 52 38 // clang-format on { + if (g_pVanillaCompatibility->GetVanillaCompatibility()) + return CLC_Screenshot_ReadFromBuffer(thisptr, buffer); return false; } @@ -261,6 +266,9 @@ bool, __fastcall, (const char* pModName)) // 48 83 EC 28 48 8B 0D ? ? ? ? 48 8D R2::g_pModName = new char[iSize + 1]; strcpy(R2::g_pModName, pModName); + if (g_pVanillaCompatibility->GetVanillaCompatibility()) + return false; + return (!strcmp("r2", pModName) || !strcmp("r1", pModName)) && !Tier0::CommandLine()->CheckParm("-norestrictservercommands"); } diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index e43686d71..68fffb9bd 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -9,6 +9,7 @@ #include "plugins/plugin_abi.h" #include "plugins/plugins.h" #include "ns_version.h" +#include "core/vanilla.h" #include @@ -272,6 +273,9 @@ template void SquirrelManager::VMCreated(CSquir defconst(m_pSQVM, "NS_VERSION_PATCH", version[2]); defconst(m_pSQVM, "NS_VERSION_DEV", version[3]); + // define squirrel constant for if we are in vanilla-compatibility mode + defconst(m_pSQVM, "VANILLA", g_pVanillaCompatibility->GetVanillaCompatibility()); + g_pSquirrel->messageBuffer = new SquirrelMessageBuffer(); g_pPluginManager->InformSQVMCreated(context, newSqvm); } diff --git a/NorthstarLauncher/main.cpp b/NorthstarLauncher/main.cpp index ecc18c458..ae7456728 100644 --- a/NorthstarLauncher/main.cpp +++ b/NorthstarLauncher/main.cpp @@ -255,7 +255,7 @@ void PrependPath() bool ShouldLoadNorthstar(int argc, char* argv[]) { for (int i = 0; i < argc; i++) - if (!strcmp(argv[i], "-vanilla")) + if (!strcmp(argv[i], "-nonorthstardll")) return false; auto runNorthstarFile = std::ifstream("run_northstar.txt"); From 43f0bce0596ec60434e48d8037ffed373bc13852 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Thu, 14 Dec 2023 07:07:02 -0500 Subject: [PATCH 15/30] Add plugin dependency constants (#458) Adds dependency constants for plugins so mods can rely on plugins without always producing script errors when the plugin is missing --- NorthstarDLL/mods/modmanager.cpp | 28 ++++++++++++++++++++++++++++ NorthstarDLL/mods/modmanager.h | 4 ++++ NorthstarDLL/plugins/plugins.cpp | 9 +++++++++ NorthstarDLL/squirrel/squirrel.cpp | 7 +++++++ 4 files changed, 48 insertions(+) diff --git a/NorthstarDLL/mods/modmanager.cpp b/NorthstarDLL/mods/modmanager.cpp index b7194d046..982f50682 100644 --- a/NorthstarDLL/mods/modmanager.cpp +++ b/NorthstarDLL/mods/modmanager.cpp @@ -104,6 +104,7 @@ Mod::Mod(fs::path modDir, char* jsonBuf) ParseScripts(modJson); ParseLocalization(modJson); ParseDependencies(modJson); + ParsePluginDependencies(modJson); ParseInitScript(modJson); // A mod is remote if it's located in the remote mods folder @@ -483,6 +484,28 @@ void Mod::ParseDependencies(rapidjson_document& json) } } +void Mod::ParsePluginDependencies(rapidjson_document& json) +{ + if (!json.HasMember("PluginDependencies")) + return; + + if (!json["PluginDependencies"].IsArray()) + { + spdlog::warn("'PluginDependencies' field is not an object, skipping..."); + return; + } + + for (auto& name : json["PluginDependencies"].GetArray()) + { + if (!name.IsString()) + continue; + + spdlog::info("Plugin Constant {} defined by {}", name.GetString(), Name); + + PluginDependencyConstants.push_back(name.GetString()); + } +} + void Mod::ParseInitScript(rapidjson_document& json) { if (!json.HasMember("InitScript")) @@ -688,6 +711,11 @@ void ModManager::LoadMods() m_DependencyConstants.emplace(pair); } + for (std::string& dependency : mod.PluginDependencyConstants) + { + m_PluginDependencyConstants.insert(dependency); + } + if (m_bHasEnabledModsCfg && m_EnabledModsCfg.HasMember(mod.Name.c_str())) mod.m_bEnabled = m_EnabledModsCfg[mod.Name.c_str()].IsTrue(); else diff --git a/NorthstarDLL/mods/modmanager.h b/NorthstarDLL/mods/modmanager.h index 813edec79..c141414f5 100644 --- a/NorthstarDLL/mods/modmanager.h +++ b/NorthstarDLL/mods/modmanager.h @@ -7,6 +7,7 @@ #include #include #include +#include const std::string MOD_FOLDER_SUFFIX = "\\mods"; const std::string THUNDERSTORE_MOD_FOLDER_SUFFIX = "\\packages"; @@ -124,6 +125,7 @@ class Mod // hashed with STR_HASH std::unordered_map DependencyConstants; + std::vector PluginDependencyConstants; public: Mod(fs::path modPath, char* jsonBuf); @@ -134,6 +136,7 @@ class Mod void ParseScripts(rapidjson_document& json); void ParseLocalization(rapidjson_document& json); void ParseDependencies(rapidjson_document& json); + void ParsePluginDependencies(rapidjson_document& json); void ParseInitScript(rapidjson_document& json); }; @@ -160,6 +163,7 @@ class ModManager std::vector m_LoadedMods; std::unordered_map m_ModFiles; std::unordered_map m_DependencyConstants; + std::unordered_set m_PluginDependencyConstants; public: ModManager(); diff --git a/NorthstarDLL/plugins/plugins.cpp b/NorthstarDLL/plugins/plugins.cpp index d8087e5cb..72b645667 100644 --- a/NorthstarDLL/plugins/plugins.cpp +++ b/NorthstarDLL/plugins/plugins.cpp @@ -170,6 +170,15 @@ std::optional PluginManager::LoadPlugin(fs::path path, PluginInitFuncs* plugin.dependencyName = plugin.name; } + if (std::find_if( + plugin.dependencyName.begin(), + plugin.dependencyName.end(), + [&](char c) -> bool { return !((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_'); }) != + plugin.dependencyName.end()) + { + NS::log::PLUGINSYS->warn("Dependency string \"{}\" in {} is not valid a squirrel constant!", plugin.dependencyName, plugin.name); + } + plugin.init_sqvm_client = (PLUGIN_INIT_SQVM_TYPE)GetProcAddress(pluginLib, "PLUGIN_INIT_SQVM_CLIENT"); plugin.init_sqvm_server = (PLUGIN_INIT_SQVM_TYPE)GetProcAddress(pluginLib, "PLUGIN_INIT_SQVM_SERVER"); plugin.inform_sqvm_created = (PLUGIN_INFORM_SQVM_CREATED_TYPE)GetProcAddress(pluginLib, "PLUGIN_INFORM_SQVM_CREATED"); diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index 68fffb9bd..d8eff0d60 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -264,6 +264,13 @@ template void SquirrelManager::VMCreated(CSquir defconst(m_pSQVM, pair.first.c_str(), bWasFound); } + auto loadedPlugins = &g_pPluginManager->m_vLoadedPlugins; + for (const auto& pluginName : g_pModManager->m_PluginDependencyConstants) + { + auto f = [&](Plugin plugin) -> bool { return plugin.dependencyName == pluginName; }; + defconst(m_pSQVM, pluginName.c_str(), std::find_if(loadedPlugins->begin(), loadedPlugins->end(), f) != loadedPlugins->end()); + } + defconst(m_pSQVM, "MAX_FOLDER_SIZE", GetMaxSaveFolderSize() / 1024); // define squirrel constants for northstar(.dll) version From 5a7ad2249b50470a84fc45eac95de2297ecc2da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Raes?= Date: Thu, 14 Dec 2023 22:19:21 +0100 Subject: [PATCH 16/30] Mod download UI integration (#595) UI integration for the mod downloading feature. Feature activation locked behind a convar. --- .../mods/autodownload/moddownloader.cpp | 170 +++++++++++++----- .../mods/autodownload/moddownloader.h | 38 ++-- 2 files changed, 152 insertions(+), 56 deletions(-) diff --git a/NorthstarDLL/mods/autodownload/moddownloader.cpp b/NorthstarDLL/mods/autodownload/moddownloader.cpp index 9c1489c65..165399e38 100644 --- a/NorthstarDLL/mods/autodownload/moddownloader.cpp +++ b/NorthstarDLL/mods/autodownload/moddownloader.cpp @@ -124,19 +124,51 @@ size_t WriteData(void* ptr, size_t size, size_t nmemb, FILE* stream) return written; } -void FetchModSync(std::promise>&& p, std::string_view url, fs::path downloadPath) +int ModDownloader::ModFetchingProgressCallback( + void* ptr, curl_off_t totalDownloadSize, curl_off_t finishedDownloadSize, curl_off_t totalToUpload, curl_off_t nowUploaded) { + if (totalDownloadSize != 0 && finishedDownloadSize != 0) + { + ModDownloader* instance = static_cast(ptr); + auto currentDownloadProgress = roundf(static_cast(finishedDownloadSize) / totalDownloadSize * 100); + instance->modState.progress = finishedDownloadSize; + instance->modState.total = totalDownloadSize; + instance->modState.ratio = currentDownloadProgress; + } + + return 0; +} + +std::optional ModDownloader::FetchModFromDistantStore(std::string_view modName, std::string_view modVersion) +{ + // Retrieve mod prefix from local mods list, or use mod name as mod prefix if bypass flag is set + std::string modPrefix = strstr(GetCommandLineA(), VERIFICATION_FLAG) ? modName.data() : verifiedMods[modName.data()].dependencyPrefix; + // Build archive distant URI + std::string archiveName = std::format("{}-{}.zip", modPrefix, modVersion.data()); + std::string url = STORE_URL + archiveName; + spdlog::info(std::format("Fetching mod archive from {}", url)); + + // Download destination + std::filesystem::path downloadPath = std::filesystem::temp_directory_path() / archiveName; + spdlog::info(std::format("Downloading archive to {}", downloadPath.generic_string())); + + // Update state + modState.state = DOWNLOADING; + + // Download the actual archive bool failed = false; FILE* fp = fopen(downloadPath.generic_string().c_str(), "wb"); CURLcode result; CURL* easyhandle; easyhandle = curl_easy_init(); - curl_easy_setopt(easyhandle, CURLOPT_TIMEOUT, 30L); curl_easy_setopt(easyhandle, CURLOPT_URL, url.data()); curl_easy_setopt(easyhandle, CURLOPT_FAILONERROR, 1L); curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, fp); curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION, WriteData); + curl_easy_setopt(easyhandle, CURLOPT_NOPROGRESS, 0L); + curl_easy_setopt(easyhandle, CURLOPT_XFERINFOFUNCTION, ModDownloader::ModFetchingProgressCallback); + curl_easy_setopt(easyhandle, CURLOPT_XFERINFODATA, this); result = curl_easy_perform(easyhandle); if (result == CURLcode::CURLE_OK) @@ -154,28 +186,7 @@ void FetchModSync(std::promise>&& p, std::string_view ur REQUEST_END_CLEANUP: curl_easy_cleanup(easyhandle); fclose(fp); - p.set_value(failed ? std::optional() : std::optional(downloadPath)); -} - -std::optional ModDownloader::FetchModFromDistantStore(std::string_view modName, std::string_view modVersion) -{ - // Retrieve mod prefix from local mods list, or use mod name as mod prefix if bypass flag is set - std::string modPrefix = strstr(GetCommandLineA(), VERIFICATION_FLAG) ? modName.data() : verifiedMods[modName.data()].dependencyPrefix; - // Build archive distant URI - std::string archiveName = std::format("{}-{}.zip", modPrefix, modVersion.data()); - std::string url = STORE_URL + archiveName; - spdlog::info(std::format("Fetching mod archive from {}", url)); - - // Download destination - std::filesystem::path downloadPath = std::filesystem::temp_directory_path() / archiveName; - spdlog::info(std::format("Downloading archive to {}", downloadPath.generic_string())); - - // Download the actual archive - std::promise> promise; - auto f = promise.get_future(); - std::thread t(&FetchModSync, std::move(promise), std::string_view(url), downloadPath); - t.join(); - return f.get(); + return failed ? std::optional() : std::optional(downloadPath); } bool ModDownloader::IsModLegit(fs::path modPath, std::string_view expectedChecksum) @@ -186,6 +197,9 @@ bool ModDownloader::IsModLegit(fs::path modPath, std::string_view expectedChecks return true; } + // Update state + modState.state = CHECKSUMING; + NTSTATUS status; BCRYPT_ALG_HANDLE algorithmHandle = NULL; BCRYPT_HASH_HANDLE hashHandle = NULL; @@ -207,6 +221,7 @@ bool ModDownloader::IsModLegit(fs::path modPath, std::string_view expectedChecks BCRYPT_HASH_REUSABLE_FLAG); // Flags; Loads a provider which supports reusable hash if (!NT_SUCCESS(status)) { + modState.state = MOD_CORRUPTED; goto cleanup; } @@ -221,6 +236,7 @@ bool ModDownloader::IsModLegit(fs::path modPath, std::string_view expectedChecks if (!NT_SUCCESS(status)) { // goto cleanup; + modState.state = MOD_CORRUPTED; return false; } @@ -235,6 +251,7 @@ bool ModDownloader::IsModLegit(fs::path modPath, std::string_view expectedChecks 0); // Flags if (!NT_SUCCESS(status)) { + modState.state = MOD_CORRUPTED; goto cleanup; } @@ -242,6 +259,7 @@ bool ModDownloader::IsModLegit(fs::path modPath, std::string_view expectedChecks if (!fp.is_open()) { spdlog::error("Unable to open archive."); + modState.state = FAILED_READING_ARCHIVE; return false; } fp.seekg(0, fp.beg); @@ -254,6 +272,7 @@ bool ModDownloader::IsModLegit(fs::path modPath, std::string_view expectedChecks status = BCryptHashData(hashHandle, (PBYTE)buffer.data(), bytesRead, 0); if (!NT_SUCCESS(status)) { + modState.state = MOD_CORRUPTED; goto cleanup; } } @@ -269,6 +288,7 @@ bool ModDownloader::IsModLegit(fs::path modPath, std::string_view expectedChecks 0); // Flags if (!NT_SUCCESS(status)) { + modState.state = MOD_CORRUPTED; goto cleanup; } @@ -316,6 +336,30 @@ bool ModDownloader::IsModAuthorized(std::string_view modName, std::string_view m return versions.count(modVersion.data()) != 0; } +int GetModArchiveSize(unzFile file, unz_global_info64 info) +{ + int totalSize = 0; + + for (int i = 0; i < info.number_entry; i++) + { + char zipFilename[256]; + unz_file_info64 fileInfo; + unzGetCurrentFileInfo64(file, &fileInfo, zipFilename, sizeof(zipFilename), NULL, 0, NULL, 0); + + totalSize += fileInfo.uncompressed_size; + + if ((i + 1) < info.number_entry) + { + unzGoToNextFile(file); + } + } + + // Reset file pointer for archive extraction + unzGoToFirstFile(file); + + return totalSize; +} + void ModDownloader::ExtractMod(fs::path modPath) { unzFile file; @@ -326,6 +370,7 @@ void ModDownloader::ExtractMod(fs::path modPath) if (file == NULL) { spdlog::error("Cannot open archive located at {}.", modPath.generic_string()); + modState.state = FAILED_READING_ARCHIVE; goto EXTRACTION_CLEANUP; } @@ -335,9 +380,15 @@ void ModDownloader::ExtractMod(fs::path modPath) if (status != UNZ_OK) { spdlog::error("Failed getting information from archive (error code: {})", status); + modState.state = FAILED_READING_ARCHIVE; goto EXTRACTION_CLEANUP; } + // Update state + modState.state = EXTRACTING; + modState.total = GetModArchiveSize(file, gi); + modState.progress = 0; + // Mod directory name (removing the ".zip" fom the archive name) name = modPath.filename().string(); name = name.substr(0, name.length() - 4); @@ -362,6 +413,7 @@ void ModDownloader::ExtractMod(fs::path modPath) if (!std::filesystem::create_directories(fileDestination.parent_path(), ec) && ec.value() != 0) { spdlog::error("Parent directory ({}) creation failed.", fileDestination.parent_path().generic_string()); + modState.state = FAILED_WRITING_TO_DISK; goto EXTRACTION_CLEANUP; } } @@ -373,6 +425,7 @@ void ModDownloader::ExtractMod(fs::path modPath) if (!std::filesystem::create_directory(fileDestination, ec) && ec.value() != 0) { spdlog::error("Directory creation failed: {}", ec.message()); + modState.state = FAILED_WRITING_TO_DISK; goto EXTRACTION_CLEANUP; } } @@ -383,6 +436,7 @@ void ModDownloader::ExtractMod(fs::path modPath) if (unzLocateFile(file, zipFilename, 0) != UNZ_OK) { spdlog::error("File \"{}\" was not found in archive.", zipFilename); + modState.state = FAILED_READING_ARCHIVE; goto EXTRACTION_CLEANUP; } @@ -397,6 +451,7 @@ void ModDownloader::ExtractMod(fs::path modPath) if (status != UNZ_OK) { spdlog::error("Could not open file {} from archive.", zipFilename); + modState.state = FAILED_READING_ARCHIVE; goto EXTRACTION_CLEANUP; } @@ -405,6 +460,7 @@ void ModDownloader::ExtractMod(fs::path modPath) if (fout == NULL) { spdlog::error("Failed creating destination file."); + modState.state = FAILED_WRITING_TO_DISK; goto EXTRACTION_CLEANUP; } @@ -413,6 +469,7 @@ void ModDownloader::ExtractMod(fs::path modPath) if (buffer == NULL) { spdlog::error("Error while allocating memory."); + modState.state = FAILED_WRITING_TO_DISK; goto EXTRACTION_CLEANUP; } @@ -434,11 +491,16 @@ void ModDownloader::ExtractMod(fs::path modPath) break; } } + + // Update extraction stats + modState.progress += bufferSize; + modState.ratio = roundf(static_cast(modState.progress) / modState.total * 100); } while (err > 0); if (err != UNZ_OK) { spdlog::error("An error occurred during file extraction (code: {})", err); + modState.state = FAILED_WRITING_TO_DISK; goto EXTRACTION_CLEANUP; } err = unzCloseCurrentFile(file); @@ -492,12 +554,14 @@ void ModDownloader::DownloadMod(std::string modName, std::string modVersion) if (!fetchingResult.has_value()) { spdlog::error("Something went wrong while fetching archive, aborting."); + modState.state = MOD_FETCHING_FAILED; goto REQUEST_END_CLEANUP; } archiveLocation = fetchingResult.value(); if (!IsModLegit(archiveLocation, std::string_view(expectedHash))) { spdlog::warn("Archive hash does not match expected checksum, aborting."); + modState.state = MOD_CORRUPTED; goto REQUEST_END_CLEANUP; } @@ -514,39 +578,61 @@ void ModDownloader::DownloadMod(std::string modName, std::string modVersion) spdlog::error("Error while removing downloaded archive: {}", a.what()); } + modState.state = DONE; spdlog::info("Done downloading {}.", modName); }); requestThread.detach(); } -void ConCommandFetchVerifiedMods(const CCommand& args) +ON_DLL_LOAD_RELIESON("engine.dll", ModDownloader, (ConCommand), (CModule module)) { + g_pModDownloader = new ModDownloader(); g_pModDownloader->FetchModsListFromAPI(); } -void ConCommandDownloadMod(const CCommand& args) +ADD_SQFUNC( + "bool", NSIsModDownloadable, "string name, string version", "", ScriptContext::SERVER | ScriptContext::CLIENT | ScriptContext::UI) { - if (args.ArgC() < 3) - { - return; - } + g_pSquirrel->newarray(sqvm, 0); - // Split arguments string by whitespaces (https://stackoverflow.com/a/5208977) - std::string buffer; - std::stringstream ss(args.ArgS()); - std::vector tokens; - while (ss >> buffer) - tokens.push_back(buffer); + const SQChar* modName = g_pSquirrel->getstring(sqvm, 1); + const SQChar* modVersion = g_pSquirrel->getstring(sqvm, 2); - std::string modName = tokens[0]; - std::string modVersion = tokens[1]; + bool result = g_pModDownloader->IsModAuthorized(modName, modVersion); + g_pSquirrel->pushbool(sqvm, result); + + return SQRESULT_NOTNULL; +} + +ADD_SQFUNC("void", NSDownloadMod, "string name, string version", "", ScriptContext::SERVER | ScriptContext::CLIENT | ScriptContext::UI) +{ + const SQChar* modName = g_pSquirrel->getstring(sqvm, 1); + const SQChar* modVersion = g_pSquirrel->getstring(sqvm, 2); g_pModDownloader->DownloadMod(modName, modVersion); + + return SQRESULT_NOTNULL; } -ON_DLL_LOAD_RELIESON("engine.dll", ModDownloader, (ConCommand), (CModule module)) +ADD_SQFUNC("ModInstallState", NSGetModInstallState, "", "", ScriptContext::SERVER | ScriptContext::CLIENT | ScriptContext::UI) { - g_pModDownloader = new ModDownloader(); - RegisterConCommand("fetch_verified_mods", ConCommandFetchVerifiedMods, "fetches verified mods list from GitHub repository", FCVAR_NONE); - RegisterConCommand("download_mod", ConCommandDownloadMod, "downloads a mod from remote store", FCVAR_NONE); + g_pSquirrel->pushnewstructinstance(sqvm, 4); + + // state + g_pSquirrel->pushinteger(sqvm, g_pModDownloader->modState.state); + g_pSquirrel->sealstructslot(sqvm, 0); + + // progress + g_pSquirrel->pushinteger(sqvm, g_pModDownloader->modState.progress); + g_pSquirrel->sealstructslot(sqvm, 1); + + // total + g_pSquirrel->pushinteger(sqvm, g_pModDownloader->modState.total); + g_pSquirrel->sealstructslot(sqvm, 2); + + // ratio + g_pSquirrel->pushfloat(sqvm, g_pModDownloader->modState.ratio); + g_pSquirrel->sealstructslot(sqvm, 3); + + return SQRESULT_NOTNULL; } diff --git a/NorthstarDLL/mods/autodownload/moddownloader.h b/NorthstarDLL/mods/autodownload/moddownloader.h index ae4f603aa..747b3c01d 100644 --- a/NorthstarDLL/mods/autodownload/moddownloader.h +++ b/NorthstarDLL/mods/autodownload/moddownloader.h @@ -18,6 +18,16 @@ class ModDownloader }; std::unordered_map verifiedMods = {}; + /** + * Mod archive download callback. + * + * This function is called by curl as it's downloading the mod archive; this + * will retrieve the current `ModDownloader` instance and update its `modState` + * member accordingly. + */ + static int ModFetchingProgressCallback( + void* ptr, curl_off_t totalDownloadSize, curl_off_t finishedDownloadSize, curl_off_t totalToUpload, curl_off_t nowUploaded); + /** * Downloads a mod archive from distant store. * @@ -35,20 +45,6 @@ class ModDownloader */ std::optional FetchModFromDistantStore(std::string_view modName, std::string_view modVersion); - /** - * Checks whether a mod is verified. - * - * A mod is deemed verified/authorized through a manual validation process that is - * described here: https://github.com/R2Northstar/VerifiedMods; in practice, a mod - * is considered authorized if their name AND exact version appear in the - * `verifiedMods` variable. - * - * @param modName name of the mod to be checked - * @param modVersion version of the mod to be checked, must follow semantic versioning - * @returns whether the mod is authorized and can be auto-downloaded - */ - bool IsModAuthorized(std::string_view modName, std::string_view modVersion); - /** * Tells if a mod archive has not been corrupted. * @@ -93,6 +89,20 @@ class ModDownloader */ void FetchModsListFromAPI(); + /** + * Checks whether a mod is verified. + * + * A mod is deemed verified/authorized through a manual validation process that is + * described here: https://github.com/R2Northstar/VerifiedMods; in practice, a mod + * is considered authorized if their name AND exact version appear in the + * `verifiedMods` variable. + * + * @param modName name of the mod to be checked + * @param modVersion version of the mod to be checked, must follow semantic versioning + * @returns whether the mod is authorized and can be auto-downloaded + */ + bool IsModAuthorized(std::string_view modName, std::string_view modVersion); + /** * Downloads a given mod from Thunderstore API to local game profile. * From 210dab2b0e5c686829bafdc857d2910f6b216b85 Mon Sep 17 00:00:00 2001 From: EladNLG Date: Thu, 14 Dec 2023 23:34:05 +0200 Subject: [PATCH 17/30] Fix SERVER | CLIENT context specifier error (#566) --- NorthstarDLL/squirrel/squirrelautobind.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/NorthstarDLL/squirrel/squirrelautobind.h b/NorthstarDLL/squirrel/squirrelautobind.h index 865479a14..19ecb8084 100644 --- a/NorthstarDLL/squirrel/squirrelautobind.h +++ b/NorthstarDLL/squirrel/squirrelautobind.h @@ -21,16 +21,16 @@ class __squirrelautobind; __squirrelautobind CONCAT2(__squirrelautobind, __LINE__)( \ []() \ { \ - if constexpr (runOnContext & ScriptContext::UI) \ + if constexpr ((runOnContext)&ScriptContext::UI) \ g_pSquirrel->AddFuncRegistration( \ returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::UI >); \ - if constexpr (runOnContext & ScriptContext::CLIENT) \ + if constexpr ((runOnContext)&ScriptContext::CLIENT) \ g_pSquirrel->AddFuncRegistration( \ returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::CLIENT >); \ }, \ []() \ { \ - if constexpr (runOnContext & ScriptContext::SERVER) \ + if constexpr ((runOnContext)&ScriptContext::SERVER) \ g_pSquirrel->AddFuncRegistration( \ returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::SERVER >); \ }); \ @@ -44,15 +44,15 @@ class __squirrelautobind; __squirrelautobind CONCAT2(__squirrelautobind, __LINE__)( \ []() \ { \ - if constexpr (runOnContext & ScriptContext::UI) \ + if constexpr ((runOnContext)&ScriptContext::UI) \ g_pSquirrel->AddFuncOverride(__STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::UI >); \ - if constexpr (runOnContext & ScriptContext::CLIENT) \ + if constexpr ((runOnContext)&ScriptContext::CLIENT) \ g_pSquirrel->AddFuncOverride( \ __STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::CLIENT >); \ }, \ []() \ { \ - if constexpr (runOnContext & ScriptContext::SERVER) \ + if constexpr ((runOnContext)&ScriptContext::SERVER) \ g_pSquirrel->AddFuncOverride( \ __STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::SERVER >); \ }); \ From 0438b5c8cfa99ac01c7e142d959aa40f88f1cc70 Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Wed, 20 Dec 2023 13:24:07 +0000 Subject: [PATCH 18/30] Cherry pick "remove unnecessary namespaces" from primedev (#618) Cherry-picks the removal of unnecessary namespaces from `primedev` https://github.com/F1F7Y/NorthstarPrime/ Co-authored-by: F1F7Y --- NorthstarDLL/client/clientauthhooks.cpp | 4 +- NorthstarDLL/client/demofixes.cpp | 6 +- NorthstarDLL/client/languagehooks.cpp | 2 +- NorthstarDLL/client/r2client.cpp | 12 +- NorthstarDLL/client/r2client.h | 12 +- NorthstarDLL/client/rejectconnectionfixes.cpp | 2 +- NorthstarDLL/core/convar/convar.cpp | 6 +- NorthstarDLL/core/convar/cvar.cpp | 8 +- NorthstarDLL/core/convar/cvar.h | 8 +- NorthstarDLL/core/filesystem/filesystem.cpp | 54 +- NorthstarDLL/core/filesystem/filesystem.h | 10 +- .../core/filesystem/rpakfilesystem.cpp | 4 +- NorthstarDLL/core/memalloc.cpp | 2 - NorthstarDLL/core/tier0.cpp | 24 +- NorthstarDLL/core/tier0.h | 99 ++-- NorthstarDLL/dedicated/dedicated.cpp | 32 +- .../dedicated/dedicatedlogtoclient.cpp | 14 +- .../dedicated/dedicatedmaterialsystem.cpp | 2 +- NorthstarDLL/engine/host.cpp | 4 +- NorthstarDLL/engine/hoststate.cpp | 33 +- NorthstarDLL/engine/hoststate.h | 70 ++- NorthstarDLL/engine/r2engine.cpp | 30 +- NorthstarDLL/engine/r2engine.h | 486 +++++++++--------- NorthstarDLL/engine/runframe.cpp | 2 +- NorthstarDLL/masterserver/masterserver.cpp | 12 +- NorthstarDLL/mods/compiled/kb_act.cpp | 2 +- NorthstarDLL/mods/compiled/modkeyvalues.cpp | 2 +- NorthstarDLL/mods/compiled/modpdef.cpp | 2 +- NorthstarDLL/mods/compiled/modscriptsrson.cpp | 2 +- NorthstarDLL/mods/modmanager.cpp | 6 +- NorthstarDLL/mods/modsavefiles.cpp | 4 +- .../scripts/client/clientchathooks.cpp | 2 +- .../scripts/client/scriptserverbrowser.cpp | 14 +- NorthstarDLL/scripts/scriptdatatables.cpp | 8 +- .../scripts/scripthttprequesthandler.cpp | 6 +- NorthstarDLL/scripts/scriptutility.cpp | 4 +- .../scripts/server/miscserverscript.cpp | 18 +- .../scripts/server/scriptuserinfo.cpp | 20 +- NorthstarDLL/server/alltalk.cpp | 4 +- NorthstarDLL/server/auth/bansystem.cpp | 8 +- .../server/auth/serverauthentication.cpp | 46 +- .../server/auth/serverauthentication.h | 16 +- NorthstarDLL/server/buildainfile.cpp | 6 +- NorthstarDLL/server/r2server.cpp | 10 +- NorthstarDLL/server/r2server.h | 202 ++++---- NorthstarDLL/server/serverchathooks.cpp | 12 +- NorthstarDLL/server/servernethooks.cpp | 6 +- .../shared/exploit_fixes/exploitfixes.cpp | 24 +- .../shared/exploit_fixes/ns_limits.cpp | 56 +- NorthstarDLL/shared/exploit_fixes/ns_limits.h | 12 +- NorthstarDLL/shared/maxplayers.cpp | 16 +- NorthstarDLL/shared/maxplayers.h | 6 +- NorthstarDLL/shared/misccommands.cpp | 30 +- NorthstarDLL/shared/playlist.cpp | 2 +- NorthstarDLL/squirrel/squirrel.cpp | 10 +- NorthstarDLL/util/printcommands.cpp | 24 +- NorthstarDLL/util/printmaps.cpp | 10 +- NorthstarDLL/util/utils.cpp | 2 +- NorthstarDLL/util/utils.h | 5 +- 59 files changed, 725 insertions(+), 810 deletions(-) diff --git a/NorthstarDLL/client/clientauthhooks.cpp b/NorthstarDLL/client/clientauthhooks.cpp index adb2ab225..35ae3aa77 100644 --- a/NorthstarDLL/client/clientauthhooks.cpp +++ b/NorthstarDLL/client/clientauthhooks.cpp @@ -32,10 +32,10 @@ void, __fastcall, (void* a1)) // if player has agreed to send token and we aren't already authing, try to auth if (Cvar_ns_has_agreed_to_send_token->GetInt() == AGREED_TO_SEND_TOKEN && !g_pMasterServerManager->m_bOriginAuthWithMasterServerInProgress) - g_pMasterServerManager->AuthenticateOriginWithMasterServer(R2::g_pLocalPlayerUserID, R2::g_pLocalPlayerOriginToken); + g_pMasterServerManager->AuthenticateOriginWithMasterServer(g_pLocalPlayerUserID, g_pLocalPlayerOriginToken); // invalidate key so auth will fail - *R2::g_pLocalPlayerOriginToken = 0; + *g_pLocalPlayerOriginToken = 0; } AuthWithStryder(a1); diff --git a/NorthstarDLL/client/demofixes.cpp b/NorthstarDLL/client/demofixes.cpp index 65e48fc05..344764baa 100644 --- a/NorthstarDLL/client/demofixes.cpp +++ b/NorthstarDLL/client/demofixes.cpp @@ -11,15 +11,15 @@ ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ClientDemoFixes, ConVar, (CModule modu { // change default values of demo cvars to enable them by default, but not autorecord // this is before Host_Init, the setvalue calls here will get overwritten by custom cfgs/launch options - ConVar* Cvar_demo_enableDemos = R2::g_pCVar->FindVar("demo_enabledemos"); + ConVar* Cvar_demo_enableDemos = g_pCVar->FindVar("demo_enabledemos"); Cvar_demo_enableDemos->m_pszDefaultValue = "1"; Cvar_demo_enableDemos->SetValue(true); - ConVar* Cvar_demo_writeLocalFile = R2::g_pCVar->FindVar("demo_writeLocalFile"); + ConVar* Cvar_demo_writeLocalFile = g_pCVar->FindVar("demo_writeLocalFile"); Cvar_demo_writeLocalFile->m_pszDefaultValue = "1"; Cvar_demo_writeLocalFile->SetValue(true); - ConVar* Cvar_demo_autoRecord = R2::g_pCVar->FindVar("demo_autoRecord"); + ConVar* Cvar_demo_autoRecord = g_pCVar->FindVar("demo_autoRecord"); Cvar_demo_autoRecord->m_pszDefaultValue = "0"; Cvar_demo_autoRecord->SetValue(false); } diff --git a/NorthstarDLL/client/languagehooks.cpp b/NorthstarDLL/client/languagehooks.cpp index 4251dbbdf..35ca5659f 100644 --- a/NorthstarDLL/client/languagehooks.cpp +++ b/NorthstarDLL/client/languagehooks.cpp @@ -57,7 +57,7 @@ char*, __fastcall, ()) bool& canOriginDictateLang = *(bool*)((char*)tier0Handle + 0xA9A90); const char* forcedLanguage; - if (Tier0::CommandLine()->CheckParm("-language", &forcedLanguage)) + if (CommandLine()->CheckParm("-language", &forcedLanguage)) { if (!CheckLangAudioExists((char*)forcedLanguage)) { diff --git a/NorthstarDLL/client/r2client.cpp b/NorthstarDLL/client/r2client.cpp index fea97d8ee..c8e59d748 100644 --- a/NorthstarDLL/client/r2client.cpp +++ b/NorthstarDLL/client/r2client.cpp @@ -1,14 +1,8 @@ #include "r2client.h" -using namespace R2; - -// use the R2 namespace for game funcs -namespace R2 -{ - char* g_pLocalPlayerUserID; - char* g_pLocalPlayerOriginToken; - GetBaseLocalClientType GetBaseLocalClient; -} // namespace R2 +char* g_pLocalPlayerUserID; +char* g_pLocalPlayerOriginToken; +GetBaseLocalClientType GetBaseLocalClient; ON_DLL_LOAD("engine.dll", R2EngineClient, (CModule module)) { diff --git a/NorthstarDLL/client/r2client.h b/NorthstarDLL/client/r2client.h index 64ed6c616..ea263dbc8 100644 --- a/NorthstarDLL/client/r2client.h +++ b/NorthstarDLL/client/r2client.h @@ -1,11 +1,7 @@ #pragma once -// use the R2 namespace for game funcs -namespace R2 -{ - extern char* g_pLocalPlayerUserID; - extern char* g_pLocalPlayerOriginToken; +extern char* g_pLocalPlayerUserID; +extern char* g_pLocalPlayerOriginToken; - typedef void* (*GetBaseLocalClientType)(); - extern GetBaseLocalClientType GetBaseLocalClient; -} // namespace R2 +typedef void* (*GetBaseLocalClientType)(); +extern GetBaseLocalClientType GetBaseLocalClient; diff --git a/NorthstarDLL/client/rejectconnectionfixes.cpp b/NorthstarDLL/client/rejectconnectionfixes.cpp index 6adde8b6c..1b326a3c8 100644 --- a/NorthstarDLL/client/rejectconnectionfixes.cpp +++ b/NorthstarDLL/client/rejectconnectionfixes.cpp @@ -22,7 +22,7 @@ void,, (bool a1, const char* fmt, ...)) // not doing this gets our client in a pretty weird state so we need to shut it down manually here // don't call Cbuf_Execute because we don't need this called immediately - R2::Cbuf_AddText(R2::Cbuf_GetCurrentPlayer(), "disconnect", R2::cmd_source_t::kCommandSrcCode); + Cbuf_AddText(Cbuf_GetCurrentPlayer(), "disconnect", cmd_source_t::kCommandSrcCode); } return COM_ExplainDisconnection(a1, "%s", buf); diff --git a/NorthstarDLL/core/convar/convar.cpp b/NorthstarDLL/core/convar/convar.cpp index 594989c20..e77ae1fdd 100644 --- a/NorthstarDLL/core/convar/convar.cpp +++ b/NorthstarDLL/core/convar/convar.cpp @@ -38,14 +38,14 @@ ON_DLL_LOAD("engine.dll", ConVar, (CModule module)) g_pConVar_Vtable = module.Offset(0x67FD28); g_pIConVar_Vtable = module.Offset(0x67FDC8); - R2::g_pCVarInterface = new SourceInterface("vstdlib.dll", "VEngineCvar007"); - R2::g_pCVar = *R2::g_pCVarInterface; + g_pCVarInterface = new SourceInterface("vstdlib.dll", "VEngineCvar007"); + g_pCVar = *g_pCVarInterface; g_pPluginCommunicationhandler->m_sEngineData.conVarMalloc = reinterpret_cast(conVarMalloc); g_pPluginCommunicationhandler->m_sEngineData.conVarRegister = reinterpret_cast(conVarRegister); g_pPluginCommunicationhandler->m_sEngineData.ConVar_Vtable = reinterpret_cast(g_pConVar_Vtable); g_pPluginCommunicationhandler->m_sEngineData.IConVar_Vtable = reinterpret_cast(g_pIConVar_Vtable); - g_pPluginCommunicationhandler->m_sEngineData.g_pCVar = reinterpret_cast(R2::g_pCVar); + g_pPluginCommunicationhandler->m_sEngineData.g_pCVar = reinterpret_cast(g_pCVar); } //----------------------------------------------------------------------------- diff --git a/NorthstarDLL/core/convar/cvar.cpp b/NorthstarDLL/core/convar/cvar.cpp index 21f8d2ec1..aa5f03653 100644 --- a/NorthstarDLL/core/convar/cvar.cpp +++ b/NorthstarDLL/core/convar/cvar.cpp @@ -22,9 +22,5 @@ std::unordered_map CCvar::DumpToMap() return allConVars; } -// use the R2 namespace for game funcs -namespace R2 -{ - SourceInterface* g_pCVarInterface; - CCvar* g_pCVar; -} // namespace R2 +SourceInterface* g_pCVarInterface; +CCvar* g_pCVar; diff --git a/NorthstarDLL/core/convar/cvar.h b/NorthstarDLL/core/convar/cvar.h index 3a3e1815a..09fa8591f 100644 --- a/NorthstarDLL/core/convar/cvar.h +++ b/NorthstarDLL/core/convar/cvar.h @@ -34,9 +34,5 @@ class CCvar std::unordered_map DumpToMap(); }; -// use the R2 namespace for game funcs -namespace R2 -{ - extern SourceInterface* g_pCVarInterface; - extern CCvar* g_pCVar; -} // namespace R2 +extern SourceInterface* g_pCVarInterface; +extern CCvar* g_pCVar; diff --git a/NorthstarDLL/core/filesystem/filesystem.cpp b/NorthstarDLL/core/filesystem/filesystem.cpp index e4da647f2..b39939e45 100644 --- a/NorthstarDLL/core/filesystem/filesystem.cpp +++ b/NorthstarDLL/core/filesystem/filesystem.cpp @@ -7,48 +7,42 @@ AUTOHOOK_INIT() -using namespace R2; - bool bReadingOriginalFile = false; std::string sCurrentModPath; ConVar* Cvar_ns_fs_log_reads; -// use the R2 namespace for game funcs -namespace R2 +SourceInterface* g_pFilesystem; + +std::string ReadVPKFile(const char* path) { - SourceInterface* g_pFilesystem; + // read scripts.rson file, todo: check if this can be overwritten + FileHandle_t fileHandle = (*g_pFilesystem)->m_vtable2->Open(&(*g_pFilesystem)->m_vtable2, path, "rb", "GAME", 0); - std::string ReadVPKFile(const char* path) + std::stringstream fileStream; + int bytesRead = 0; + char data[4096]; + do { - // read scripts.rson file, todo: check if this can be overwritten - FileHandle_t fileHandle = (*g_pFilesystem)->m_vtable2->Open(&(*g_pFilesystem)->m_vtable2, path, "rb", "GAME", 0); - - std::stringstream fileStream; - int bytesRead = 0; - char data[4096]; - do - { - bytesRead = (*g_pFilesystem)->m_vtable2->Read(&(*g_pFilesystem)->m_vtable2, data, (int)std::size(data), fileHandle); - fileStream.write(data, bytesRead); - } while (bytesRead == std::size(data)); + bytesRead = (*g_pFilesystem)->m_vtable2->Read(&(*g_pFilesystem)->m_vtable2, data, (int)std::size(data), fileHandle); + fileStream.write(data, bytesRead); + } while (bytesRead == std::size(data)); - (*g_pFilesystem)->m_vtable2->Close(*g_pFilesystem, fileHandle); + (*g_pFilesystem)->m_vtable2->Close(*g_pFilesystem, fileHandle); - return fileStream.str(); - } + return fileStream.str(); +} - std::string ReadVPKOriginalFile(const char* path) - { - // todo: should probably set search path to be g_pModName here also +std::string ReadVPKOriginalFile(const char* path) +{ + // todo: should probably set search path to be g_pModName here also - bReadingOriginalFile = true; - std::string ret = ReadVPKFile(path); - bReadingOriginalFile = false; + bReadingOriginalFile = true; + std::string ret = ReadVPKFile(path); + bReadingOriginalFile = false; - return ret; - } -} // namespace R2 + return ret; +} // clang-format off HOOK(AddSearchPathHook, AddSearchPath, @@ -175,7 +169,7 @@ ON_DLL_LOAD("filesystem_stdio.dll", Filesystem, (CModule module)) { AUTOHOOK_DISPATCH() - R2::g_pFilesystem = new SourceInterface("filesystem_stdio.dll", "VFileSystem017"); + g_pFilesystem = new SourceInterface("filesystem_stdio.dll", "VFileSystem017"); AddSearchPathHook.Dispatch((LPVOID)(*g_pFilesystem)->m_vtable->AddSearchPath); ReadFromCacheHook.Dispatch((LPVOID)(*g_pFilesystem)->m_vtable->ReadFromCache); diff --git a/NorthstarDLL/core/filesystem/filesystem.h b/NorthstarDLL/core/filesystem/filesystem.h index ac1c5986d..9c4e891b5 100644 --- a/NorthstarDLL/core/filesystem/filesystem.h +++ b/NorthstarDLL/core/filesystem/filesystem.h @@ -63,11 +63,7 @@ class IFileSystem VTable2* m_vtable2; }; -// use the R2 namespace for game funcs -namespace R2 -{ - extern SourceInterface* g_pFilesystem; +extern SourceInterface* g_pFilesystem; - std::string ReadVPKFile(const char* path); - std::string ReadVPKOriginalFile(const char* path); -} // namespace R2 +std::string ReadVPKFile(const char* path); +std::string ReadVPKOriginalFile(const char* path); diff --git a/NorthstarDLL/core/filesystem/rpakfilesystem.cpp b/NorthstarDLL/core/filesystem/rpakfilesystem.cpp index 8d50b07a6..da72646b9 100644 --- a/NorthstarDLL/core/filesystem/rpakfilesystem.cpp +++ b/NorthstarDLL/core/filesystem/rpakfilesystem.cpp @@ -209,8 +209,8 @@ int, __fastcall, (char* pPath, void* unknownSingleton, int flags, void* pCallbac // dedicated only needs common, common_mp, common_sp, and sp_ rpaks // sp_ rpaks contain tutorial ghost data // sucks to have to load the entire rpak for that but sp was never meant to be done on dedi - if (IsDedicatedServer() && (Tier0::CommandLine()->CheckParm("-nopakdedi") || - strncmp(&originalPath[0], "common", 6) && strncmp(&originalPath[0], "sp_", 3))) + if (IsDedicatedServer() && + (CommandLine()->CheckParm("-nopakdedi") || strncmp(&originalPath[0], "common", 6) && strncmp(&originalPath[0], "sp_", 3))) { if (bNeedToFreePakName) delete[] pPath; diff --git a/NorthstarDLL/core/memalloc.cpp b/NorthstarDLL/core/memalloc.cpp index 69ce6f54d..0a75bc2bd 100644 --- a/NorthstarDLL/core/memalloc.cpp +++ b/NorthstarDLL/core/memalloc.cpp @@ -1,8 +1,6 @@ #include "core/memalloc.h" #include "core/tier0.h" -using namespace Tier0; - // TODO: rename to malloc and free after removing statically compiled .libs extern "C" void* _malloc_base(size_t n) diff --git a/NorthstarDLL/core/tier0.cpp b/NorthstarDLL/core/tier0.cpp index 167093842..1f59722c2 100644 --- a/NorthstarDLL/core/tier0.cpp +++ b/NorthstarDLL/core/tier0.cpp @@ -1,17 +1,12 @@ #include "tier0.h" -// use the Tier0 namespace for tier0 funcs -namespace Tier0 -{ - IMemAlloc* g_pMemAllocSingleton = nullptr; +IMemAlloc* g_pMemAllocSingleton = nullptr; - ErrorType Error; - CommandLineType CommandLine; - Plat_FloatTimeType Plat_FloatTime; - ThreadInServerFrameThreadType ThreadInServerFrameThread; -} // namespace Tier0 +CommandLineType CommandLine; +Plat_FloatTimeType Plat_FloatTime; +ThreadInServerFrameThreadType ThreadInServerFrameThread; -typedef Tier0::IMemAlloc* (*CreateGlobalMemAllocType)(); +typedef IMemAlloc* (*CreateGlobalMemAllocType)(); CreateGlobalMemAllocType CreateGlobalMemAlloc; // needs to be a seperate function, since memalloc.cpp calls it @@ -20,7 +15,7 @@ void TryCreateGlobalMemAlloc() // init memalloc stuff CreateGlobalMemAlloc = reinterpret_cast(GetProcAddress(GetModuleHandleA("tier0.dll"), "CreateGlobalMemAlloc")); - Tier0::g_pMemAllocSingleton = CreateGlobalMemAlloc(); // if it already exists, this returns the preexisting IMemAlloc instance + g_pMemAllocSingleton = CreateGlobalMemAlloc(); // if it already exists, this returns the preexisting IMemAlloc instance } ON_DLL_LOAD("tier0.dll", Tier0GameFuncs, (CModule module)) @@ -29,8 +24,7 @@ ON_DLL_LOAD("tier0.dll", Tier0GameFuncs, (CModule module)) TryCreateGlobalMemAlloc(); // setup tier0 funcs - Tier0::Error = module.GetExport("Error").RCast(); - Tier0::CommandLine = module.GetExport("CommandLine").RCast(); - Tier0::Plat_FloatTime = module.GetExport("Plat_FloatTime").RCast(); - Tier0::ThreadInServerFrameThread = module.GetExport("ThreadInServerFrameThread").RCast(); + CommandLine = module.GetExport("CommandLine").RCast(); + Plat_FloatTime = module.GetExport("Plat_FloatTime").RCast(); + ThreadInServerFrameThread = module.GetExport("ThreadInServerFrameThread").RCast(); } diff --git a/NorthstarDLL/core/tier0.h b/NorthstarDLL/core/tier0.h index eebe98f23..047610b28 100644 --- a/NorthstarDLL/core/tier0.h +++ b/NorthstarDLL/core/tier0.h @@ -1,68 +1,63 @@ #pragma once -namespace Tier0 + +class IMemAlloc { - class IMemAlloc + public: + struct VTable { - public: - struct VTable - { - void* unknown[1]; // alloc debug - void* (*Alloc)(IMemAlloc* memAlloc, size_t nSize); - void* unknown2[1]; // realloc debug - void* (*Realloc)(IMemAlloc* memAlloc, void* pMem, size_t nSize); - void* unknown3[1]; // free #1 - void (*Free)(IMemAlloc* memAlloc, void* pMem); - void* unknown4[2]; // nullsubs, maybe CrtSetDbgFlag - size_t (*GetSize)(IMemAlloc* memAlloc, void* pMem); - void* unknown5[9]; // they all do literally nothing - void (*DumpStats)(IMemAlloc* memAlloc); - void (*DumpStatsFileBase)(IMemAlloc* memAlloc, const char* pchFileBase); - void* unknown6[4]; - int (*heapchk)(IMemAlloc* memAlloc); - }; - - VTable* m_vtable; + void* unknown[1]; // alloc debug + void* (*Alloc)(IMemAlloc* memAlloc, size_t nSize); + void* unknown2[1]; // realloc debug + void* (*Realloc)(IMemAlloc* memAlloc, void* pMem, size_t nSize); + void* unknown3[1]; // free #1 + void (*Free)(IMemAlloc* memAlloc, void* pMem); + void* unknown4[2]; // nullsubs, maybe CrtSetDbgFlag + size_t (*GetSize)(IMemAlloc* memAlloc, void* pMem); + void* unknown5[9]; // they all do literally nothing + void (*DumpStats)(IMemAlloc* memAlloc); + void (*DumpStatsFileBase)(IMemAlloc* memAlloc, const char* pchFileBase); + void* unknown6[4]; + int (*heapchk)(IMemAlloc* memAlloc); }; - class CCommandLine - { - public: - // based on the defs in the 2013 source sdk, but for some reason has an extra function (may be another CreateCmdLine overload?) - // these seem to line up with what they should be though - virtual void CreateCmdLine(const char* commandline) = 0; - virtual void CreateCmdLine(int argc, char** argv) = 0; - virtual void unknown() = 0; - virtual const char* GetCmdLine(void) const = 0; + VTable* m_vtable; +}; - virtual const char* CheckParm(const char* psz, const char** ppszValue = 0) const = 0; - virtual void RemoveParm() const = 0; - virtual void AppendParm(const char* pszParm, const char* pszValues) = 0; +class CCommandLine +{ + public: + // based on the defs in the 2013 source sdk, but for some reason has an extra function (may be another CreateCmdLine overload?) + // these seem to line up with what they should be though + virtual void CreateCmdLine(const char* commandline) = 0; + virtual void CreateCmdLine(int argc, char** argv) = 0; + virtual void unknown() = 0; + virtual const char* GetCmdLine(void) const = 0; - virtual const char* ParmValue(const char* psz, const char* pDefaultVal = 0) const = 0; - virtual int ParmValue(const char* psz, int nDefaultVal) const = 0; - virtual float ParmValue(const char* psz, float flDefaultVal) const = 0; + virtual const char* CheckParm(const char* psz, const char** ppszValue = 0) const = 0; + virtual void RemoveParm() const = 0; + virtual void AppendParm(const char* pszParm, const char* pszValues) = 0; - virtual int ParmCount() const = 0; - virtual int FindParm(const char* psz) const = 0; - virtual const char* GetParm(int nIndex) const = 0; - virtual void SetParm(int nIndex, char const* pParm) = 0; + virtual const char* ParmValue(const char* psz, const char* pDefaultVal = 0) const = 0; + virtual int ParmValue(const char* psz, int nDefaultVal) const = 0; + virtual float ParmValue(const char* psz, float flDefaultVal) const = 0; - // virtual const char** GetParms() const {} - }; + virtual int ParmCount() const = 0; + virtual int FindParm(const char* psz) const = 0; + virtual const char* GetParm(int nIndex) const = 0; + virtual void SetParm(int nIndex, char const* pParm) = 0; - extern IMemAlloc* g_pMemAllocSingleton; + // virtual const char** GetParms() const {} +}; - typedef void (*ErrorType)(const char* fmt, ...); - extern ErrorType Error; +extern IMemAlloc* g_pMemAllocSingleton; - typedef CCommandLine* (*CommandLineType)(); - extern CommandLineType CommandLine; +typedef CCommandLine* (*CommandLineType)(); +extern CommandLineType CommandLine; - typedef double (*Plat_FloatTimeType)(); - extern Plat_FloatTimeType Plat_FloatTime; +typedef double (*Plat_FloatTimeType)(); +extern Plat_FloatTimeType Plat_FloatTime; - typedef bool (*ThreadInServerFrameThreadType)(); - extern ThreadInServerFrameThreadType ThreadInServerFrameThread; -} // namespace Tier0 +typedef bool (*ThreadInServerFrameThreadType)(); +extern ThreadInServerFrameThreadType ThreadInServerFrameThread; void TryCreateGlobalMemAlloc(); diff --git a/NorthstarDLL/dedicated/dedicated.cpp b/NorthstarDLL/dedicated/dedicated.cpp index 34282f51c..df6e5787e 100644 --- a/NorthstarDLL/dedicated/dedicated.cpp +++ b/NorthstarDLL/dedicated/dedicated.cpp @@ -10,8 +10,6 @@ AUTOHOOK_INIT() -using namespace R2; - bool IsDedicatedServer() { static bool result = strstr(GetCommandLineA(), "-dedicated"); @@ -43,15 +41,15 @@ void Sys_Printf(CDedicatedExports* dedicated, const char* msg) void RunServer(CDedicatedExports* dedicated) { spdlog::info("CDedicatedExports::RunServer(): starting"); - spdlog::info(Tier0::CommandLine()->GetCmdLine()); + spdlog::info(CommandLine()->GetCmdLine()); // initialise engine g_pEngine->Frame(); // add +map if no map loading command is present // don't manually execute this from cbuf as users may have it in their startup args anyway, easier just to run from stuffcmds if present - if (!Tier0::CommandLine()->CheckParm("+map") && !Tier0::CommandLine()->CheckParm("+launchplaylist")) - Tier0::CommandLine()->AppendParm("+map", g_pCVar->FindVar("match_defaultMap")->GetString()); + if (!CommandLine()->CheckParm("+map") && !CommandLine()->CheckParm("+launchplaylist")) + CommandLine()->AppendParm("+map", g_pCVar->FindVar("match_defaultMap")->GetString()); // re-run commandline Cbuf_AddText(Cbuf_GetCurrentPlayer(), "stuffcmds", cmd_source_t::kCommandSrcCode); @@ -61,11 +59,11 @@ void RunServer(CDedicatedExports* dedicated) double frameTitle = 0; while (g_pEngine->m_nQuitting == EngineQuitState::QUIT_NOTQUITTING) { - double frameStart = Tier0::Plat_FloatTime(); + double frameStart = Plat_FloatTime(); g_pEngine->Frame(); std::this_thread::sleep_for( - std::chrono::duration>(g_pGlobals->m_flTickInterval - fmin(Tier0::Plat_FloatTime() - frameStart, 0.25))); + std::chrono::duration>(g_pGlobals->m_flTickInterval - fmin(Plat_FloatTime() - frameStart, 0.25))); } } @@ -215,13 +213,13 @@ ON_DLL_LOAD_DEDI_RELIESON("engine.dll", DedicatedServer, ServerPresence, (CModul // make sure it still gets registered // add cmdline args that are good for dedi - Tier0::CommandLine()->AppendParm("-nomenuvid", 0); - Tier0::CommandLine()->AppendParm("-nosound", 0); - Tier0::CommandLine()->AppendParm("-windowed", 0); - Tier0::CommandLine()->AppendParm("-nomessagebox", 0); - Tier0::CommandLine()->AppendParm("+host_preload_shaders", "0"); - Tier0::CommandLine()->AppendParm("+net_usesocketsforloopback", "1"); - Tier0::CommandLine()->AppendParm("+community_frame_run", "0"); + CommandLine()->AppendParm("-nomenuvid", 0); + CommandLine()->AppendParm("-nosound", 0); + CommandLine()->AppendParm("-windowed", 0); + CommandLine()->AppendParm("-nomessagebox", 0); + CommandLine()->AppendParm("+host_preload_shaders", "0"); + CommandLine()->AppendParm("+net_usesocketsforloopback", "1"); + CommandLine()->AppendParm("+community_frame_run", "0"); // use presence reporter for console title DedicatedConsoleServerPresence* presenceReporter = new DedicatedConsoleServerPresence; @@ -231,7 +229,7 @@ ON_DLL_LOAD_DEDI_RELIESON("engine.dll", DedicatedServer, ServerPresence, (CModul RegisterCustomSink(std::make_shared()); // Disable Quick Edit mode to reduce chance of user unintentionally hanging their server by selecting something. - if (!Tier0::CommandLine()->CheckParm("-bringbackquickedit")) + if (!CommandLine()->CheckParm("-bringbackquickedit")) { HANDLE stdIn = GetStdHandle(STD_INPUT_HANDLE); DWORD mode = 0; @@ -253,7 +251,7 @@ ON_DLL_LOAD_DEDI_RELIESON("engine.dll", DedicatedServer, ServerPresence, (CModul spdlog::info("Quick Edit enabled by user request"); // create console input thread - if (!Tier0::CommandLine()->CheckParm("-noconsoleinput")) + if (!CommandLine()->CheckParm("-noconsoleinput")) consoleInputThreadHandle = CreateThread(0, 0, ConsoleInputThread, 0, 0, NULL); else spdlog::info("Console input disabled by user request"); @@ -288,7 +286,7 @@ ON_DLL_LOAD_DEDI("server.dll", DedicatedServerGameDLL, (CModule module)) { AUTOHOOK_DISPATCH_MODULE(server.dll) - if (Tier0::CommandLine()->CheckParm("-nopakdedi")) + if (CommandLine()->CheckParm("-nopakdedi")) { module.Offset(0x6BA350).Patch("C3"); // dont load skins.rson from rpak if we don't have rpaks, as loading it will cause a crash module.Offset(0x6BA300).Patch( diff --git a/NorthstarDLL/dedicated/dedicatedlogtoclient.cpp b/NorthstarDLL/dedicated/dedicatedlogtoclient.cpp index a48b1b39b..bf2cf77a0 100644 --- a/NorthstarDLL/dedicated/dedicatedlogtoclient.cpp +++ b/NorthstarDLL/dedicated/dedicatedlogtoclient.cpp @@ -1,11 +1,11 @@ #include "dedicatedlogtoclient.h" #include "engine/r2engine.h" -void (*CGameClient__ClientPrintf)(R2::CBaseClient* pClient, const char* fmt, ...); +void (*CGameClient__ClientPrintf)(CBaseClient* pClient, const char* fmt, ...); void DedicatedServerLogToClientSink::custom_sink_it_(const custom_log_msg& msg) { - if (*R2::g_pServerState == R2::server_state_t::ss_dead) + if (*g_pServerState == server_state_t::ss_dead) return; enum class eSendPrintsToClient @@ -15,17 +15,17 @@ void DedicatedServerLogToClientSink::custom_sink_it_(const custom_log_msg& msg) ALL }; - static const ConVar* Cvar_dedi_sendPrintsToClient = R2::g_pCVar->FindVar("dedi_sendPrintsToClient"); + static const ConVar* Cvar_dedi_sendPrintsToClient = g_pCVar->FindVar("dedi_sendPrintsToClient"); eSendPrintsToClient eSendPrints = static_cast(Cvar_dedi_sendPrintsToClient->GetInt()); if (eSendPrints == eSendPrintsToClient::NONE) return; std::string sLogMessage = fmt::format("[DEDICATED SERVER] [{}] {}", level_names[msg.level], msg.payload); - for (int i = 0; i < R2::g_pGlobals->m_nMaxClients; i++) + for (int i = 0; i < g_pGlobals->m_nMaxClients; i++) { - R2::CBaseClient* pClient = &R2::g_pClientArray[i]; + CBaseClient* pClient = &g_pClientArray[i]; - if (pClient->m_Signon >= R2::eSignonState::CONNECTED) + if (pClient->m_Signon >= eSignonState::CONNECTED) { CGameClient__ClientPrintf(pClient, sLogMessage.c_str()); @@ -44,5 +44,5 @@ void DedicatedServerLogToClientSink::flush_() {} ON_DLL_LOAD_DEDI("engine.dll", DedicatedServerLogToClient, (CModule module)) { - CGameClient__ClientPrintf = module.Offset(0x1016A0).RCast(); + CGameClient__ClientPrintf = module.Offset(0x1016A0).RCast(); } diff --git a/NorthstarDLL/dedicated/dedicatedmaterialsystem.cpp b/NorthstarDLL/dedicated/dedicatedmaterialsystem.cpp index 5bd6ea930..010780862 100644 --- a/NorthstarDLL/dedicated/dedicatedmaterialsystem.cpp +++ b/NorthstarDLL/dedicated/dedicatedmaterialsystem.cpp @@ -23,7 +23,7 @@ HRESULT, __stdcall, ( // really call gpu much even with renderthread still being a thing will be using this hook for actual d3d stubbing and stuff later // note: this has been succeeded by the d3d11 and gfsdk stubs, and is only being kept around for posterity and as a fallback option - if (Tier0::CommandLine()->CheckParm("-softwared3d11")) + if (CommandLine()->CheckParm("-softwared3d11")) DriverType = 5; // D3D_DRIVER_TYPE_WARP return D3D11CreateDevice( diff --git a/NorthstarDLL/engine/host.cpp b/NorthstarDLL/engine/host.cpp index 49cc36630..dacb8fc1c 100644 --- a/NorthstarDLL/engine/host.cpp +++ b/NorthstarDLL/engine/host.cpp @@ -22,9 +22,9 @@ void, __fastcall, (bool bDedicated)) // client/server autoexecs on necessary platforms // dedi needs autoexec_ns_server on boot, while non-dedi will run it on on listen server start if (bDedicated) - R2::Cbuf_AddText(R2::Cbuf_GetCurrentPlayer(), "exec autoexec_ns_server", R2::cmd_source_t::kCommandSrcCode); + Cbuf_AddText(Cbuf_GetCurrentPlayer(), "exec autoexec_ns_server", cmd_source_t::kCommandSrcCode); else - R2::Cbuf_AddText(R2::Cbuf_GetCurrentPlayer(), "exec autoexec_ns_client", R2::cmd_source_t::kCommandSrcCode); + Cbuf_AddText(Cbuf_GetCurrentPlayer(), "exec autoexec_ns_client", cmd_source_t::kCommandSrcCode); } ON_DLL_LOAD("engine.dll", Host_Init, (CModule module)) diff --git a/NorthstarDLL/engine/hoststate.cpp b/NorthstarDLL/engine/hoststate.cpp index 1734a1c38..ec728afb7 100644 --- a/NorthstarDLL/engine/hoststate.cpp +++ b/NorthstarDLL/engine/hoststate.cpp @@ -12,13 +12,7 @@ AUTOHOOK_INIT() -using namespace R2; - -// use the R2 namespace for game funcs -namespace R2 -{ - CHostState* g_pHostState; -} // namespace R2 +CHostState* g_pHostState; std::string sLastMode; @@ -35,15 +29,14 @@ void ServerStartingOrChangingMap() memset(commandBuf, 0, sizeof(commandBuf)); CCommand tempCommand = *(CCommand*)&commandBuf; if (sLastMode.length() && - CCommand__Tokenize( - tempCommand, fmt::format("exec server/cleanup_gamemode_{}", sLastMode).c_str(), R2::cmd_source_t::kCommandSrcCode)) + CCommand__Tokenize(tempCommand, fmt::format("exec server/cleanup_gamemode_{}", sLastMode).c_str(), cmd_source_t::kCommandSrcCode)) _Cmd_Exec_f(tempCommand, false, false); memset(commandBuf, 0, sizeof(commandBuf)); if (CCommand__Tokenize( tempCommand, fmt::format("exec server/setup_gamemode_{}", sLastMode = Cvar_mp_gamemode->GetString()).c_str(), - R2::cmd_source_t::kCommandSrcCode)) + cmd_source_t::kCommandSrcCode)) { _Cmd_Exec_f(tempCommand, false, false); } @@ -73,18 +66,18 @@ void, __fastcall, (CHostState* self)) // need to do this to ensure we don't go to private match if (g_pServerAuthentication->m_bNeedLocalAuthForNewgame) - SetCurrentPlaylist("tdm"); + R2::SetCurrentPlaylist("tdm"); ServerStartingOrChangingMap(); - double dStartTime = Tier0::Plat_FloatTime(); + double dStartTime = Plat_FloatTime(); CHostState__State_NewGame(self); - spdlog::info("loading took {}s", Tier0::Plat_FloatTime() - dStartTime); + spdlog::info("loading took {}s", Plat_FloatTime() - dStartTime); // setup server presence g_pServerPresence->CreatePresence(); g_pServerPresence->SetMap(g_pHostState->m_levelName, true); - g_pServerPresence->SetPlaylist(GetCurrentPlaylistName()); + g_pServerPresence->SetPlaylist(R2::GetCurrentPlaylistName()); g_pServerPresence->SetPort(Cvar_hostport->GetInt()); g_pServerAuthentication->m_bNeedLocalAuthForNewgame = false; @@ -107,9 +100,9 @@ void, __fastcall, (CHostState* self)) g_pCVar->FindVar("net_data_block_enabled")->SetValue(true); g_pServerAuthentication->m_bStartingLocalSPGame = true; - double dStartTime = Tier0::Plat_FloatTime(); + double dStartTime = Plat_FloatTime(); CHostState__State_LoadGame(self); - spdlog::info("loading took {}s", Tier0::Plat_FloatTime() - dStartTime); + spdlog::info("loading took {}s", Plat_FloatTime() - dStartTime); // no server presence, can't do it because no map name in hoststate // and also not super important for sp saves really @@ -126,9 +119,9 @@ void, __fastcall, (CHostState* self)) ServerStartingOrChangingMap(); - double dStartTime = Tier0::Plat_FloatTime(); + double dStartTime = Plat_FloatTime(); CHostState__State_ChangeLevelMP(self); - spdlog::info("loading took {}s", Tier0::Plat_FloatTime() - dStartTime); + spdlog::info("loading took {}s", Plat_FloatTime() - dStartTime); g_pServerPresence->SetMap(g_pHostState->m_levelName); } @@ -151,7 +144,7 @@ void, __fastcall, (CHostState* self)) memset(commandBuf, 0, sizeof(commandBuf)); CCommand tempCommand = *(CCommand*)&commandBuf; if (CCommand__Tokenize( - tempCommand, fmt::format("exec server/cleanup_gamemode_{}", sLastMode).c_str(), R2::cmd_source_t::kCommandSrcCode)) + tempCommand, fmt::format("exec server/cleanup_gamemode_{}", sLastMode).c_str(), cmd_source_t::kCommandSrcCode)) { _Cmd_Exec_f(tempCommand, false, false); Cbuf_Execute(); @@ -168,7 +161,7 @@ void, __fastcall, (CHostState* self, double flCurrentTime, float flFrameTime)) { CHostState__FrameUpdate(self, flCurrentTime, flFrameTime); - if (*R2::g_pServerState == R2::server_state_t::ss_active) + if (*g_pServerState == server_state_t::ss_active) { // update server presence g_pServerPresence->RunFrame(flCurrentTime); diff --git a/NorthstarDLL/engine/hoststate.h b/NorthstarDLL/engine/hoststate.h index a77385efa..0536e91ce 100644 --- a/NorthstarDLL/engine/hoststate.h +++ b/NorthstarDLL/engine/hoststate.h @@ -1,45 +1,41 @@ #pragma once -// use the R2 namespace for game funxcs -namespace R2 +enum class HostState_t { - enum class HostState_t - { - HS_NEW_GAME = 0, - HS_LOAD_GAME, - HS_CHANGE_LEVEL_SP, - HS_CHANGE_LEVEL_MP, - HS_RUN, - HS_GAME_SHUTDOWN, - HS_SHUTDOWN, - HS_RESTART, - }; + HS_NEW_GAME = 0, + HS_LOAD_GAME, + HS_CHANGE_LEVEL_SP, + HS_CHANGE_LEVEL_MP, + HS_RUN, + HS_GAME_SHUTDOWN, + HS_SHUTDOWN, + HS_RESTART, +}; - struct CHostState - { - public: - HostState_t m_iCurrentState; - HostState_t m_iNextState; +struct CHostState +{ + public: + HostState_t m_iCurrentState; + HostState_t m_iNextState; - float m_vecLocation[3]; - float m_angLocation[3]; + float m_vecLocation[3]; + float m_angLocation[3]; - char m_levelName[32]; - char m_mapGroupName[32]; - char m_landmarkName[32]; - char m_saveName[32]; - float m_flShortFrameTime; // run a few one-tick frames to avoid large timesteps while loading assets + char m_levelName[32]; + char m_mapGroupName[32]; + char m_landmarkName[32]; + char m_saveName[32]; + float m_flShortFrameTime; // run a few one-tick frames to avoid large timesteps while loading assets - bool m_activeGame; - bool m_bRememberLocation; - bool m_bBackgroundLevel; - bool m_bWaitingForConnection; - bool m_bLetToolsOverrideLoadGameEnts; // During a load game, this tells Foundry to override ents that are selected in Hammer. - bool m_bSplitScreenConnect; - bool m_bGameHasShutDownAndFlushedMemory; // This is false once we load a map into memory, and set to true once the map is unloaded - // and all memory flushed - bool m_bWorkshopMapDownloadPending; - }; + bool m_activeGame; + bool m_bRememberLocation; + bool m_bBackgroundLevel; + bool m_bWaitingForConnection; + bool m_bLetToolsOverrideLoadGameEnts; // During a load game, this tells Foundry to override ents that are selected in Hammer. + bool m_bSplitScreenConnect; + bool m_bGameHasShutDownAndFlushedMemory; // This is false once we load a map into memory, and set to true once the map is unloaded + // and all memory flushed + bool m_bWorkshopMapDownloadPending; +}; - extern CHostState* g_pHostState; -} // namespace R2 +extern CHostState* g_pHostState; diff --git a/NorthstarDLL/engine/r2engine.cpp b/NorthstarDLL/engine/r2engine.cpp index 67a628fd7..88500376c 100644 --- a/NorthstarDLL/engine/r2engine.cpp +++ b/NorthstarDLL/engine/r2engine.cpp @@ -1,28 +1,22 @@ #include "r2engine.h" -using namespace R2; +Cbuf_GetCurrentPlayerType Cbuf_GetCurrentPlayer; +Cbuf_AddTextType Cbuf_AddText; +Cbuf_ExecuteType Cbuf_Execute; -// use the R2 namespace for game funcs -namespace R2 -{ - Cbuf_GetCurrentPlayerType Cbuf_GetCurrentPlayer; - Cbuf_AddTextType Cbuf_AddText; - Cbuf_ExecuteType Cbuf_Execute; - - bool (*CCommand__Tokenize)(CCommand& self, const char* pCommandString, R2::cmd_source_t commandSource); +bool (*CCommand__Tokenize)(CCommand& self, const char* pCommandString, cmd_source_t commandSource); - CEngine* g_pEngine; +CEngine* g_pEngine; - void (*CBaseClient__Disconnect)(void* self, uint32_t unknownButAlways1, const char* reason, ...); - CBaseClient* g_pClientArray; +void (*CBaseClient__Disconnect)(void* self, uint32_t unknownButAlways1, const char* reason, ...); +CBaseClient* g_pClientArray; - server_state_t* g_pServerState; +server_state_t* g_pServerState; - char* g_pModName = - nullptr; // we cant set this up here atm since we dont have an offset to it in engine, instead we store it in IsRespawnMod +char* g_pModName = + nullptr; // we cant set this up here atm since we dont have an offset to it in engine, instead we store it in IsRespawnMod - CGlobalVars* g_pGlobals; -} // namespace R2 +CGlobalVars* g_pGlobals; ON_DLL_LOAD("engine.dll", R2Engine, (CModule module)) { @@ -30,7 +24,7 @@ ON_DLL_LOAD("engine.dll", R2Engine, (CModule module)) Cbuf_AddText = module.Offset(0x1203B0).RCast(); Cbuf_Execute = module.Offset(0x1204B0).RCast(); - CCommand__Tokenize = module.Offset(0x418380).RCast(); + CCommand__Tokenize = module.Offset(0x418380).RCast(); g_pEngine = module.Offset(0x7D70C8).Deref().RCast(); diff --git a/NorthstarDLL/engine/r2engine.h b/NorthstarDLL/engine/r2engine.h index df0cda74c..91676b6b6 100644 --- a/NorthstarDLL/engine/r2engine.h +++ b/NorthstarDLL/engine/r2engine.h @@ -1,264 +1,260 @@ #pragma once #include "shared/keyvalues.h" -// use the R2 namespace for game funcs -namespace R2 +// Cbuf +enum class ECommandTarget_t { - // Cbuf - enum class ECommandTarget_t - { - CBUF_FIRST_PLAYER = 0, - CBUF_LAST_PLAYER = 1, // MAX_SPLITSCREEN_CLIENTS - 1, MAX_SPLITSCREEN_CLIENTS = 2 - CBUF_SERVER = CBUF_LAST_PLAYER + 1, - - CBUF_COUNT, - }; - - enum class cmd_source_t - { - // Added to the console buffer by gameplay code. Generally unrestricted. - kCommandSrcCode, - - // Sent from code via engine->ClientCmd, which is restricted to commands visible - // via FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS. - kCommandSrcClientCmd, - - // Typed in at the console or via a user key-bind. Generally unrestricted, although - // the client will throttle commands sent to the server this way to 16 per second. - kCommandSrcUserInput, - - // Came in over a net connection as a clc_stringcmd - // host_client will be valid during this state. - // - // Restricted to FCVAR_GAMEDLL commands (but not convars) and special non-ConCommand - // server commands hardcoded into gameplay code (e.g. "joingame") - kCommandSrcNetClient, + CBUF_FIRST_PLAYER = 0, + CBUF_LAST_PLAYER = 1, // MAX_SPLITSCREEN_CLIENTS - 1, MAX_SPLITSCREEN_CLIENTS = 2 + CBUF_SERVER = CBUF_LAST_PLAYER + 1, - // Received from the server as the client - // - // Restricted to commands with FCVAR_SERVER_CAN_EXECUTE - kCommandSrcNetServer, + CBUF_COUNT, +}; - // Being played back from a demo file - // - // Not currently restricted by convar flag, but some commands manually ignore calls - // from this source. FIXME: Should be heavily restricted as demo commands can come - // from untrusted sources. - kCommandSrcDemoFile, - - // Invalid value used when cleared - kCommandSrcInvalid = -1 - }; - - typedef ECommandTarget_t (*Cbuf_GetCurrentPlayerType)(); - extern Cbuf_GetCurrentPlayerType Cbuf_GetCurrentPlayer; - - typedef void (*Cbuf_AddTextType)(ECommandTarget_t eTarget, const char* text, cmd_source_t source); - extern Cbuf_AddTextType Cbuf_AddText; - - typedef void (*Cbuf_ExecuteType)(); - extern Cbuf_ExecuteType Cbuf_Execute; - - extern bool (*CCommand__Tokenize)(CCommand& self, const char* pCommandString, R2::cmd_source_t commandSource); - - // CEngine - - enum EngineQuitState - { - QUIT_NOTQUITTING = 0, - QUIT_TODESKTOP, - QUIT_RESTART - }; - - enum class EngineState_t - { - DLL_INACTIVE = 0, // no dll - DLL_ACTIVE, // engine is focused - DLL_CLOSE, // closing down dll - DLL_RESTART, // engine is shutting down but will restart right away - DLL_PAUSED, // engine is paused, can become active from this state - }; - - class CEngine - { - public: - virtual void unknown() = 0; // unsure if this is where - virtual bool Load(bool dedicated, const char* baseDir) = 0; - virtual void Unload() = 0; - virtual void SetNextState(EngineState_t iNextState) = 0; - virtual EngineState_t GetState() = 0; - virtual void Frame() = 0; - virtual double GetFrameTime() = 0; - virtual float GetCurTime() = 0; - - EngineQuitState m_nQuitting; - EngineState_t m_nDllState; - EngineState_t m_nNextDllState; - double m_flCurrentTime; - float m_flFrameTime; - double m_flPreviousTime; - float m_flFilteredTime; - float m_flMinFrameTime; // Expected duration of a frame, or zero if it is unlimited. - }; +enum class cmd_source_t +{ + // Added to the console buffer by gameplay code. Generally unrestricted. + kCommandSrcCode, + + // Sent from code via engine->ClientCmd, which is restricted to commands visible + // via FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS. + kCommandSrcClientCmd, + + // Typed in at the console or via a user key-bind. Generally unrestricted, although + // the client will throttle commands sent to the server this way to 16 per second. + kCommandSrcUserInput, + + // Came in over a net connection as a clc_stringcmd + // host_client will be valid during this state. + // + // Restricted to FCVAR_GAMEDLL commands (but not convars) and special non-ConCommand + // server commands hardcoded into gameplay code (e.g. "joingame") + kCommandSrcNetClient, + + // Received from the server as the client + // + // Restricted to commands with FCVAR_SERVER_CAN_EXECUTE + kCommandSrcNetServer, + + // Being played back from a demo file + // + // Not currently restricted by convar flag, but some commands manually ignore calls + // from this source. FIXME: Should be heavily restricted as demo commands can come + // from untrusted sources. + kCommandSrcDemoFile, + + // Invalid value used when cleared + kCommandSrcInvalid = -1 +}; - extern CEngine* g_pEngine; +typedef ECommandTarget_t (*Cbuf_GetCurrentPlayerType)(); +extern Cbuf_GetCurrentPlayerType Cbuf_GetCurrentPlayer; - extern void (*CBaseClient__Disconnect)(void* self, uint32_t unknownButAlways1, const char* reason, ...); +typedef void (*Cbuf_AddTextType)(ECommandTarget_t eTarget, const char* text, cmd_source_t source); +extern Cbuf_AddTextType Cbuf_AddText; + +typedef void (*Cbuf_ExecuteType)(); +extern Cbuf_ExecuteType Cbuf_Execute; + +extern bool (*CCommand__Tokenize)(CCommand& self, const char* pCommandString, cmd_source_t commandSource); + +// CEngine + +enum EngineQuitState +{ + QUIT_NOTQUITTING = 0, + QUIT_TODESKTOP, + QUIT_RESTART +}; + +enum class EngineState_t +{ + DLL_INACTIVE = 0, // no dll + DLL_ACTIVE, // engine is focused + DLL_CLOSE, // closing down dll + DLL_RESTART, // engine is shutting down but will restart right away + DLL_PAUSED, // engine is paused, can become active from this state +}; + +class CEngine +{ + public: + virtual void unknown() = 0; // unsure if this is where + virtual bool Load(bool dedicated, const char* baseDir) = 0; + virtual void Unload() = 0; + virtual void SetNextState(EngineState_t iNextState) = 0; + virtual EngineState_t GetState() = 0; + virtual void Frame() = 0; + virtual double GetFrameTime() = 0; + virtual float GetCurTime() = 0; + + EngineQuitState m_nQuitting; + EngineState_t m_nDllState; + EngineState_t m_nNextDllState; + double m_flCurrentTime; + float m_flFrameTime; + double m_flPreviousTime; + float m_flFilteredTime; + float m_flMinFrameTime; // Expected duration of a frame, or zero if it is unlimited. +}; + +extern CEngine* g_pEngine; + +extern void (*CBaseClient__Disconnect)(void* self, uint32_t unknownButAlways1, const char* reason, ...); #pragma once - typedef enum - { - NA_NULL = 0, - NA_LOOPBACK, - NA_IP, - } netadrtype_t; +typedef enum +{ + NA_NULL = 0, + NA_LOOPBACK, + NA_IP, +} netadrtype_t; #pragma pack(push, 1) - typedef struct netadr_s - { - netadrtype_t type; - unsigned char ip[16]; // IPv6 - // IPv4's 127.0.0.1 is [::ffff:127.0.0.1], that is: - // 00 00 00 00 00 00 00 00 00 00 FF FF 7F 00 00 01 - unsigned short port; - } netadr_t; +typedef struct netadr_s +{ + netadrtype_t type; + unsigned char ip[16]; // IPv6 + // IPv4's 127.0.0.1 is [::ffff:127.0.0.1], that is: + // 00 00 00 00 00 00 00 00 00 00 FF FF 7F 00 00 01 + unsigned short port; +} netadr_t; #pragma pack(pop) #pragma pack(push, 1) - typedef struct netpacket_s - { - netadr_t adr; // sender address - // int source; // received source - char unk[10]; - double received_time; - unsigned char* data; // pointer to raw packet data - void* message; // easy bitbuf data access // 'inpacket.message' etc etc (pointer) - char unk2[16]; - int size; - - // bf_read message; // easy bitbuf data access // 'inpacket.message' etc etc (pointer) - // int size; // size in bytes - // int wiresize; // size in bytes before decompression - // bool stream; // was send as stream - // struct netpacket_s* pNext; // for internal use, should be NULL in public - } netpacket_t; +typedef struct netpacket_s +{ + netadr_t adr; // sender address + // int source; // received source + char unk[10]; + double received_time; + unsigned char* data; // pointer to raw packet data + void* message; // easy bitbuf data access // 'inpacket.message' etc etc (pointer) + char unk2[16]; + int size; + + // bf_read message; // easy bitbuf data access // 'inpacket.message' etc etc (pointer) + // int size; // size in bytes + // int wiresize; // size in bytes before decompression + // bool stream; // was send as stream + // struct netpacket_s* pNext; // for internal use, should be NULL in public +} netpacket_t; #pragma pack(pop) - // #56169 $DB69 PData size - // #512 $200 Trailing data - // #100 $64 Safety buffer - const int PERSISTENCE_MAX_SIZE = 0xDDCD; - - // note: NOT_READY and READY are the only entries we have here that are defined by the vanilla game - // entries after this are custom and used to determine the source of persistence, e.g. whether it is local or remote - enum class ePersistenceReady : char - { - NOT_READY, - READY = 3, - READY_INSECURE = 3, - READY_REMOTE - }; - - enum class eSignonState : int - { - NONE = 0, // no state yet; about to connect - CHALLENGE = 1, // client challenging server; all OOB packets - CONNECTED = 2, // client is connected to server; netchans ready - NEW = 3, // just got serverinfo and string tables - PRESPAWN = 4, // received signon buffers - GETTINGDATA = 5, // respawn-defined signonstate, assumedly this is for persistence - SPAWN = 6, // ready to receive entity packets - FIRSTSNAP = 7, // another respawn-defined one - FULL = 8, // we are fully connected; first non-delta packet received - CHANGELEVEL = 9, // server is changing level; please wait - }; - - // clang-format off - OFFSET_STRUCT(CBaseClient) - { - STRUCT_SIZE(0x2D728) - FIELD(0x16, char m_Name[64]) - FIELD(0x258, KeyValues* m_ConVars) - FIELD(0x2A0, eSignonState m_Signon) - FIELD(0x358, char m_ClanTag[16]) - FIELD(0x484, bool m_bFakePlayer) - FIELD(0x4A0, ePersistenceReady m_iPersistenceReady) - FIELD(0x4FA, char m_PersistenceBuffer[PERSISTENCE_MAX_SIZE]) - FIELD(0xF500, char m_UID[32]) - }; - // clang-format on - - extern CBaseClient* g_pClientArray; - - enum server_state_t - { - ss_dead = 0, // Dead - ss_loading, // Spawning - ss_active, // Running - ss_paused, // Running, but paused - }; - - extern server_state_t* g_pServerState; - - extern char* g_pModName; - - // clang-format off - OFFSET_STRUCT(CGlobalVars) - { - FIELD(0x0, - // Absolute time (per frame still - Use Plat_FloatTime() for a high precision real time - // perf clock, but not that it doesn't obey host_timescale/host_framerate) - double m_flRealTime); - - FIELDS(0x8, - // Absolute frame counter - continues to increase even if game is paused - int m_nFrameCount; +// #56169 $DB69 PData size +// #512 $200 Trailing data +// #100 $64 Safety buffer +const int PERSISTENCE_MAX_SIZE = 0xDDCD; + +// note: NOT_READY and READY are the only entries we have here that are defined by the vanilla game +// entries after this are custom and used to determine the source of persistence, e.g. whether it is local or remote +enum class ePersistenceReady : char +{ + NOT_READY, + READY = 3, + READY_INSECURE = 3, + READY_REMOTE +}; + +enum class eSignonState : int +{ + NONE = 0, // no state yet; about to connect + CHALLENGE = 1, // client challenging server; all OOB packets + CONNECTED = 2, // client is connected to server; netchans ready + NEW = 3, // just got serverinfo and string tables + PRESPAWN = 4, // received signon buffers + GETTINGDATA = 5, // respawn-defined signonstate, assumedly this is for persistence + SPAWN = 6, // ready to receive entity packets + FIRSTSNAP = 7, // another respawn-defined one + FULL = 8, // we are fully connected; first non-delta packet received + CHANGELEVEL = 9, // server is changing level; please wait +}; + +// clang-format off +OFFSET_STRUCT(CBaseClient) +{ + STRUCT_SIZE(0x2D728) + FIELD(0x16, char m_Name[64]) + FIELD(0x258, KeyValues* m_ConVars) + FIELD(0x2A0, eSignonState m_Signon) + FIELD(0x358, char m_ClanTag[16]) + FIELD(0x484, bool m_bFakePlayer) + FIELD(0x4A0, ePersistenceReady m_iPersistenceReady) + FIELD(0x4FA, char m_PersistenceBuffer[PERSISTENCE_MAX_SIZE]) + FIELD(0xF500, char m_UID[32]) +}; +// clang-format on + +extern CBaseClient* g_pClientArray; + +enum server_state_t +{ + ss_dead = 0, // Dead + ss_loading, // Spawning + ss_active, // Running + ss_paused, // Running, but paused +}; + +extern server_state_t* g_pServerState; + +extern char* g_pModName; + +// clang-format off +OFFSET_STRUCT(CGlobalVars) +{ + FIELD(0x0, + // Absolute time (per frame still - Use Plat_FloatTime() for a high precision real time + // perf clock, but not that it doesn't obey host_timescale/host_framerate) + double m_flRealTime); + + FIELDS(0x8, + // Absolute frame counter - continues to increase even if game is paused + int m_nFrameCount; - // Non-paused frametime - float m_flAbsoluteFrameTime; + // Non-paused frametime + float m_flAbsoluteFrameTime; - // Current time - // - // On the client, this (along with tickcount) takes a different meaning based on what - // piece of code you're in: - // - // - While receiving network packets (like in PreDataUpdate/PostDataUpdate and proxies), - // this is set to the SERVER TICKCOUNT for that packet. There is no interval between - // the server ticks. - // [server_current_Tick * tick_interval] - // - // - While rendering, this is the exact client clock - // [client_current_tick * tick_interval + interpolation_amount] - // - // - During prediction, this is based on the client's current tick: - // [client_current_tick * tick_interval] - float m_flCurTime; - ) - - FIELDS(0x30, - // Time spent on last server or client frame (has nothing to do with think intervals) - float m_flFrameTime; - - // current maxplayers setting - int m_nMaxClients; - ) - - FIELDS(0x3C, - // Simulation ticks - does not increase when game is paused - uint32_t m_nTickCount; // this is weird and doesn't seem to increase once per frame? - - // Simulation tick interval - float m_flTickInterval; - ) - - FIELDS(0x60, - const char* m_pMapName; - int m_nMapVersion; - ) - - //FIELD(0x98, double m_flRealTime); // again? - }; - // clang-format on - - extern CGlobalVars* g_pGlobals; -} // namespace R2 + // Current time + // + // On the client, this (along with tickcount) takes a different meaning based on what + // piece of code you're in: + // + // - While receiving network packets (like in PreDataUpdate/PostDataUpdate and proxies), + // this is set to the SERVER TICKCOUNT for that packet. There is no interval between + // the server ticks. + // [server_current_Tick * tick_interval] + // + // - While rendering, this is the exact client clock + // [client_current_tick * tick_interval + interpolation_amount] + // + // - During prediction, this is based on the client's current tick: + // [client_current_tick * tick_interval] + float m_flCurTime; + ) + + FIELDS(0x30, + // Time spent on last server or client frame (has nothing to do with think intervals) + float m_flFrameTime; + + // current maxplayers setting + int m_nMaxClients; + ) + + FIELDS(0x3C, + // Simulation ticks - does not increase when game is paused + uint32_t m_nTickCount; // this is weird and doesn't seem to increase once per frame? + + // Simulation tick interval + float m_flTickInterval; + ) + + FIELDS(0x60, + const char* m_pMapName; + int m_nMapVersion; + ) + + //FIELD(0x98, double m_flRealTime); // again? +}; +// clang-format on + +extern CGlobalVars* g_pGlobals; diff --git a/NorthstarDLL/engine/runframe.cpp b/NorthstarDLL/engine/runframe.cpp index 40a619bbc..ddfd92534 100644 --- a/NorthstarDLL/engine/runframe.cpp +++ b/NorthstarDLL/engine/runframe.cpp @@ -7,7 +7,7 @@ AUTOHOOK_INIT() // clang-format off AUTOHOOK(CEngine__Frame, engine.dll + 0x1C8650, -void, __fastcall, (R2::CEngine* self)) +void, __fastcall, (CEngine* self)) // clang-format on { CEngine__Frame(self); diff --git a/NorthstarDLL/masterserver/masterserver.cpp b/NorthstarDLL/masterserver/masterserver.cpp index 53a5fa9a8..aa2484644 100644 --- a/NorthstarDLL/masterserver/masterserver.cpp +++ b/NorthstarDLL/masterserver/masterserver.cpp @@ -64,7 +64,7 @@ void SetCommonHttpClientOptions(CURL* curl) // seconds. curl_easy_setopt(curl, CURLOPT_TIMEOUT, 30L); // curl_easy_setopt(curl, CURLOPT_STDERR, stdout); - if (Tier0::CommandLine()->FindParm("-msinsecure")) // TODO: this check doesn't seem to work + if (CommandLine()->FindParm("-msinsecure")) // TODO: this check doesn't seem to work { curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); @@ -589,7 +589,7 @@ void MasterServerManager::AuthenticateWithOwnServer(const char* uid, const char* if (m_bNewgameAfterSelfAuth) { // pretty sure this is threadsafe? - R2::Cbuf_AddText(R2::Cbuf_GetCurrentPlayer(), "ns_end_reauth_and_leave_to_lobby", R2::cmd_source_t::kCommandSrcCode); + Cbuf_AddText(Cbuf_GetCurrentPlayer(), "ns_end_reauth_and_leave_to_lobby", cmd_source_t::kCommandSrcCode); m_bNewgameAfterSelfAuth = false; } @@ -897,12 +897,12 @@ void MasterServerManager::ProcessConnectionlessPacketSigreq1(std::string data) return; } - if (pdata.length() > R2::PERSISTENCE_MAX_SIZE) + if (pdata.length() > PERSISTENCE_MAX_SIZE) { spdlog::error( "failed to make Atlas connect pdata request {}: pdata is too large (max={} len={})", token, - R2::PERSISTENCE_MAX_SIZE, + PERSISTENCE_MAX_SIZE, pdata.length()); return; } @@ -1022,7 +1022,7 @@ void MasterServerPresenceReporter::ReportPresence(const ServerPresence* pServerP } // Make sure to wait til the cooldown is over for DUPLICATE_SERVER failures. - if (Tier0::Plat_FloatTime() < m_fNextAddServerAttemptTime) + if (Plat_FloatTime() < m_fNextAddServerAttemptTime) { return; } @@ -1124,7 +1124,7 @@ void MasterServerPresenceReporter::RunFrame(double flCurrentTime, const ServerPr case MasterServerReportPresenceResult::FailedDuplicateServer: ++m_nNumRegistrationAttempts; // Wait at least twenty seconds until we re-attempt to add the server. - m_fNextAddServerAttemptTime = Tier0::Plat_FloatTime() + 20.0f; + m_fNextAddServerAttemptTime = Plat_FloatTime() + 20.0f; break; } diff --git a/NorthstarDLL/mods/compiled/kb_act.cpp b/NorthstarDLL/mods/compiled/kb_act.cpp index 3fc7ee309..6117fd280 100644 --- a/NorthstarDLL/mods/compiled/kb_act.cpp +++ b/NorthstarDLL/mods/compiled/kb_act.cpp @@ -14,7 +14,7 @@ void ModManager::BuildKBActionsList() std::ofstream soCompiledKeys(GetCompiledAssetsPath() / KB_ACT_PATH, std::ios::binary); // write vanilla file's content to compiled file - soCompiledKeys << R2::ReadVPKOriginalFile(KB_ACT_PATH); + soCompiledKeys << ReadVPKOriginalFile(KB_ACT_PATH); for (Mod& mod : m_LoadedMods) { diff --git a/NorthstarDLL/mods/compiled/modkeyvalues.cpp b/NorthstarDLL/mods/compiled/modkeyvalues.cpp index fe262a607..e44a81d31 100644 --- a/NorthstarDLL/mods/compiled/modkeyvalues.cpp +++ b/NorthstarDLL/mods/compiled/modkeyvalues.cpp @@ -56,7 +56,7 @@ void ModManager::TryBuildKeyValues(const char* filename) newKvs += "\"\n"; // load original file, so we can parse out the name of the root obj (e.g. WeaponData for weapons) - std::string originalFile = R2::ReadVPKOriginalFile(filename); + std::string originalFile = ReadVPKOriginalFile(filename); if (!originalFile.length()) { diff --git a/NorthstarDLL/mods/compiled/modpdef.cpp b/NorthstarDLL/mods/compiled/modpdef.cpp index 4b1b12b76..d268a063f 100644 --- a/NorthstarDLL/mods/compiled/modpdef.cpp +++ b/NorthstarDLL/mods/compiled/modpdef.cpp @@ -15,7 +15,7 @@ void ModManager::BuildPdef() fs::path MOD_PDEF_PATH = fs::path(GetCompiledAssetsPath() / MOD_PDEF_SUFFIX); fs::remove(MOD_PDEF_PATH); - std::string pdef = R2::ReadVPKOriginalFile(VPK_PDEF_PATH); + std::string pdef = ReadVPKOriginalFile(VPK_PDEF_PATH); for (Mod& mod : m_LoadedMods) { diff --git a/NorthstarDLL/mods/compiled/modscriptsrson.cpp b/NorthstarDLL/mods/compiled/modscriptsrson.cpp index cbe266514..d130745fe 100644 --- a/NorthstarDLL/mods/compiled/modscriptsrson.cpp +++ b/NorthstarDLL/mods/compiled/modscriptsrson.cpp @@ -13,7 +13,7 @@ void ModManager::BuildScriptsRson() fs::path MOD_SCRIPTS_RSON_PATH = fs::path(GetCompiledAssetsPath() / MOD_SCRIPTS_RSON_SUFFIX); fs::remove(MOD_SCRIPTS_RSON_PATH); - std::string scriptsRson = R2::ReadVPKOriginalFile(VPK_SCRIPTS_RSON_PATH); + std::string scriptsRson = ReadVPKOriginalFile(VPK_SCRIPTS_RSON_PATH); scriptsRson += "\n\n// START MODDED SCRIPT CONTENT\n\n"; // newline before we start custom stuff for (Mod& mod : m_LoadedMods) diff --git a/NorthstarDLL/mods/modmanager.cpp b/NorthstarDLL/mods/modmanager.cpp index 982f50682..8a0eb71d1 100644 --- a/NorthstarDLL/mods/modmanager.cpp +++ b/NorthstarDLL/mods/modmanager.cpp @@ -760,7 +760,7 @@ void ModManager::LoadMods() { // make sure convar isn't registered yet, unsure if necessary but idk what // behaviour is for defining same convar multiple times - if (!R2::g_pCVar->FindVar(convar->Name.c_str())) + if (!g_pCVar->FindVar(convar->Name.c_str())) { new ConVar(convar->Name.c_str(), convar->DefaultValue.c_str(), convar->Flags, convar->HelpString.c_str()); } @@ -769,7 +769,7 @@ void ModManager::LoadMods() for (ModConCommand* command : mod.ConCommands) { // make sure command isnt't registered multiple times. - if (!R2::g_pCVar->FindCommand(command->Name.c_str())) + if (!g_pCVar->FindCommand(command->Name.c_str())) { ConCommand* newCommand = new ConCommand(); std::string funcName = command->Function; @@ -818,7 +818,7 @@ void ModManager::LoadMods() modVpk.m_sVpkPath = (file.path().parent_path() / vpkName).string(); if (m_bHasLoadedMods && modVpk.m_bAutoLoad) - (*R2::g_pFilesystem)->m_vtable->MountVPK(*R2::g_pFilesystem, vpkName.c_str()); + (*g_pFilesystem)->m_vtable->MountVPK(*g_pFilesystem, vpkName.c_str()); } } } diff --git a/NorthstarDLL/mods/modsavefiles.cpp b/NorthstarDLL/mods/modsavefiles.cpp index f8e5848c6..68e33864b 100644 --- a/NorthstarDLL/mods/modsavefiles.cpp +++ b/NorthstarDLL/mods/modsavefiles.cpp @@ -561,9 +561,9 @@ ON_DLL_LOAD("engine.dll", ModSaveFFiles_Init, (CModule module)) { savePath = fs::path(GetNorthstarPrefix()) / "save_data"; g_pSaveFileManager = new SaveFileManager; - int parm = Tier0::CommandLine()->FindParm("-maxfoldersize"); + int parm = CommandLine()->FindParm("-maxfoldersize"); if (parm) - MAX_FOLDER_SIZE = std::stoi(Tier0::CommandLine()->GetParm(parm)); + MAX_FOLDER_SIZE = std::stoi(CommandLine()->GetParm(parm)); } int GetMaxSaveFolderSize() diff --git a/NorthstarDLL/scripts/client/clientchathooks.cpp b/NorthstarDLL/scripts/client/clientchathooks.cpp index df9497ef9..e084f47e9 100644 --- a/NorthstarDLL/scripts/client/clientchathooks.cpp +++ b/NorthstarDLL/scripts/client/clientchathooks.cpp @@ -30,7 +30,7 @@ void, __fastcall, (void* self, const char* message, int inboxId, bool isTeam, bo payload = message + 1; } - NS::Utils::RemoveAsciiControlSequences(const_cast(message), true); + RemoveAsciiControlSequences(const_cast(message), true); SQRESULT result = g_pSquirrel->Call( "CHudChat_ProcessMessageStartThread", static_cast(senderId) - 1, payload, isTeam, isDead, type); diff --git a/NorthstarDLL/scripts/client/scriptserverbrowser.cpp b/NorthstarDLL/scripts/client/scriptserverbrowser.cpp index 1945b3dc9..a142c3f4e 100644 --- a/NorthstarDLL/scripts/client/scriptserverbrowser.cpp +++ b/NorthstarDLL/scripts/client/scriptserverbrowser.cpp @@ -62,7 +62,7 @@ ADD_SQFUNC("void", NSTryAuthWithServer, "int serverIndex, string password = ''", // do auth g_pMasterServerManager->AuthenticateWithServer( - R2::g_pLocalPlayerUserID, + g_pLocalPlayerUserID, g_pMasterServerManager->m_sOwnClientAuthToken, g_pMasterServerManager->m_vRemoteServers[serverIndex], (char*)password); @@ -95,9 +95,9 @@ ADD_SQFUNC("void", NSConnectToAuthedServer, "", "", ScriptContext::UI) // set auth token, then try to connect // i'm honestly not entirely sure how silentconnect works regarding ports and encryption so using connect for now - R2::g_pCVar->FindVar("serverfilter")->SetValue(info.authToken); - R2::Cbuf_AddText( - R2::Cbuf_GetCurrentPlayer(), + g_pCVar->FindVar("serverfilter")->SetValue(info.authToken); + Cbuf_AddText( + Cbuf_GetCurrentPlayer(), fmt::format( "connect {}.{}.{}.{}:{}", info.ip.S_un.S_un_b.s_b1, @@ -106,7 +106,7 @@ ADD_SQFUNC("void", NSConnectToAuthedServer, "", "", ScriptContext::UI) info.ip.S_un.S_un_b.s_b4, info.port) .c_str(), - R2::cmd_source_t::kCommandSrcCode); + cmd_source_t::kCommandSrcCode); g_pMasterServerManager->m_bHasPendingConnectionInfo = false; return SQRESULT_NULL; @@ -115,7 +115,7 @@ ADD_SQFUNC("void", NSConnectToAuthedServer, "", "", ScriptContext::UI) ADD_SQFUNC("void", NSTryAuthWithLocalServer, "", "", ScriptContext::UI) { // do auth request - g_pMasterServerManager->AuthenticateWithOwnServer(R2::g_pLocalPlayerUserID, g_pMasterServerManager->m_sOwnClientAuthToken); + g_pMasterServerManager->AuthenticateWithOwnServer(g_pLocalPlayerUserID, g_pMasterServerManager->m_sOwnClientAuthToken); return SQRESULT_NULL; } @@ -125,7 +125,7 @@ ADD_SQFUNC("void", NSCompleteAuthWithLocalServer, "", "", ScriptContext::UI) // literally just set serverfilter // note: this assumes we have no authdata other than our own if (g_pServerAuthentication->m_RemoteAuthenticationData.size()) - R2::g_pCVar->FindVar("serverfilter")->SetValue(g_pServerAuthentication->m_RemoteAuthenticationData.begin()->first.c_str()); + g_pCVar->FindVar("serverfilter")->SetValue(g_pServerAuthentication->m_RemoteAuthenticationData.begin()->first.c_str()); return SQRESULT_NULL; } diff --git a/NorthstarDLL/scripts/scriptdatatables.cpp b/NorthstarDLL/scripts/scriptdatatables.cpp index 532624f39..87a26dca0 100644 --- a/NorthstarDLL/scripts/scriptdatatables.cpp +++ b/NorthstarDLL/scripts/scriptdatatables.cpp @@ -132,9 +132,9 @@ REPLACE_SQFUNC(GetDataTable, (ScriptContext::UI | ScriptContext::CLIENT | Script diskAssetPath /= fs::path(pAssetName); std::string sDiskAssetPath(diskAssetPath.string()); - if ((*R2::g_pFilesystem)->m_vtable2->FileExists(&(*R2::g_pFilesystem)->m_vtable2, sDiskAssetPath.c_str(), "GAME")) + if ((*g_pFilesystem)->m_vtable2->FileExists(&(*g_pFilesystem)->m_vtable2, sDiskAssetPath.c_str(), "GAME")) { - std::string sTableCSV = R2::ReadVPKFile(sDiskAssetPath.c_str()); + std::string sTableCSV = ReadVPKFile(sDiskAssetPath.c_str()); if (!sTableCSV.size()) { g_pSquirrel->raiseerror(sqvm, fmt::format("Datatable \"{}\" is empty", pAssetName).c_str()); @@ -793,7 +793,7 @@ void DumpDatatable(const char* pDatatablePath) return; } - std::string sOutputPath(fmt::format("{}/scripts/datatable/{}.csv", R2::g_pModName, fs::path(pDatatablePath).stem().string())); + std::string sOutputPath(fmt::format("{}/scripts/datatable/{}.csv", g_pModName, fs::path(pDatatablePath).stem().string())); std::string sDatatableContents(DataTableToString(pDatatable)); fs::create_directories(fs::path(sOutputPath).remove_filename()); @@ -900,7 +900,7 @@ ON_DLL_LOAD_RELIESON("engine.dll", SharedScriptDataTables, ConVar, (CModule modu { Cvar_ns_prefer_datatable_from_disk = new ConVar( "ns_prefer_datatable_from_disk", - IsDedicatedServer() && Tier0::CommandLine()->CheckParm("-nopakdedi") ? "1" : "0", + IsDedicatedServer() && CommandLine()->CheckParm("-nopakdedi") ? "1" : "0", FCVAR_NONE, "whether to prefer loading datatables from disk, rather than rpak"); diff --git a/NorthstarDLL/scripts/scripthttprequesthandler.cpp b/NorthstarDLL/scripts/scripthttprequesthandler.cpp index 813bd50e8..aa75127a6 100644 --- a/NorthstarDLL/scripts/scripthttprequesthandler.cpp +++ b/NorthstarDLL/scripts/scripthttprequesthandler.cpp @@ -7,19 +7,19 @@ HttpRequestHandler* g_httpRequestHandler; bool IsHttpDisabled() { - const static bool bIsHttpDisabled = Tier0::CommandLine()->FindParm("-disablehttprequests"); + const static bool bIsHttpDisabled = CommandLine()->FindParm("-disablehttprequests"); return bIsHttpDisabled; } bool IsLocalHttpAllowed() { - const static bool bIsLocalHttpAllowed = Tier0::CommandLine()->FindParm("-allowlocalhttp"); + const static bool bIsLocalHttpAllowed = CommandLine()->FindParm("-allowlocalhttp"); return bIsLocalHttpAllowed; } bool DisableHttpSsl() { - const static bool bDisableHttpSsl = Tier0::CommandLine()->FindParm("-disablehttpssl"); + const static bool bDisableHttpSsl = CommandLine()->FindParm("-disablehttpssl"); return bDisableHttpSsl; } diff --git a/NorthstarDLL/scripts/scriptutility.cpp b/NorthstarDLL/scripts/scriptutility.cpp index 054836caf..4b92fa024 100644 --- a/NorthstarDLL/scripts/scriptutility.cpp +++ b/NorthstarDLL/scripts/scriptutility.cpp @@ -18,9 +18,9 @@ ADD_SQFUNC( ADD_SQFUNC( "string", NSGetLocalPlayerUID, "", "Returns the local player's uid.", ScriptContext::UI | ScriptContext::CLIENT | ScriptContext::SERVER) { - if (R2::g_pLocalPlayerUserID) + if (g_pLocalPlayerUserID) { - g_pSquirrel->pushstring(sqvm, R2::g_pLocalPlayerUserID); + g_pSquirrel->pushstring(sqvm, g_pLocalPlayerUserID); return SQRESULT_NOTNULL; } diff --git a/NorthstarDLL/scripts/server/miscserverscript.cpp b/NorthstarDLL/scripts/server/miscserverscript.cpp index 3ea44cebb..ed6e48001 100644 --- a/NorthstarDLL/scripts/server/miscserverscript.cpp +++ b/NorthstarDLL/scripts/server/miscserverscript.cpp @@ -9,7 +9,7 @@ ADD_SQFUNC("void", NSEarlyWritePlayerPersistenceForLeave, "entity player", "", ScriptContext::SERVER) { - const R2::CBasePlayer* pPlayer = g_pSquirrel->template getentity(sqvm, 1); + const CBasePlayer* pPlayer = g_pSquirrel->template getentity(sqvm, 1); if (!pPlayer) { spdlog::warn("NSEarlyWritePlayerPersistenceForLeave got null player"); @@ -18,7 +18,7 @@ ADD_SQFUNC("void", NSEarlyWritePlayerPersistenceForLeave, "entity player", "", S return SQRESULT_NOTNULL; } - R2::CBaseClient* pClient = &R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1]; + CBaseClient* pClient = &g_pClientArray[pPlayer->m_nPlayerIndex - 1]; if (g_pServerAuthentication->m_PlayerAuthenticationData.find(pClient) == g_pServerAuthentication->m_PlayerAuthenticationData.end()) { g_pSquirrel->pushbool(sqvm, false); @@ -38,7 +38,7 @@ ADD_SQFUNC("bool", NSIsWritingPlayerPersistence, "", "", ScriptContext::SERVER) ADD_SQFUNC("bool", NSIsPlayerLocalPlayer, "entity player", "", ScriptContext::SERVER) { - const R2::CBasePlayer* pPlayer = g_pSquirrel->template getentity(sqvm, 1); + const CBasePlayer* pPlayer = g_pSquirrel->template getentity(sqvm, 1); if (!pPlayer) { spdlog::warn("NSIsPlayerLocalPlayer got null player"); @@ -47,8 +47,8 @@ ADD_SQFUNC("bool", NSIsPlayerLocalPlayer, "entity player", "", ScriptContext::SE return SQRESULT_NOTNULL; } - R2::CBaseClient* pClient = &R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1]; - g_pSquirrel->pushbool(sqvm, !strcmp(R2::g_pLocalPlayerUserID, pClient->m_UID)); + CBaseClient* pClient = &g_pClientArray[pPlayer->m_nPlayerIndex - 1]; + g_pSquirrel->pushbool(sqvm, !strcmp(g_pLocalPlayerUserID, pClient->m_UID)); return SQRESULT_NOTNULL; } @@ -65,7 +65,7 @@ ADD_SQFUNC( "Disconnects the player from the server with the given reason", ScriptContext::SERVER) { - const R2::CBasePlayer* pPlayer = g_pSquirrel->template getentity(sqvm, 1); + const CBasePlayer* pPlayer = g_pSquirrel->template getentity(sqvm, 1); const char* reason = g_pSquirrel->getstring(sqvm, 2); if (!pPlayer) @@ -77,7 +77,7 @@ ADD_SQFUNC( } // Shouldn't happen but I like sanity checks. - R2::CBaseClient* pClient = &R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1]; + CBaseClient* pClient = &g_pClientArray[pPlayer->m_nPlayerIndex - 1]; if (!pClient) { spdlog::warn("NSDisconnectPlayer(): player entity has null CBaseClient!"); @@ -88,11 +88,11 @@ ADD_SQFUNC( if (reason) { - R2::CBaseClient__Disconnect(pClient, 1, reason); + CBaseClient__Disconnect(pClient, 1, reason); } else { - R2::CBaseClient__Disconnect(pClient, 1, "Disconnected by the server."); + CBaseClient__Disconnect(pClient, 1, "Disconnected by the server."); } g_pSquirrel->pushbool(sqvm, true); diff --git a/NorthstarDLL/scripts/server/scriptuserinfo.cpp b/NorthstarDLL/scripts/server/scriptuserinfo.cpp index fac458a3a..c53a9d223 100644 --- a/NorthstarDLL/scripts/server/scriptuserinfo.cpp +++ b/NorthstarDLL/scripts/server/scriptuserinfo.cpp @@ -7,7 +7,7 @@ ADD_SQFUNC("string", GetUserInfoKVString_Internal, "entity player, string key, s "Gets the string value of a given player's userinfo convar by name", ScriptContext::SERVER) // clang-format on { - const R2::CBasePlayer* pPlayer = g_pSquirrel->template getentity(sqvm, 1); + const CBasePlayer* pPlayer = g_pSquirrel->template getentity(sqvm, 1); if (!pPlayer) { g_pSquirrel->raiseerror(sqvm, "player is null"); @@ -17,7 +17,7 @@ ADD_SQFUNC("string", GetUserInfoKVString_Internal, "entity player, string key, s const char* pKey = g_pSquirrel->getstring(sqvm, 2); const char* pDefaultValue = g_pSquirrel->getstring(sqvm, 3); - const char* pResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetString(pKey, pDefaultValue); + const char* pResult = g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetString(pKey, pDefaultValue); g_pSquirrel->pushstring(sqvm, pResult); return SQRESULT_NOTNULL; } @@ -27,7 +27,7 @@ ADD_SQFUNC("asset", GetUserInfoKVAsset_Internal, "entity player, string key, ass "Gets the asset value of a given player's userinfo convar by name", ScriptContext::SERVER) // clang-format on { - const R2::CBasePlayer* pPlayer = g_pSquirrel->template getentity(sqvm, 1); + const CBasePlayer* pPlayer = g_pSquirrel->template getentity(sqvm, 1); if (!pPlayer) { g_pSquirrel->raiseerror(sqvm, "player is null"); @@ -38,7 +38,7 @@ ADD_SQFUNC("asset", GetUserInfoKVAsset_Internal, "entity player, string key, ass const char* pDefaultValue; g_pSquirrel->getasset(sqvm, 3, &pDefaultValue); - const char* pResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetString(pKey, pDefaultValue); + const char* pResult = g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetString(pKey, pDefaultValue); g_pSquirrel->pushasset(sqvm, pResult); return SQRESULT_NOTNULL; } @@ -48,7 +48,7 @@ ADD_SQFUNC("int", GetUserInfoKVInt_Internal, "entity player, string key, int def "Gets the int value of a given player's userinfo convar by name", ScriptContext::SERVER) // clang-format on { - const R2::CBasePlayer* pPlayer = g_pSquirrel->template getentity(sqvm, 1); + const CBasePlayer* pPlayer = g_pSquirrel->template getentity(sqvm, 1); if (!pPlayer) { g_pSquirrel->raiseerror(sqvm, "player is null"); @@ -58,7 +58,7 @@ ADD_SQFUNC("int", GetUserInfoKVInt_Internal, "entity player, string key, int def const char* pKey = g_pSquirrel->getstring(sqvm, 2); const int iDefaultValue = g_pSquirrel->getinteger(sqvm, 3); - const int iResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetInt(pKey, iDefaultValue); + const int iResult = g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetInt(pKey, iDefaultValue); g_pSquirrel->pushinteger(sqvm, iResult); return SQRESULT_NOTNULL; } @@ -68,7 +68,7 @@ ADD_SQFUNC("float", GetUserInfoKVFloat_Internal, "entity player, string key, flo "Gets the float value of a given player's userinfo convar by name", ScriptContext::SERVER) // clang-format on { - const R2::CBasePlayer* pPlayer = g_pSquirrel->getentity(sqvm, 1); + const CBasePlayer* pPlayer = g_pSquirrel->getentity(sqvm, 1); if (!pPlayer) { g_pSquirrel->raiseerror(sqvm, "player is null"); @@ -78,7 +78,7 @@ ADD_SQFUNC("float", GetUserInfoKVFloat_Internal, "entity player, string key, flo const char* pKey = g_pSquirrel->getstring(sqvm, 2); const float flDefaultValue = g_pSquirrel->getfloat(sqvm, 3); - const float flResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetFloat(pKey, flDefaultValue); + const float flResult = g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetFloat(pKey, flDefaultValue); g_pSquirrel->pushfloat(sqvm, flResult); return SQRESULT_NOTNULL; } @@ -88,7 +88,7 @@ ADD_SQFUNC("bool", GetUserInfoKVBool_Internal, "entity player, string key, bool "Gets the bool value of a given player's userinfo convar by name", ScriptContext::SERVER) // clang-format on { - const R2::CBasePlayer* pPlayer = g_pSquirrel->getentity(sqvm, 1); + const CBasePlayer* pPlayer = g_pSquirrel->getentity(sqvm, 1); if (!pPlayer) { g_pSquirrel->raiseerror(sqvm, "player is null"); @@ -98,7 +98,7 @@ ADD_SQFUNC("bool", GetUserInfoKVBool_Internal, "entity player, string key, bool const char* pKey = g_pSquirrel->getstring(sqvm, 2); const bool bDefaultValue = g_pSquirrel->getbool(sqvm, 3); - const bool bResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetInt(pKey, bDefaultValue); + const bool bResult = g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetInt(pKey, bDefaultValue); g_pSquirrel->pushbool(sqvm, bResult); return SQRESULT_NOTNULL; } diff --git a/NorthstarDLL/server/alltalk.cpp b/NorthstarDLL/server/alltalk.cpp index d71b0bae6..74119309f 100644 --- a/NorthstarDLL/server/alltalk.cpp +++ b/NorthstarDLL/server/alltalk.cpp @@ -4,12 +4,12 @@ size_t __fastcall ShouldAllowAlltalk() { // this needs to return a 64 bit integer where 0 = true and 1 = false - static ConVar* Cvar_sv_alltalk = R2::g_pCVar->FindVar("sv_alltalk"); + static ConVar* Cvar_sv_alltalk = g_pCVar->FindVar("sv_alltalk"); if (Cvar_sv_alltalk->GetBool()) return 0; // lobby should default to alltalk, otherwise don't allow it - return strcmp(R2::g_pGlobals->m_pMapName, "mp_lobby"); + return strcmp(g_pGlobals->m_pMapName, "mp_lobby"); } ON_DLL_LOAD_RELIESON("engine.dll", ServerAllTalk, ConVar, (CModule module)) diff --git a/NorthstarDLL/server/auth/bansystem.cpp b/NorthstarDLL/server/auth/bansystem.cpp index 9b9d24c43..a45cde939 100644 --- a/NorthstarDLL/server/auth/bansystem.cpp +++ b/NorthstarDLL/server/auth/bansystem.cpp @@ -173,7 +173,7 @@ void ServerBanSystem::UnbanUID(uint64_t uid) bool ServerBanSystem::IsUIDAllowed(uint64_t uid) { - uint64_t localPlayerUserID = strtoull(R2::g_pLocalPlayerUserID, nullptr, 10); + uint64_t localPlayerUserID = strtoull(g_pLocalPlayerUserID, nullptr, 10); if (localPlayerUserID == uid) return true; @@ -186,14 +186,14 @@ void ConCommand_ban(const CCommand& args) if (args.ArgC() < 2) return; - for (int i = 0; i < R2::g_pGlobals->m_nMaxClients; i++) + for (int i = 0; i < g_pGlobals->m_nMaxClients; i++) { - R2::CBaseClient* player = &R2::g_pClientArray[i]; + CBaseClient* player = &g_pClientArray[i]; if (!strcmp(player->m_Name, args.Arg(1)) || !strcmp(player->m_UID, args.Arg(1))) { g_pBanSystem->BanUID(strtoull(player->m_UID, nullptr, 10)); - R2::CBaseClient__Disconnect(player, 1, "Banned from server"); + CBaseClient__Disconnect(player, 1, "Banned from server"); break; } } diff --git a/NorthstarDLL/server/auth/serverauthentication.cpp b/NorthstarDLL/server/auth/serverauthentication.cpp index d5653dccf..0d46426fe 100644 --- a/NorthstarDLL/server/auth/serverauthentication.cpp +++ b/NorthstarDLL/server/auth/serverauthentication.cpp @@ -40,7 +40,7 @@ void ServerAuthenticationManager::AddRemotePlayer(std::string token, uint64_t ui m_RemoteAuthenticationData[token] = newAuthData; } -void ServerAuthenticationManager::AddPlayer(R2::CBaseClient* pPlayer, const char* pToken) +void ServerAuthenticationManager::AddPlayer(CBaseClient* pPlayer, const char* pToken) { PlayerAuthenticationData additionalData; @@ -48,14 +48,14 @@ void ServerAuthenticationManager::AddPlayer(R2::CBaseClient* pPlayer, const char if (remoteAuthData != m_RemoteAuthenticationData.end()) additionalData.pdataSize = remoteAuthData->second.pdataSize; else - additionalData.pdataSize = R2::PERSISTENCE_MAX_SIZE; + additionalData.pdataSize = PERSISTENCE_MAX_SIZE; - additionalData.usingLocalPdata = pPlayer->m_iPersistenceReady == R2::ePersistenceReady::READY_INSECURE; + additionalData.usingLocalPdata = pPlayer->m_iPersistenceReady == ePersistenceReady::READY_INSECURE; m_PlayerAuthenticationData.insert(std::make_pair(pPlayer, additionalData)); } -void ServerAuthenticationManager::RemovePlayer(R2::CBaseClient* pPlayer) +void ServerAuthenticationManager::RemovePlayer(CBaseClient* pPlayer) { if (m_PlayerAuthenticationData.count(pPlayer)) m_PlayerAuthenticationData.erase(pPlayer); @@ -88,20 +88,20 @@ bool ServerAuthenticationManager::VerifyPlayerName(const char* pAuthToken, const return true; } -bool ServerAuthenticationManager::IsDuplicateAccount(R2::CBaseClient* pPlayer, const char* pPlayerUid) +bool ServerAuthenticationManager::IsDuplicateAccount(CBaseClient* pPlayer, const char* pPlayerUid) { if (m_bAllowDuplicateAccounts) return false; bool bHasUidPlayer = false; - for (int i = 0; i < R2::g_pGlobals->m_nMaxClients; i++) - if (&R2::g_pClientArray[i] != pPlayer && !strcmp(pPlayerUid, R2::g_pClientArray[i].m_UID)) + for (int i = 0; i < g_pGlobals->m_nMaxClients; i++) + if (&g_pClientArray[i] != pPlayer && !strcmp(pPlayerUid, g_pClientArray[i].m_UID)) return true; return false; } -bool ServerAuthenticationManager::CheckAuthentication(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken) +bool ServerAuthenticationManager::CheckAuthentication(CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken) { std::string sUid = std::to_string(iUid); @@ -111,7 +111,7 @@ bool ServerAuthenticationManager::CheckAuthentication(R2::CBaseClient* pPlayer, return true; // local server that doesn't need auth (probably sp) and local player - if (m_bStartingLocalSPGame && !strcmp(sUid.c_str(), R2::g_pLocalPlayerUserID)) + if (m_bStartingLocalSPGame && !strcmp(sUid.c_str(), g_pLocalPlayerUserID)) return true; // don't allow duplicate accounts @@ -126,7 +126,7 @@ bool ServerAuthenticationManager::CheckAuthentication(R2::CBaseClient* pPlayer, return false; } -void ServerAuthenticationManager::AuthenticatePlayer(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken) +void ServerAuthenticationManager::AuthenticatePlayer(CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken) { // for bot players, generate a new uid if (pPlayer->m_bFakePlayer) @@ -142,31 +142,31 @@ void ServerAuthenticationManager::AuthenticatePlayer(R2::CBaseClient* pPlayer, u if (authData != m_RemoteAuthenticationData.end()) { // if we're resetting let script handle the reset with InitPersistentData() on connect - if (!m_bForceResetLocalPlayerPersistence || strcmp(sUid.c_str(), R2::g_pLocalPlayerUserID)) + if (!m_bForceResetLocalPlayerPersistence || strcmp(sUid.c_str(), g_pLocalPlayerUserID)) { // copy pdata into buffer memcpy(pPlayer->m_PersistenceBuffer, authData->second.pdata, authData->second.pdataSize); } // set persistent data as ready - pPlayer->m_iPersistenceReady = R2::ePersistenceReady::READY_REMOTE; + pPlayer->m_iPersistenceReady = ePersistenceReady::READY_REMOTE; } // we probably allow insecure at this point, but make sure not to write anyway if not insecure else if (Cvar_ns_auth_allow_insecure->GetBool() || pPlayer->m_bFakePlayer) { // set persistent data as ready // note: actual placeholder persistent data is populated in script with InitPersistentData() - pPlayer->m_iPersistenceReady = R2::ePersistenceReady::READY_INSECURE; + pPlayer->m_iPersistenceReady = ePersistenceReady::READY_INSECURE; } } -bool ServerAuthenticationManager::RemovePlayerAuthData(R2::CBaseClient* pPlayer) +bool ServerAuthenticationManager::RemovePlayerAuthData(CBaseClient* pPlayer) { if (!Cvar_ns_erase_auth_info->GetBool()) // keep auth data forever return false; // hack for special case where we're on a local server, so we erase our own newly created auth data on disconnect - if (m_bNeedLocalAuthForNewgame && !strcmp(pPlayer->m_UID, R2::g_pLocalPlayerUserID)) + if (m_bNeedLocalAuthForNewgame && !strcmp(pPlayer->m_UID, g_pLocalPlayerUserID)) return false; // we don't have our auth token at this point, so lookup authdata by uid @@ -187,9 +187,9 @@ bool ServerAuthenticationManager::RemovePlayerAuthData(R2::CBaseClient* pPlayer) return false; } -void ServerAuthenticationManager::WritePersistentData(R2::CBaseClient* pPlayer) +void ServerAuthenticationManager::WritePersistentData(CBaseClient* pPlayer) { - if (pPlayer->m_iPersistenceReady == R2::ePersistenceReady::READY_REMOTE) + if (pPlayer->m_iPersistenceReady == ePersistenceReady::READY_REMOTE) { g_pMasterServerManager->WritePlayerPersistentData( pPlayer->m_UID, (const char*)pPlayer->m_PersistenceBuffer, m_PlayerAuthenticationData[pPlayer].pdataSize); @@ -240,7 +240,7 @@ ConVar* Cvar_ns_allowuserclantags; // clang-format off AUTOHOOK(CBaseClient__Connect, engine.dll + 0x101740, -bool,, (R2::CBaseClient* self, char* pName, void* pNetChannel, char bFakePlayer, void* a5, char pDisconnectReason[256], void* a7)) +bool,, (CBaseClient* self, char* pName, void* pNetChannel, char bFakePlayer, void* a5, char pDisconnectReason[256], void* a7)) // clang-format on { const char* pAuthenticationFailure = nullptr; @@ -281,13 +281,13 @@ bool,, (R2::CBaseClient* self, char* pName, void* pNetChannel, char bFakePlayer, // clang-format off AUTOHOOK(CBaseClient__ActivatePlayer, engine.dll + 0x100F80, -void,, (R2::CBaseClient* self)) +void,, (CBaseClient* self)) // clang-format on { // if we're authed, write our persistent data // RemovePlayerAuthData returns true if it removed successfully, i.e. on first call only, and we only want to write on >= second call // (since this func is called on map loads) - if (self->m_iPersistenceReady >= R2::ePersistenceReady::READY && !g_pServerAuthentication->RemovePlayerAuthData(self)) + if (self->m_iPersistenceReady >= ePersistenceReady::READY && !g_pServerAuthentication->RemovePlayerAuthData(self)) { g_pServerAuthentication->m_bForceResetLocalPlayerPersistence = false; g_pServerAuthentication->WritePersistentData(self); @@ -299,7 +299,7 @@ void,, (R2::CBaseClient* self)) // clang-format off AUTOHOOK(_CBaseClient__Disconnect, engine.dll + 0x1012C0, -void,, (R2::CBaseClient* self, uint32_t unknownButAlways1, const char* pReason, ...)) +void,, (CBaseClient* self, uint32_t unknownButAlways1, const char* pReason, ...)) // clang-format on { // have to manually format message because can't pass varargs to original func @@ -333,7 +333,7 @@ void,, (R2::CBaseClient* self, uint32_t unknownButAlways1, const char* pReason, void ConCommand_ns_resetpersistence(const CCommand& args) { - if (*R2::g_pServerState == R2::server_state_t::ss_active) + if (*g_pServerState == server_state_t::ss_active) { spdlog::error("ns_resetpersistence must be entered from the main menu"); return; @@ -370,7 +370,7 @@ ON_DLL_LOAD_RELIESON("engine.dll", ServerAuthentication, (ConCommand, ConVar), ( CBaseServer__RejectConnection = module.Offset(0x1182E0).RCast(); - if (Tier0::CommandLine()->CheckParm("-allowdupeaccounts")) + if (CommandLine()->CheckParm("-allowdupeaccounts")) { // patch to allow same of multiple account module.Offset(0x114510).Patch("EB"); diff --git a/NorthstarDLL/server/auth/serverauthentication.h b/NorthstarDLL/server/auth/serverauthentication.h index dd0e13af7..32e1d0a81 100644 --- a/NorthstarDLL/server/auth/serverauthentication.h +++ b/NorthstarDLL/server/auth/serverauthentication.h @@ -33,7 +33,7 @@ class ServerAuthenticationManager std::mutex m_AuthDataMutex; std::unordered_map m_RemoteAuthenticationData; - std::unordered_map m_PlayerAuthenticationData; + std::unordered_map m_PlayerAuthenticationData; bool m_bAllowDuplicateAccounts = false; bool m_bNeedLocalAuthForNewgame = false; @@ -43,16 +43,16 @@ class ServerAuthenticationManager public: void AddRemotePlayer(std::string token, uint64_t uid, std::string username, std::string pdata); - void AddPlayer(R2::CBaseClient* pPlayer, const char* pAuthToken); - void RemovePlayer(R2::CBaseClient* pPlayer); + void AddPlayer(CBaseClient* pPlayer, const char* pAuthToken); + void RemovePlayer(CBaseClient* pPlayer); bool VerifyPlayerName(const char* pAuthToken, const char* pName, char pOutVerifiedName[64]); - bool IsDuplicateAccount(R2::CBaseClient* pPlayer, const char* pUid); - bool CheckAuthentication(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken); + bool IsDuplicateAccount(CBaseClient* pPlayer, const char* pUid); + bool CheckAuthentication(CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken); - void AuthenticatePlayer(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken); - bool RemovePlayerAuthData(R2::CBaseClient* pPlayer); - void WritePersistentData(R2::CBaseClient* pPlayer); + void AuthenticatePlayer(CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken); + bool RemovePlayerAuthData(CBaseClient* pPlayer); + void WritePersistentData(CBaseClient* pPlayer); }; extern ServerAuthenticationManager* g_pServerAuthentication; diff --git a/NorthstarDLL/server/buildainfile.cpp b/NorthstarDLL/server/buildainfile.cpp index d0143295b..a7f599618 100644 --- a/NorthstarDLL/server/buildainfile.cpp +++ b/NorthstarDLL/server/buildainfile.cpp @@ -177,8 +177,8 @@ ConVar* Cvar_ns_ai_dumpAINfileFromLoad; void DumpAINInfo(CAI_Network* aiNetwork) { - fs::path writePath(fmt::format("{}/maps/graphs", R2::g_pModName)); - writePath /= R2::g_pGlobals->m_pMapName; + fs::path writePath(fmt::format("{}/maps/graphs", g_pModName)); + writePath /= g_pGlobals->m_pMapName; writePath += ".ain"; // dump from memory @@ -193,7 +193,7 @@ void DumpAINInfo(CAI_Network* aiNetwork) spdlog::info("writing ainet version: {}", AINET_VERSION_NUMBER); writeStream.write((char*)&AINET_VERSION_NUMBER, sizeof(int)); - int mapVersion = R2::g_pGlobals->m_nMapVersion; + int mapVersion = g_pGlobals->m_nMapVersion; spdlog::info("writing map version: {}", mapVersion); writeStream.write((char*)&mapVersion, sizeof(int)); spdlog::info("writing placeholder crc: {}", PLACEHOLDER_CRC); diff --git a/NorthstarDLL/server/r2server.cpp b/NorthstarDLL/server/r2server.cpp index cf7add0d7..c52f396e0 100644 --- a/NorthstarDLL/server/r2server.cpp +++ b/NorthstarDLL/server/r2server.cpp @@ -1,13 +1,7 @@ #include "r2server.h" -using namespace R2; - -// use the R2 namespace for game funcs -namespace R2 -{ - CBaseEntity* (*Server_GetEntityByIndex)(int index); - CBasePlayer*(__fastcall* UTIL_PlayerByIndex)(int playerIndex); -} // namespace R2 +CBaseEntity* (*Server_GetEntityByIndex)(int index); +CBasePlayer*(__fastcall* UTIL_PlayerByIndex)(int playerIndex); ON_DLL_LOAD("server.dll", R2GameServer, (CModule module)) { diff --git a/NorthstarDLL/server/r2server.h b/NorthstarDLL/server/r2server.h index 8fde7b9d3..c40cdc1f6 100644 --- a/NorthstarDLL/server/r2server.h +++ b/NorthstarDLL/server/r2server.h @@ -2,109 +2,105 @@ #include "core/math/vector.h" -// use the R2 namespace for game funcs -namespace R2 -{ - // server entity stuff - class CBaseEntity; - extern CBaseEntity* (*Server_GetEntityByIndex)(int index); +// server entity stuff +class CBaseEntity; +extern CBaseEntity* (*Server_GetEntityByIndex)(int index); - // clang-format off - OFFSET_STRUCT(CBasePlayer) - { - FIELD(0x58, uint32_t m_nPlayerIndex) +// clang-format off +OFFSET_STRUCT(CBasePlayer) +{ + FIELD(0x58, uint32_t m_nPlayerIndex) - FIELD(0x23E8, bool m_grappleActive) - FIELD(0x1D08, uint32_t m_platformUserId) - FIELD(0x1D10, int32_t m_classModsActive) - FIELD(0x1D8C, int32_t m_posClassModsActive) - FIELD(0x1DCC, bool m_passives) - FIELD(0x4948, int32_t m_selectedOffhand) - FIELD(0x1358, int32_t m_selectedOffhandPendingHybridAction) - FIELD(0x1E88, int32_t m_playerFlags) - FIELD(0x26A8, int32_t m_lastUCmdSimulationTicks) - FIELD(0x26AC, float m_lastUCmdSimulationRemainderTime) - FIELD(0x1F04, int32_t m_remoteTurret) - FIELD(0x414, int32_t m_hGroundEntity) - FIELD(0x13B8, int32_t m_titanSoul) - FIELD(0x2054, int32_t m_petTitan) - FIELD(0x4D4, int32_t m_iHealth) - FIELD(0x4D0, int32_t m_iMaxHealth) - FIELD(0x4F1, int32_t m_lifeState) - FIELD(0x50C, float m_flMaxspeed) - FIELD(0x298, int32_t m_fFlags) - FIELD(0x1F64, int32_t m_iObserverMode) - FIELD(0x1F6C, int32_t m_hObserverTarget) - FIELD(0x2098, int32_t m_hViewModel) - FIELD(0x27E4, int32_t m_ubEFNointerpParity) - FIELD(0x1FA4, int32_t m_activeBurnCardIndex) - FIELD(0x1B68, int32_t m_hColorCorrectionCtrl) - FIELD(0x19E0, int32_t m_PlayerFog__m_hCtrl) - FIELD(0x26BC, bool m_bShouldDrawPlayerWhileUsingViewEntity) - FIELD(0x2848, char m_title[32]) - FIELD(0x2964, bool m_useCredit) - FIELD(0x1F40, float m_damageImpulseNoDecelEndTime) - FIELD(0x1E8C, bool m_hasMic) - FIELD(0x1E8D, bool m_inPartyChat) - FIELD(0x1E90, float m_playerMoveSpeedScale) - FIELD(0x1F58, float m_flDeathTime) - FIELD(0x25A8, bool m_iSpawnParity) - FIELD(0x102284, Vector3 m_upDir) - FIELD(0x259C, float m_lastDodgeTime) - FIELD(0x22E0, bool m_wallHanging) - FIELD(0x22EC, int32_t m_traversalType) - FIELD(0x22F0, int32_t m_traversalState) - FIELD(0x2328, Vector3 m_traversalRefPos) - FIELD(0x231C, Vector3 m_traversalForwardDir) - FIELD(0x2354, float m_traversalYawDelta) - FIELD(0x2358, int32_t m_traversalYawPoseParameter) - FIELD(0x2050, int32_t m_grappleHook) - FIELD(0x27C0, int32_t m_autoSprintForced) - FIELD(0x27C4, bool m_fIsSprinting) - FIELD(0x27CC, float m_sprintStartedTime) - FIELD(0x27D0, float m_sprintStartedFrac) - FIELD(0x27D4, float m_sprintEndedTime) - FIELD(0x27D8, float m_sprintEndedFrac) - FIELD(0x27DC, float m_stickySprintStartTime) - FIELD(0x2998, float m_smartAmmoPreviousHighestLockOnMeFractionValue) - FIELD(0x23FC, int32_t m_activeZipline) - FIELD(0x2400, bool m_ziplineReverse) - FIELD(0x2410, int32_t m_ziplineState) - FIELD(0x2250, int32_t m_duckState) - FIELD(0x2254, Vector3 m_StandHullMin) - FIELD(0x2260, Vector3 m_StandHullMax) - FIELD(0x226C, Vector3 m_DuckHullMin) - FIELD(0x2278, Vector3 m_DuckHullMax) - FIELD(0x205C, int32_t m_xp) - FIELD(0x2060, int32_t m_generation) - FIELD(0x2064, int32_t m_rank) - FIELD(0x2068, int32_t m_serverForceIncreasePlayerListGenerationParity) - FIELD(0x206C, bool m_isPlayingRanked) - FIELD(0x2070, float m_skill_mu) - FIELD(0x1E80, int32_t m_titanSoulBeingRodeoed) - FIELD(0x1E84, int32_t m_entitySyncingWithMe) - FIELD(0x2078, float m_nextTitanRespawnAvailable) - FIELD(0x1C90, bool m_hasBadReputation) - FIELD(0x1C91, char m_communityName[64]) - FIELD(0x1CD1, char m_communityClanTag[16]) - FIELD(0x1CE1, char m_factionName[16]) - FIELD(0x1CF1, char m_hardwareIcon[16]) - FIELD(0x1D01, bool m_happyHourActive) - FIELD(0x1EF4, int32_t m_gestureAutoKillBitfield) - FIELD(0x2EA8, int32_t m_pilotClassIndex) - FIELD(0x100490, Vector3 m_vecAbsOrigin) - FIELD(0x25BE, bool m_isPerformingBoostAction) - FIELD(0x240C, bool m_ziplineValid3pWeaponLayerAnim) - FIELD(0x345C, int32_t m_playerScriptNetDataGlobal) - FIELD(0x1598, int32_t m_bZooming) - FIELD(0x1599, bool m_zoomToggleOn) - FIELD(0x159C, float m_zoomBaseFrac) - FIELD(0x15A0, float m_zoomBaseTime) - FIELD(0x15A4, float m_zoomFullStartTime) - FIELD(0xA04, int32_t m_camoIndex) - FIELD(0xA08, int32_t m_decalIndex) - }; - // clang-format on + FIELD(0x23E8, bool m_grappleActive) + FIELD(0x1D08, uint32_t m_platformUserId) + FIELD(0x1D10, int32_t m_classModsActive) + FIELD(0x1D8C, int32_t m_posClassModsActive) + FIELD(0x1DCC, bool m_passives) + FIELD(0x4948, int32_t m_selectedOffhand) + FIELD(0x1358, int32_t m_selectedOffhandPendingHybridAction) + FIELD(0x1E88, int32_t m_playerFlags) + FIELD(0x26A8, int32_t m_lastUCmdSimulationTicks) + FIELD(0x26AC, float m_lastUCmdSimulationRemainderTime) + FIELD(0x1F04, int32_t m_remoteTurret) + FIELD(0x414, int32_t m_hGroundEntity) + FIELD(0x13B8, int32_t m_titanSoul) + FIELD(0x2054, int32_t m_petTitan) + FIELD(0x4D4, int32_t m_iHealth) + FIELD(0x4D0, int32_t m_iMaxHealth) + FIELD(0x4F1, int32_t m_lifeState) + FIELD(0x50C, float m_flMaxspeed) + FIELD(0x298, int32_t m_fFlags) + FIELD(0x1F64, int32_t m_iObserverMode) + FIELD(0x1F6C, int32_t m_hObserverTarget) + FIELD(0x2098, int32_t m_hViewModel) + FIELD(0x27E4, int32_t m_ubEFNointerpParity) + FIELD(0x1FA4, int32_t m_activeBurnCardIndex) + FIELD(0x1B68, int32_t m_hColorCorrectionCtrl) + FIELD(0x19E0, int32_t m_PlayerFog__m_hCtrl) + FIELD(0x26BC, bool m_bShouldDrawPlayerWhileUsingViewEntity) + FIELD(0x2848, char m_title[32]) + FIELD(0x2964, bool m_useCredit) + FIELD(0x1F40, float m_damageImpulseNoDecelEndTime) + FIELD(0x1E8C, bool m_hasMic) + FIELD(0x1E8D, bool m_inPartyChat) + FIELD(0x1E90, float m_playerMoveSpeedScale) + FIELD(0x1F58, float m_flDeathTime) + FIELD(0x25A8, bool m_iSpawnParity) + FIELD(0x102284, Vector3 m_upDir) + FIELD(0x259C, float m_lastDodgeTime) + FIELD(0x22E0, bool m_wallHanging) + FIELD(0x22EC, int32_t m_traversalType) + FIELD(0x22F0, int32_t m_traversalState) + FIELD(0x2328, Vector3 m_traversalRefPos) + FIELD(0x231C, Vector3 m_traversalForwardDir) + FIELD(0x2354, float m_traversalYawDelta) + FIELD(0x2358, int32_t m_traversalYawPoseParameter) + FIELD(0x2050, int32_t m_grappleHook) + FIELD(0x27C0, int32_t m_autoSprintForced) + FIELD(0x27C4, bool m_fIsSprinting) + FIELD(0x27CC, float m_sprintStartedTime) + FIELD(0x27D0, float m_sprintStartedFrac) + FIELD(0x27D4, float m_sprintEndedTime) + FIELD(0x27D8, float m_sprintEndedFrac) + FIELD(0x27DC, float m_stickySprintStartTime) + FIELD(0x2998, float m_smartAmmoPreviousHighestLockOnMeFractionValue) + FIELD(0x23FC, int32_t m_activeZipline) + FIELD(0x2400, bool m_ziplineReverse) + FIELD(0x2410, int32_t m_ziplineState) + FIELD(0x2250, int32_t m_duckState) + FIELD(0x2254, Vector3 m_StandHullMin) + FIELD(0x2260, Vector3 m_StandHullMax) + FIELD(0x226C, Vector3 m_DuckHullMin) + FIELD(0x2278, Vector3 m_DuckHullMax) + FIELD(0x205C, int32_t m_xp) + FIELD(0x2060, int32_t m_generation) + FIELD(0x2064, int32_t m_rank) + FIELD(0x2068, int32_t m_serverForceIncreasePlayerListGenerationParity) + FIELD(0x206C, bool m_isPlayingRanked) + FIELD(0x2070, float m_skill_mu) + FIELD(0x1E80, int32_t m_titanSoulBeingRodeoed) + FIELD(0x1E84, int32_t m_entitySyncingWithMe) + FIELD(0x2078, float m_nextTitanRespawnAvailable) + FIELD(0x1C90, bool m_hasBadReputation) + FIELD(0x1C91, char m_communityName[64]) + FIELD(0x1CD1, char m_communityClanTag[16]) + FIELD(0x1CE1, char m_factionName[16]) + FIELD(0x1CF1, char m_hardwareIcon[16]) + FIELD(0x1D01, bool m_happyHourActive) + FIELD(0x1EF4, int32_t m_gestureAutoKillBitfield) + FIELD(0x2EA8, int32_t m_pilotClassIndex) + FIELD(0x100490, Vector3 m_vecAbsOrigin) + FIELD(0x25BE, bool m_isPerformingBoostAction) + FIELD(0x240C, bool m_ziplineValid3pWeaponLayerAnim) + FIELD(0x345C, int32_t m_playerScriptNetDataGlobal) + FIELD(0x1598, int32_t m_bZooming) + FIELD(0x1599, bool m_zoomToggleOn) + FIELD(0x159C, float m_zoomBaseFrac) + FIELD(0x15A0, float m_zoomBaseTime) + FIELD(0x15A4, float m_zoomFullStartTime) + FIELD(0xA04, int32_t m_camoIndex) + FIELD(0xA08, int32_t m_decalIndex) +}; +// clang-format on - extern CBasePlayer*(__fastcall* UTIL_PlayerByIndex)(int playerIndex); -} // namespace R2 +extern CBasePlayer*(__fastcall* UTIL_PlayerByIndex)(int playerIndex); diff --git a/NorthstarDLL/server/serverchathooks.cpp b/NorthstarDLL/server/serverchathooks.cpp index cb3af2445..d3ac47762 100644 --- a/NorthstarDLL/server/serverchathooks.cpp +++ b/NorthstarDLL/server/serverchathooks.cpp @@ -25,7 +25,7 @@ void(__fastcall* CServerGameDLL__OnReceivedSayTextMessage)( void(__fastcall* CRecipientFilter__Construct)(CRecipientFilter* self); void(__fastcall* CRecipientFilter__Destruct)(CRecipientFilter* self); void(__fastcall* CRecipientFilter__AddAllPlayers)(CRecipientFilter* self); -void(__fastcall* CRecipientFilter__AddRecipient)(CRecipientFilter* self, const R2::CBasePlayer* player); +void(__fastcall* CRecipientFilter__AddRecipient)(CRecipientFilter* self, const CBasePlayer* player); void(__fastcall* CRecipientFilter__MakeReliable)(CRecipientFilter* self); void(__fastcall* UserMessageBegin)(CRecipientFilter* filter, const char* messagename); @@ -40,7 +40,7 @@ AUTOHOOK(_CServerGameDLL__OnReceivedSayTextMessage, server.dll + 0x1595C0, void, __fastcall, (CServerGameDLL* self, unsigned int senderPlayerId, const char* text, bool isTeam)) // clang-format on { - NS::Utils::RemoveAsciiControlSequences(const_cast(text), true); + RemoveAsciiControlSequences(const_cast(text), true); // MiniHook doesn't allow calling the base function outside of anywhere but the hook function. // To allow bypassing the hook, isSkippingHook can be set. @@ -52,7 +52,7 @@ void, __fastcall, (CServerGameDLL* self, unsigned int senderPlayerId, const char } // check chat ratelimits - if (!g_pServerLimits->CheckChatLimits(&R2::g_pClientArray[senderPlayerId - 1])) + if (!g_pServerLimits->CheckChatLimits(&g_pClientArray[senderPlayerId - 1])) return; SQRESULT result = g_pSquirrel->Call( @@ -75,10 +75,10 @@ void ChatSendMessage(unsigned int playerIndex, const char* text, bool isTeam) void ChatBroadcastMessage(int fromPlayerIndex, int toPlayerIndex, const char* text, bool isTeam, bool isDead, CustomMessageType messageType) { - R2::CBasePlayer* toPlayer = NULL; + CBasePlayer* toPlayer = NULL; if (toPlayerIndex >= 0) { - toPlayer = R2::UTIL_PlayerByIndex(toPlayerIndex + 1); + toPlayer = UTIL_PlayerByIndex(toPlayerIndex + 1); if (toPlayer == NULL) return; } @@ -163,7 +163,7 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerChatHooks, ServerSquirrel, (CModule mod CRecipientFilter__Construct = module.Offset(0x1E9440).RCast(); CRecipientFilter__Destruct = module.Offset(0x1E9700).RCast(); CRecipientFilter__AddAllPlayers = module.Offset(0x1E9940).RCast(); - CRecipientFilter__AddRecipient = module.Offset(0x1E9B30).RCast(); + CRecipientFilter__AddRecipient = module.Offset(0x1E9B30).RCast(); CRecipientFilter__MakeReliable = module.Offset(0x1EA4E0).RCast(); UserMessageBegin = module.Offset(0x15C520).RCast(); diff --git a/NorthstarDLL/server/servernethooks.cpp b/NorthstarDLL/server/servernethooks.cpp index f74f2d386..148b735fa 100644 --- a/NorthstarDLL/server/servernethooks.cpp +++ b/NorthstarDLL/server/servernethooks.cpp @@ -84,7 +84,7 @@ static bool VerifyHMACSHA256(std::string key, std::string sig, std::string data) } // v1 HMACSHA256-signed masterserver request (HMAC-SHA256(JSONData, MasterServerToken) + JSONData) -static void ProcessAtlasConnectionlessPacketSigreq1(R2::netpacket_t* packet, bool dbg, std::string pType, std::string pData) +static void ProcessAtlasConnectionlessPacketSigreq1(netpacket_t* packet, bool dbg, std::string pType, std::string pData) { if (pData.length() < HMACSHA256_LEN) { @@ -135,7 +135,7 @@ static void ProcessAtlasConnectionlessPacketSigreq1(R2::netpacket_t* packet, boo return; } -static void ProcessAtlasConnectionlessPacket(R2::netpacket_t* packet) +static void ProcessAtlasConnectionlessPacket(netpacket_t* packet) { bool dbg = Cvar_net_debug_atlas_packet->GetBool(); @@ -168,7 +168,7 @@ static void ProcessAtlasConnectionlessPacket(R2::netpacket_t* packet) return; } -AUTOHOOK(ProcessConnectionlessPacket, engine.dll + 0x117800, bool, , (void* a1, R2::netpacket_t* packet)) +AUTOHOOK(ProcessConnectionlessPacket, engine.dll + 0x117800, bool, , (void* a1, netpacket_t* packet)) { // packet->data consists of 0xFFFFFFFF (int32 -1) to indicate packets aren't split, followed by a header consisting of a single // character, which is used to uniquely identify the packet kind. Most kinds follow this with a null-terminated string payload diff --git a/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp b/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp index 8821a40df..8064d5aca 100644 --- a/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp +++ b/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp @@ -84,7 +84,7 @@ bool, __fastcall, (void* pMsg)) // 48 8B D1 48 8B 49 18 48 8B 01 48 FF 60 10 }; auto msg = (NET_SetConVar*)pMsg; - bool bIsServerFrame = Tier0::ThreadInServerFrameThread(); + bool bIsServerFrame = ThreadInServerFrameThread(); std::string BLOCK_PREFIX = std::string {"NET_SetConVar ("} + (bIsServerFrame ? "server" : "client") + "): Blocked dangerous/invalid msg: "; @@ -118,7 +118,7 @@ bool, __fastcall, (void* pMsg)) // 48 8B D1 48 8B 49 18 48 8B 01 48 FF 60 10 if (!nameValid || !valValid) return BLOCKED_INFO("Missing null terminators"); - ConVar* pVar = R2::g_pCVar->FindVar(entry->name); + ConVar* pVar = g_pCVar->FindVar(entry->name); if (pVar) { @@ -263,19 +263,19 @@ bool, __fastcall, (const char* pModName)) // 48 83 EC 28 48 8B 0D ? ? ? ? 48 8D { // somewhat temp, store the modname here, since we don't have a proper ptr in engine to it rn int iSize = strlen(pModName); - R2::g_pModName = new char[iSize + 1]; - strcpy(R2::g_pModName, pModName); + g_pModName = new char[iSize + 1]; + strcpy(g_pModName, pModName); if (g_pVanillaCompatibility->GetVanillaCompatibility()) return false; - return (!strcmp("r2", pModName) || !strcmp("r1", pModName)) && !Tier0::CommandLine()->CheckParm("-norestrictservercommands"); + return (!strcmp("r2", pModName) || !strcmp("r1", pModName)) && !CommandLine()->CheckParm("-norestrictservercommands"); } // ratelimit stringcmds, and prevent remote clients from calling commands that they shouldn't // clang-format off AUTOHOOK(CGameClient__ExecuteStringCommand, engine.dll + 0x1022E0, -bool, __fastcall, (R2::CBaseClient* self, uint32_t unknown, const char* pCommandString)) +bool, __fastcall, (CBaseClient* self, uint32_t unknown, const char* pCommandString)) // clang-format on { if (Cvar_ns_should_log_all_clientcommands->GetBool()) @@ -283,7 +283,7 @@ bool, __fastcall, (R2::CBaseClient* self, uint32_t unknown, const char* pCommand if (!g_pServerLimits->CheckStringCommandLimits(self)) { - R2::CBaseClient__Disconnect(self, 1, "Sent too many stringcmd commands"); + CBaseClient__Disconnect(self, 1, "Sent too many stringcmd commands"); return false; } @@ -292,10 +292,10 @@ bool, __fastcall, (R2::CBaseClient* self, uint32_t unknown, const char* pCommand memset(commandBuf, 0, sizeof(commandBuf)); CCommand tempCommand = *(CCommand*)&commandBuf; - if (!R2::CCommand__Tokenize(tempCommand, pCommandString, R2::cmd_source_t::kCommandSrcCode) || !tempCommand.ArgC()) + if (!CCommand__Tokenize(tempCommand, pCommandString, cmd_source_t::kCommandSrcCode) || !tempCommand.ArgC()) return false; - ConCommand* command = R2::g_pCVar->FindCommand(tempCommand.Arg(0)); + ConCommand* command = g_pCVar->FindCommand(tempCommand.Arg(0)); // if the command doesn't exist pass it on to ExecuteStringCommand for script clientcommands and stuff if (command && !command->IsFlagSet(FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS)) @@ -304,7 +304,7 @@ bool, __fastcall, (R2::CBaseClient* self, uint32_t unknown, const char* pCommand if (IsDedicatedServer()) return false; - if (strcmp(self->m_UID, R2::g_pLocalPlayerUserID)) + if (strcmp(self->m_UID, g_pLocalPlayerUserID)) return false; } @@ -355,7 +355,7 @@ void, __fastcall, (void* self)) bWasWritingStringTableSuccessful = true; CBaseClient__SendServerInfo(self); if (!bWasWritingStringTableSuccessful) - R2::CBaseClient__Disconnect( + CBaseClient__Disconnect( self, 1, "Overflowed CNetworkStringTableContainer::WriteBaselines, try restarting your client and reconnecting"); } @@ -457,5 +457,5 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerExploitFixes, ConVar, (CModule module)) Cvar_ns_should_log_all_clientcommands = new ConVar("ns_should_log_all_clientcommands", "0", FCVAR_NONE, "Whether to log all clientcommands"); - Cvar_sv_cheats = R2::g_pCVar->FindVar("sv_cheats"); + Cvar_sv_cheats = g_pCVar->FindVar("sv_cheats"); } diff --git a/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp b/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp index c9085cb07..bd855ee45 100644 --- a/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp +++ b/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp @@ -19,47 +19,47 @@ void ServerLimitsManager::RunFrame(double flCurrentTime, float flFrameTime) if (Cvar_sv_antispeedhack_enable->GetBool()) { // for each player, set their usercmd processing budget for the frame to the last frametime for the server - for (int i = 0; i < R2::g_pGlobals->m_nMaxClients; i++) + for (int i = 0; i < g_pGlobals->m_nMaxClients; i++) { - R2::CBaseClient* player = &R2::g_pClientArray[i]; + CBaseClient* player = &g_pClientArray[i]; if (m_PlayerLimitData.find(player) != m_PlayerLimitData.end()) { PlayerLimitData* pLimitData = &g_pServerLimits->m_PlayerLimitData[player]; - if (pLimitData->flFrameUserCmdBudget < R2::g_pGlobals->m_flTickInterval * Cvar_sv_antispeedhack_maxtickbudget->GetFloat()) + if (pLimitData->flFrameUserCmdBudget < g_pGlobals->m_flTickInterval * Cvar_sv_antispeedhack_maxtickbudget->GetFloat()) { pLimitData->flFrameUserCmdBudget += g_pServerLimits->Cvar_sv_antispeedhack_budgetincreasemultiplier->GetFloat() * - fmax(flFrameTime, R2::g_pGlobals->m_flFrameTime * CEngineServer__GetTimescale()); + fmax(flFrameTime, g_pGlobals->m_flFrameTime * CEngineServer__GetTimescale()); } } } } } -void ServerLimitsManager::AddPlayer(R2::CBaseClient* player) +void ServerLimitsManager::AddPlayer(CBaseClient* player) { PlayerLimitData limitData; limitData.flFrameUserCmdBudget = - R2::g_pGlobals->m_flTickInterval * CEngineServer__GetTimescale() * Cvar_sv_antispeedhack_maxtickbudget->GetFloat(); + g_pGlobals->m_flTickInterval * CEngineServer__GetTimescale() * Cvar_sv_antispeedhack_maxtickbudget->GetFloat(); m_PlayerLimitData.insert(std::make_pair(player, limitData)); } -void ServerLimitsManager::RemovePlayer(R2::CBaseClient* player) +void ServerLimitsManager::RemovePlayer(CBaseClient* player) { if (m_PlayerLimitData.find(player) != m_PlayerLimitData.end()) m_PlayerLimitData.erase(player); } -bool ServerLimitsManager::CheckStringCommandLimits(R2::CBaseClient* player) +bool ServerLimitsManager::CheckStringCommandLimits(CBaseClient* player) { if (CVar_sv_quota_stringcmdspersecond->GetInt() != -1) { // note: this isn't super perfect, legit clients can trigger it in lobby if they try, mostly good enough tho imo - if (Tier0::Plat_FloatTime() - m_PlayerLimitData[player].lastClientCommandQuotaStart >= 1.0) + if (Plat_FloatTime() - m_PlayerLimitData[player].lastClientCommandQuotaStart >= 1.0) { // reset quota - m_PlayerLimitData[player].lastClientCommandQuotaStart = Tier0::Plat_FloatTime(); + m_PlayerLimitData[player].lastClientCommandQuotaStart = Plat_FloatTime(); m_PlayerLimitData[player].numClientCommandsInQuota = 0; } @@ -74,11 +74,11 @@ bool ServerLimitsManager::CheckStringCommandLimits(R2::CBaseClient* player) return true; } -bool ServerLimitsManager::CheckChatLimits(R2::CBaseClient* player) +bool ServerLimitsManager::CheckChatLimits(CBaseClient* player) { - if (Tier0::Plat_FloatTime() - m_PlayerLimitData[player].lastSayTextLimitStart >= 1.0) + if (Plat_FloatTime() - m_PlayerLimitData[player].lastSayTextLimitStart >= 1.0) { - m_PlayerLimitData[player].lastSayTextLimitStart = Tier0::Plat_FloatTime(); + m_PlayerLimitData[player].lastSayTextLimitStart = Plat_FloatTime(); m_PlayerLimitData[player].sayTextLimitCount = 0; } @@ -100,14 +100,14 @@ char, __fastcall, (void* self, void* buf)) NETCHANLIMIT_KICK }; - double startTime = Tier0::Plat_FloatTime(); + double startTime = Plat_FloatTime(); char ret = CNetChan__ProcessMessages(self, buf); // check processing limits, unless we're in a level transition - if (R2::g_pHostState->m_iCurrentState == R2::HostState_t::HS_RUN && Tier0::ThreadInServerFrameThread()) + if (g_pHostState->m_iCurrentState == HostState_t::HS_RUN && ThreadInServerFrameThread()) { // player that sent the message - R2::CBaseClient* sender = *(R2::CBaseClient**)((char*)self + 368); + CBaseClient* sender = *(CBaseClient**)((char*)self + 368); // if no sender, return // relatively certain this is fine? @@ -121,7 +121,7 @@ char, __fastcall, (void* self, void* buf)) g_pServerLimits->m_PlayerLimitData[sender].lastNetChanProcessingLimitStart = startTime; g_pServerLimits->m_PlayerLimitData[sender].netChanProcessingLimitTime = 0.0; } - g_pServerLimits->m_PlayerLimitData[sender].netChanProcessingLimitTime += (Tier0::Plat_FloatTime() * 1000) - (startTime * 1000); + g_pServerLimits->m_PlayerLimitData[sender].netChanProcessingLimitTime += (Plat_FloatTime() * 1000) - (startTime * 1000); if (g_pServerLimits->m_PlayerLimitData[sender].netChanProcessingLimitTime >= g_pServerLimits->Cvar_net_chan_limit_msec_per_sec->GetInt()) @@ -133,9 +133,9 @@ char, __fastcall, (void* self, void* buf)) g_pServerLimits->Cvar_net_chan_limit_msec_per_sec->GetInt()); // never kick local player - if (g_pServerLimits->Cvar_net_chan_limit_mode->GetInt() != NETCHANLIMIT_WARN && strcmp(R2::g_pLocalPlayerUserID, sender->m_UID)) + if (g_pServerLimits->Cvar_net_chan_limit_mode->GetInt() != NETCHANLIMIT_WARN && strcmp(g_pLocalPlayerUserID, sender->m_UID)) { - R2::CBaseClient__Disconnect(sender, 1, "Exceeded net channel processing limit"); + CBaseClient__Disconnect(sender, 1, "Exceeded net channel processing limit"); return false; } } @@ -144,12 +144,12 @@ char, __fastcall, (void* self, void* buf)) return ret; } -bool ServerLimitsManager::CheckConnectionlessPacketLimits(R2::netpacket_t* packet) +bool ServerLimitsManager::CheckConnectionlessPacketLimits(netpacket_t* packet) { - static const ConVar* Cvar_net_data_block_enabled = R2::g_pCVar->FindVar("net_data_block_enabled"); + static const ConVar* Cvar_net_data_block_enabled = g_pCVar->FindVar("net_data_block_enabled"); // don't ratelimit datablock packets as long as datablock is enabled - if (packet->adr.type == R2::NA_IP && + if (packet->adr.type == NA_IP && (!(packet->data[4] == 'N' && Cvar_net_data_block_enabled->GetBool()) || !Cvar_net_data_block_enabled->GetBool())) { // bad lookup: optimise later tm @@ -169,12 +169,12 @@ bool ServerLimitsManager::CheckConnectionlessPacketLimits(R2::netpacket_t* packe memcpy(sendData->ip, packet->adr.ip, 16); } - if (Tier0::Plat_FloatTime() < sendData->timeoutEnd) + if (Plat_FloatTime() < sendData->timeoutEnd) return false; - if (Tier0::Plat_FloatTime() - sendData->lastQuotaStart >= 1.0) + if (Plat_FloatTime() - sendData->lastQuotaStart >= 1.0) { - sendData->lastQuotaStart = Tier0::Plat_FloatTime(); + sendData->lastQuotaStart = Plat_FloatTime(); sendData->packetCount = 0; } @@ -188,7 +188,7 @@ bool ServerLimitsManager::CheckConnectionlessPacketLimits(R2::netpacket_t* packe packet->data[4]); // timeout for a minute - sendData->timeoutEnd = Tier0::Plat_FloatTime() + 60.0; + sendData->timeoutEnd = Plat_FloatTime() + 60.0; return false; } } @@ -232,12 +232,12 @@ struct alignas(4) SV_CUserCmd // clang-format off AUTOHOOK(CPlayerMove__RunCommand, server.dll + 0x5B8100, -void, __fastcall, (void* self, R2::CBasePlayer* player, SV_CUserCmd* pUserCmd, uint64_t a4)) +void, __fastcall, (void* self, CBasePlayer* player, SV_CUserCmd* pUserCmd, uint64_t a4)) // clang-format on { if (g_pServerLimits->Cvar_sv_antispeedhack_enable->GetBool()) { - R2::CBaseClient* pClient = &R2::g_pClientArray[player->m_nPlayerIndex - 1]; + CBaseClient* pClient = &g_pClientArray[player->m_nPlayerIndex - 1]; if (g_pServerLimits->m_PlayerLimitData.find(pClient) != g_pServerLimits->m_PlayerLimitData.end()) { diff --git a/NorthstarDLL/shared/exploit_fixes/ns_limits.h b/NorthstarDLL/shared/exploit_fixes/ns_limits.h index d1f7f2edf..a2cc431fc 100644 --- a/NorthstarDLL/shared/exploit_fixes/ns_limits.h +++ b/NorthstarDLL/shared/exploit_fixes/ns_limits.h @@ -37,16 +37,16 @@ class ServerLimitsManager ConVar* Cvar_sv_antispeedhack_maxtickbudget; ConVar* Cvar_sv_antispeedhack_budgetincreasemultiplier; - std::unordered_map m_PlayerLimitData; + std::unordered_map m_PlayerLimitData; std::vector m_UnconnectedPlayerLimitData; public: void RunFrame(double flCurrentTime, float flFrameTime); - void AddPlayer(R2::CBaseClient* player); - void RemovePlayer(R2::CBaseClient* player); - bool CheckStringCommandLimits(R2::CBaseClient* player); - bool CheckChatLimits(R2::CBaseClient* player); - bool CheckConnectionlessPacketLimits(R2::netpacket_t* packet); + void AddPlayer(CBaseClient* player); + void RemovePlayer(CBaseClient* player); + bool CheckStringCommandLimits(CBaseClient* player); + bool CheckChatLimits(CBaseClient* player); + bool CheckConnectionlessPacketLimits(netpacket_t* packet); }; extern ServerLimitsManager* g_pServerLimits; diff --git a/NorthstarDLL/shared/maxplayers.cpp b/NorthstarDLL/shared/maxplayers.cpp index 4af8ea1c1..711193d4a 100644 --- a/NorthstarDLL/shared/maxplayers.cpp +++ b/NorthstarDLL/shared/maxplayers.cpp @@ -48,21 +48,17 @@ constexpr int Team_AddedSize = Team_PlayerArray_AddedSize; bool MaxPlayersIncreaseEnabled() { - static bool bMaxPlayersIncreaseEnabled = Tier0::CommandLine()->CheckParm("-experimentalmaxplayersincrease"); + static bool bMaxPlayersIncreaseEnabled = CommandLine()->CheckParm("-experimentalmaxplayersincrease"); return bMaxPlayersIncreaseEnabled; } -// should we use R2 for this? not sure -namespace R2 // use R2 namespace for game funcs +int GetMaxPlayers() { - int GetMaxPlayers() - { - if (MaxPlayersIncreaseEnabled()) - return NEW_MAX_PLAYERS; + if (MaxPlayersIncreaseEnabled()) + return NEW_MAX_PLAYERS; - return 32; - } -} // namespace R2 + return 32; +} template void ChangeOffset(CMemoryAddress addr, unsigned int offset) { diff --git a/NorthstarDLL/shared/maxplayers.h b/NorthstarDLL/shared/maxplayers.h index b251f6a68..40a3ac58e 100644 --- a/NorthstarDLL/shared/maxplayers.h +++ b/NorthstarDLL/shared/maxplayers.h @@ -1,7 +1,3 @@ #pragma once -// should we use R2 for this? not sure -namespace R2 // use R2 namespace for game funcs -{ - int GetMaxPlayers(); -} // namespace R2 +int GetMaxPlayers(); diff --git a/NorthstarDLL/shared/misccommands.cpp b/NorthstarDLL/shared/misccommands.cpp index 5d9ced996..15da67679 100644 --- a/NorthstarDLL/shared/misccommands.cpp +++ b/NorthstarDLL/shared/misccommands.cpp @@ -15,21 +15,21 @@ void ConCommand_force_newgame(const CCommand& arg) if (arg.ArgC() < 2) return; - R2::g_pHostState->m_iNextState = R2::HostState_t::HS_NEW_GAME; - strncpy(R2::g_pHostState->m_levelName, arg.Arg(1), sizeof(R2::g_pHostState->m_levelName)); + g_pHostState->m_iNextState = HostState_t::HS_NEW_GAME; + strncpy(g_pHostState->m_levelName, arg.Arg(1), sizeof(g_pHostState->m_levelName)); } void ConCommand_ns_start_reauth_and_leave_to_lobby(const CCommand& arg) { // hack for special case where we're on a local server, so we erase our own newly created auth data on disconnect g_pMasterServerManager->m_bNewgameAfterSelfAuth = true; - g_pMasterServerManager->AuthenticateWithOwnServer(R2::g_pLocalPlayerUserID, g_pMasterServerManager->m_sOwnClientAuthToken); + g_pMasterServerManager->AuthenticateWithOwnServer(g_pLocalPlayerUserID, g_pMasterServerManager->m_sOwnClientAuthToken); } void ConCommand_ns_end_reauth_and_leave_to_lobby(const CCommand& arg) { if (g_pServerAuthentication->m_RemoteAuthenticationData.size()) - R2::g_pCVar->FindVar("serverfilter")->SetValue(g_pServerAuthentication->m_RemoteAuthenticationData.begin()->first.c_str()); + g_pCVar->FindVar("serverfilter")->SetValue(g_pServerAuthentication->m_RemoteAuthenticationData.begin()->first.c_str()); // weird way of checking, but check if client script vm is initialised, mainly just to allow players to cancel this if (g_pSquirrel->m_pSQVM) @@ -39,8 +39,8 @@ void ConCommand_ns_end_reauth_and_leave_to_lobby(const CCommand& arg) // this won't set playlist correctly on remote clients, don't think they can set playlist until they've left which sorta // fucks things should maybe set this in HostState_NewGame? R2::SetCurrentPlaylist("tdm"); - strcpy(R2::g_pHostState->m_levelName, "mp_lobby"); - R2::g_pHostState->m_iNextState = R2::HostState_t::HS_NEW_GAME; + strcpy(g_pHostState->m_levelName, "mp_lobby"); + g_pHostState->m_iNextState = HostState_t::HS_NEW_GAME; } } @@ -52,7 +52,7 @@ void ConCommand_cvar_setdefaultvalue(const CCommand& arg) return; } - ConVar* pCvar = R2::g_pCVar->FindVar(arg.Arg(1)); + ConVar* pCvar = g_pCVar->FindVar(arg.Arg(1)); if (!pCvar) { spdlog::info("usage: cvar_setdefaultvalue mp_gamemode tdm"); @@ -75,7 +75,7 @@ void ConCommand_cvar_setvalueanddefaultvalue(const CCommand& arg) return; } - ConVar* pCvar = R2::g_pCVar->FindVar(arg.Arg(1)); + ConVar* pCvar = g_pCVar->FindVar(arg.Arg(1)); if (!pCvar) { spdlog::info("usage: cvar_setvalueanddefaultvalue mp_gamemode tdm"); @@ -99,7 +99,7 @@ void ConCommand_cvar_reset(const CCommand& arg) return; } - ConVar* pCvar = R2::g_pCVar->FindVar(arg.Arg(1)); + ConVar* pCvar = g_pCVar->FindVar(arg.Arg(1)); if (!pCvar) { spdlog::info("usage: cvar_reset mp_gamemode"); @@ -143,11 +143,11 @@ void AddMiscConCommands() // fixes up various cvar flags to have more sane values void FixupCvarFlags() { - if (Tier0::CommandLine()->CheckParm("-allowdevcvars")) + if (CommandLine()->CheckParm("-allowdevcvars")) { // strip hidden and devonly cvar flags int iNumCvarsAltered = 0; - for (auto& pair : R2::g_pCVar->DumpToMap()) + for (auto& pair : g_pCVar->DumpToMap()) { // strip flags int flags = pair.second->GetFlags(); @@ -177,7 +177,7 @@ void FixupCvarFlags() int i = 0; do { - ConCommandBase* pCommand = R2::g_pCVar->FindCommandBase(ppEngineClientCommands[i]); + ConCommandBase* pCommand = g_pCVar->FindCommandBase(ppEngineClientCommands[i]); if (pCommand) // not all the commands in this array actually exist in respawn source pCommand->m_nFlags |= FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS; } while (ppEngineClientCommands[++i]); @@ -367,21 +367,21 @@ void FixupCvarFlags() for (auto& fixup : CVAR_FIXUP_ADD_FLAGS) { - ConCommandBase* command = R2::g_pCVar->FindCommandBase(std::get<0>(fixup)); + ConCommandBase* command = g_pCVar->FindCommandBase(std::get<0>(fixup)); if (command) command->m_nFlags |= std::get<1>(fixup); } for (auto& fixup : CVAR_FIXUP_REMOVE_FLAGS) { - ConCommandBase* command = R2::g_pCVar->FindCommandBase(std::get<0>(fixup)); + ConCommandBase* command = g_pCVar->FindCommandBase(std::get<0>(fixup)); if (command) command->m_nFlags &= ~std::get<1>(fixup); } for (auto& fixup : CVAR_FIXUP_DEFAULT_VALUES) { - ConVar* cvar = R2::g_pCVar->FindVar(std::get<0>(fixup)); + ConVar* cvar = g_pCVar->FindVar(std::get<0>(fixup)); if (cvar && !strcmp(cvar->GetString(), cvar->m_pszDefaultValue)) { cvar->SetValue(std::get<1>(fixup)); diff --git a/NorthstarDLL/shared/playlist.cpp b/NorthstarDLL/shared/playlist.cpp index ab7aab222..2b9ad9798 100644 --- a/NorthstarDLL/shared/playlist.cpp +++ b/NorthstarDLL/shared/playlist.cpp @@ -26,7 +26,7 @@ char, __fastcall, (void* a1, void* a2)) { // the private_match playlist on mp_lobby is the only situation where there should be any legitimate sending of this netmessage if (!Cvar_ns_use_clc_SetPlaylistVarOverride->GetBool() || strcmp(R2::GetCurrentPlaylistName(), "private_match") || - strcmp(R2::g_pGlobals->m_pMapName, "mp_lobby")) + strcmp(g_pGlobals->m_pMapName, "mp_lobby")) return 1; return clc_SetPlaylistVarOverride__Process(a1, a2); diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index d8eff0d60..ac9a2ce99 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -504,17 +504,17 @@ void __fastcall ScriptCompileErrorHook(HSquirrelVM* sqvm, const char* error, con } else { - R2::Cbuf_AddText( - R2::Cbuf_GetCurrentPlayer(), + Cbuf_AddText( + Cbuf_GetCurrentPlayer(), fmt::format("disconnect \"Encountered {} script compilation error, see console for details.\"", GetContextName(realContext)) .c_str(), - R2::cmd_source_t::kCommandSrcCode); + cmd_source_t::kCommandSrcCode); // likely temp: show console so user can see any errors, as error message wont display if ui is dead // maybe we could disable all mods other than the coremods and try a reload before doing this? // could also maybe do some vgui bullshit to show something visually rather than console if (realContext == ScriptContext::UI) - R2::Cbuf_AddText(R2::Cbuf_GetCurrentPlayer(), "showconsole", R2::cmd_source_t::kCommandSrcCode); + Cbuf_AddText(Cbuf_GetCurrentPlayer(), "showconsole", cmd_source_t::kCommandSrcCode); } } @@ -638,7 +638,7 @@ template SQRESULT SQ_Stu template void StubUnsafeSQFuncs() { - if (!Tier0::CommandLine()->CheckParm("-allowunsafesqfuncs")) + if (!CommandLine()->CheckParm("-allowunsafesqfuncs")) { g_pSquirrel->AddFuncOverride("DevTextBufferWrite", SQ_StubbedFunc); g_pSquirrel->AddFuncOverride("DevTextBufferClear", SQ_StubbedFunc); diff --git a/NorthstarDLL/util/printcommands.cpp b/NorthstarDLL/util/printcommands.cpp index 7c915318a..34d566669 100644 --- a/NorthstarDLL/util/printcommands.cpp +++ b/NorthstarDLL/util/printcommands.cpp @@ -12,7 +12,7 @@ void PrintCommandHelpDialogue(const ConCommandBase* command, const char* name) } // temp because command->IsCommand does not currently work - ConVar* cvar = R2::g_pCVar->FindVar(command->m_pszName); + ConVar* cvar = g_pCVar->FindVar(command->m_pszName); // build string for flags if not FCVAR_NONE std::string flagString; @@ -66,7 +66,7 @@ void TryPrintCvarHelpForCommand(const char* pCommand) } // check if we're inputting a cvar, but not setting it at all - ConVar* cvar = R2::g_pCVar->FindVar(pCvarStr); + ConVar* cvar = g_pCVar->FindVar(pCvarStr); if (cvar) PrintCommandHelpDialogue(&cvar->m_ConCommandBase, pCvarStr); @@ -81,7 +81,7 @@ void ConCommand_help(const CCommand& arg) return; } - PrintCommandHelpDialogue(R2::g_pCVar->FindCommandBase(arg.Arg(1)), arg.Arg(1)); + PrintCommandHelpDialogue(g_pCVar->FindCommandBase(arg.Arg(1)), arg.Arg(1)); } void ConCommand_find(const CCommand& arg) @@ -96,7 +96,7 @@ void ConCommand_find(const CCommand& arg) char pTempSearchTerm[256]; ConCommandBase* var; - CCVarIteratorInternal* itint = R2::g_pCVar->FactoryInternalIterator(); + CCVarIteratorInternal* itint = g_pCVar->FactoryInternalIterator(); std::map sorted; for (itint->SetFirst(); itint->IsValid(); itint->Next()) { @@ -165,7 +165,7 @@ void ConCommand_findflags(const CCommand& arg) } ConCommandBase* var; - CCVarIteratorInternal* itint = R2::g_pCVar->FactoryInternalIterator(); + CCVarIteratorInternal* itint = g_pCVar->FactoryInternalIterator(); std::map sorted; for (itint->SetFirst(); itint->IsValid(); itint->Next()) { @@ -189,7 +189,7 @@ void ConCommand_findflags(const CCommand& arg) void ConCommand_list(const CCommand& arg) { ConCommandBase* var; - CCVarIteratorInternal* itint = R2::g_pCVar->FactoryInternalIterator(); + CCVarIteratorInternal* itint = g_pCVar->FactoryInternalIterator(); std::map sorted; for (itint->SetFirst(); itint->IsValid(); itint->Next()) { @@ -210,7 +210,7 @@ void ConCommand_list(const CCommand& arg) void ConCommand_differences(const CCommand& arg) { - CCVarIteratorInternal* itint = R2::g_pCVar->FactoryInternalIterator(); + CCVarIteratorInternal* itint = g_pCVar->FactoryInternalIterator(); std::map sorted; for (itint->SetFirst(); itint->IsValid(); itint->Next()) @@ -225,7 +225,7 @@ void ConCommand_differences(const CCommand& arg) for (auto& map : sorted) { - ConVar* cvar = R2::g_pCVar->FindVar(map.second->m_pszName); + ConVar* cvar = g_pCVar->FindVar(map.second->m_pszName); if (!cvar) { @@ -267,19 +267,19 @@ void InitialiseCommandPrint() // these commands already exist, so we need to modify the preexisting command to use our func instead // and clear the flags also - ConCommand* helpCommand = R2::g_pCVar->FindCommand("help"); + ConCommand* helpCommand = g_pCVar->FindCommand("help"); helpCommand->m_nFlags = FCVAR_NONE; helpCommand->m_pCommandCallback = ConCommand_help; - ConCommand* findCommand = R2::g_pCVar->FindCommand("convar_findByFlags"); + ConCommand* findCommand = g_pCVar->FindCommand("convar_findByFlags"); findCommand->m_nFlags = FCVAR_NONE; findCommand->m_pCommandCallback = ConCommand_findflags; - ConCommand* listCommand = R2::g_pCVar->FindCommand("convar_list"); + ConCommand* listCommand = g_pCVar->FindCommand("convar_list"); listCommand->m_nFlags = FCVAR_NONE; listCommand->m_pCommandCallback = ConCommand_list; - ConCommand* diffCommand = R2::g_pCVar->FindCommand("convar_differences"); + ConCommand* diffCommand = g_pCVar->FindCommand("convar_differences"); diffCommand->m_nFlags = FCVAR_NONE; diffCommand->m_pCommandCallback = ConCommand_differences; } diff --git a/NorthstarDLL/util/printmaps.cpp b/NorthstarDLL/util/printmaps.cpp index bf9f1dece..d32536051 100644 --- a/NorthstarDLL/util/printmaps.cpp +++ b/NorthstarDLL/util/printmaps.cpp @@ -42,10 +42,10 @@ void RefreshMapList() // Only update the maps list every 10 seconds max to we avoid constantly reading fs static double fLastRefresh = -999; - if (fLastRefresh + 10.0 > R2::g_pGlobals->m_flRealTime) + if (fLastRefresh + 10.0 > g_pGlobals->m_flRealTime) return; - fLastRefresh = R2::g_pGlobals->m_flRealTime; + fLastRefresh = g_pGlobals->m_flRealTime; // Rebuild map list vMapList.clear(); @@ -110,7 +110,7 @@ void RefreshMapList() } // get maps in game dir - std::string gameDir = fmt::format("{}/maps", R2::g_pModName); + std::string gameDir = fmt::format("{}/maps", g_pModName); if (!std::filesystem::exists(gameDir)) { return; @@ -212,7 +212,7 @@ AUTOHOOK(Host_Map_f, engine.dll + 0x15B340, void, __fastcall, (const CCommand& a return; } - if (*R2::g_pServerState >= R2::server_state_t::ss_active) + if (*g_pServerState >= server_state_t::ss_active) return Host_Changelevel_f(args); else return Host_Map_helper(args, nullptr); @@ -222,7 +222,7 @@ void InitialiseMapsPrint() { AUTOHOOK_DISPATCH() - ConCommand* mapsCommand = R2::g_pCVar->FindCommand("maps"); + ConCommand* mapsCommand = g_pCVar->FindCommand("maps"); mapsCommand->m_pCommandCallback = ConCommand_maps; } diff --git a/NorthstarDLL/util/utils.cpp b/NorthstarDLL/util/utils.cpp index 2c9dc85a0..c3f90cfa9 100644 --- a/NorthstarDLL/util/utils.cpp +++ b/NorthstarDLL/util/utils.cpp @@ -20,7 +20,7 @@ bool skip_valid_ansi_csi_sgr(char*& str) return true; } -void NS::Utils::RemoveAsciiControlSequences(char* str, bool allow_color_codes) +void RemoveAsciiControlSequences(char* str, bool allow_color_codes) { for (char *pc = str, c = *pc; c = *pc; pc++) { diff --git a/NorthstarDLL/util/utils.h b/NorthstarDLL/util/utils.h index 97b92f181..859226927 100644 --- a/NorthstarDLL/util/utils.h +++ b/NorthstarDLL/util/utils.h @@ -1,6 +1,3 @@ #pragma once -namespace NS::Utils -{ - void RemoveAsciiControlSequences(char* str, bool allow_color_codes); -} +void RemoveAsciiControlSequences(char* str, bool allow_color_codes); From 714282b52039b12225c8348ef7346d092676ffb1 Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:01:01 +0000 Subject: [PATCH 19/30] Set a better `AccessModifierOffset` in `clang-format` (#619) Default appears to be -2, which causes clang-format to mix tabs and spaces --- .clang-format | 1 + 1 file changed, 1 insertion(+) diff --git a/.clang-format b/.clang-format index cb98dfc0e..2ad2ec208 100644 --- a/.clang-format +++ b/.clang-format @@ -3,6 +3,7 @@ Standard: Cpp11 IndentWidth: 4 TabWidth: 4 UseCRLF: false +AccessModifierOffset: -4 AlignTrailingComments: false AllowAllConstructorInitializersOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: true From 1e5c4a7f6a734352f802c82b293fe3b215e3a5b2 Mon Sep 17 00:00:00 2001 From: Northstar Date: Wed, 20 Dec 2023 15:20:02 +0100 Subject: [PATCH 20/30] Format project --- NorthstarDLL/client/audio.h | 6 ++--- NorthstarDLL/client/localchatwriter.cpp | 12 ++++----- NorthstarDLL/client/localchatwriter.h | 6 ++--- NorthstarDLL/core/convar/concommand.h | 10 +++---- NorthstarDLL/core/convar/convar.h | 2 +- NorthstarDLL/core/convar/cvar.h | 4 +-- NorthstarDLL/core/filesystem/filesystem.h | 4 +-- NorthstarDLL/core/filesystem/rpakfilesystem.h | 4 +-- NorthstarDLL/core/hooks.h | 16 ++++++------ NorthstarDLL/core/math/bitbuf.h | 20 +++++++------- NorthstarDLL/core/math/color.h | 4 +-- NorthstarDLL/core/memalloc.h | 2 +- NorthstarDLL/core/memory.h | 10 +++---- NorthstarDLL/core/sourceinterface.h | 4 +-- NorthstarDLL/core/tier0.h | 4 +-- NorthstarDLL/core/vanilla.h | 4 +-- NorthstarDLL/dedicated/dedicatedlogtoclient.h | 2 +- NorthstarDLL/engine/hoststate.h | 2 +- NorthstarDLL/engine/r2engine.h | 2 +- NorthstarDLL/logging/crashhandler.h | 4 +-- NorthstarDLL/logging/logging.h | 10 +++---- NorthstarDLL/logging/loghooks.cpp | 2 +- NorthstarDLL/logging/sourceconsole.h | 12 ++++----- NorthstarDLL/masterserver/masterserver.h | 20 +++++++------- .../mods/autodownload/moddownloader.h | 4 +-- NorthstarDLL/mods/modmanager.h | 26 +++++++++---------- NorthstarDLL/mods/modsavefiles.h | 4 +-- NorthstarDLL/plugins/pluginbackend.h | 6 ++--- NorthstarDLL/plugins/plugins.h | 10 +++---- .../scripts/scripthttprequesthandler.h | 4 +-- NorthstarDLL/server/auth/bansystem.h | 4 +-- .../server/auth/serverauthentication.h | 4 +-- NorthstarDLL/server/serverpresence.h | 8 +++--- NorthstarDLL/shared/exploit_fixes/ns_limits.h | 4 +-- NorthstarDLL/shared/keyvalues.cpp | 2 +- NorthstarDLL/shared/keyvalues.h | 6 ++--- NorthstarDLL/squirrel/squirrel.h | 8 +++--- NorthstarDLL/squirrel/squirrelautobind.h | 4 +-- NorthstarDLL/squirrel/squirrelclasstypes.h | 8 +++--- 39 files changed, 134 insertions(+), 134 deletions(-) diff --git a/NorthstarDLL/client/audio.h b/NorthstarDLL/client/audio.h index 26cda205a..15fd1a351 100644 --- a/NorthstarDLL/client/audio.h +++ b/NorthstarDLL/client/audio.h @@ -14,11 +14,11 @@ enum class AudioSelectionStrategy class EventOverrideData { - public: +public: EventOverrideData(const std::string&, const fs::path&); EventOverrideData(); - public: +public: bool LoadedSuccessfully = false; std::vector EventIds = {}; @@ -34,7 +34,7 @@ class EventOverrideData class CustomAudioManager { - public: +public: bool TryLoadAudioOverride(const fs::path&); void ClearAudioOverrides(); diff --git a/NorthstarDLL/client/localchatwriter.cpp b/NorthstarDLL/client/localchatwriter.cpp index 848d898f6..35cc065f4 100644 --- a/NorthstarDLL/client/localchatwriter.cpp +++ b/NorthstarDLL/client/localchatwriter.cpp @@ -4,13 +4,13 @@ class vgui_BaseRichText_vtable; class vgui_BaseRichText { - public: +public: vgui_BaseRichText_vtable* vtable; }; class vgui_BaseRichText_vtable { - public: +public: char unknown1[1880]; void(__fastcall* InsertChar)(vgui_BaseRichText* self, wchar_t ch); @@ -49,7 +49,7 @@ class vgui_BaseRichText_vtable class CGameSettings { - public: +public: char unknown1[92]; int isChatEnabled; }; @@ -58,7 +58,7 @@ class CGameSettings // have their value at the same offset class CGameFloatVar { - public: +public: char unknown1[88]; float value; }; @@ -101,7 +101,7 @@ Color lightColors[8] = { class AnsiEscapeParser { - public: +public: explicit AnsiEscapeParser(LocalChatWriter* writer) : m_writer(writer) {} void HandleVal(unsigned long val) @@ -129,7 +129,7 @@ class AnsiEscapeParser } } - private: +private: enum class Next { ControlType, diff --git a/NorthstarDLL/client/localchatwriter.h b/NorthstarDLL/client/localchatwriter.h index de9e2f9b7..acf6f87e4 100644 --- a/NorthstarDLL/client/localchatwriter.h +++ b/NorthstarDLL/client/localchatwriter.h @@ -5,7 +5,7 @@ class vgui_BaseRichText; class CHudChat { - public: +public: static CHudChat** allHuds; char unknown1[720]; @@ -29,7 +29,7 @@ class CHudChat class LocalChatWriter { - public: +public: enum Context { NetworkContext = 0, @@ -56,7 +56,7 @@ class LocalChatWriter void InsertColorChange(Color color); void InsertSwatchColorChange(SwatchColor color); - private: +private: Context m_context; const char* ApplyAnsiEscape(const char* escape); diff --git a/NorthstarDLL/core/convar/concommand.h b/NorthstarDLL/core/convar/concommand.h index c11c7ea4f..71a82fec1 100644 --- a/NorthstarDLL/core/convar/concommand.h +++ b/NorthstarDLL/core/convar/concommand.h @@ -4,7 +4,7 @@ class ConCommandBase; class IConCommandBaseAccessor { - public: +public: // Flags is a combination of FCVAR flags in cvar.h. // hOut is filled in with a handle to the variable. virtual bool RegisterConCommandBase(ConCommandBase* pVar) = 0; @@ -12,7 +12,7 @@ class IConCommandBaseAccessor class CCommand { - public: +public: CCommand() = delete; int64_t ArgC() const; @@ -24,7 +24,7 @@ class CCommand static int MaxCommandLength(); - private: +private: enum { COMMAND_MAX_ARGC = 64, @@ -88,7 +88,7 @@ typedef int (*FnCommandCompletionCallback)(const char* partial, char commands[CO // From r5reloaded class ConCommandBase { - public: +public: bool HasFlags(int nFlags); void AddFlags(int nFlags); void RemoveFlags(int nFlags); @@ -120,7 +120,7 @@ class ConCommand : public ConCommandBase { friend class CCVar; - public: +public: ConCommand(void) {}; // !TODO: Rebuild engine constructor in SDK instead. ConCommand(const char* szName, const char* szHelpString, int nFlags, void* pCallback, void* pCommandCompletionCallback); void Init(void); diff --git a/NorthstarDLL/core/convar/convar.h b/NorthstarDLL/core/convar/convar.h index 4b00e25f7..f0366b466 100644 --- a/NorthstarDLL/core/convar/convar.h +++ b/NorthstarDLL/core/convar/convar.h @@ -124,7 +124,7 @@ typedef void (*FnChangeCallback_t)(ConVar* var, const char* pOldValue, float flO //----------------------------------------------------------------------------- class ConVar { - public: +public: ConVar(void) {}; ConVar(const char* pszName, const char* pszDefaultValue, int nFlags, const char* pszHelpString); ConVar( diff --git a/NorthstarDLL/core/convar/cvar.h b/NorthstarDLL/core/convar/cvar.h index 09fa8591f..beaa84f47 100644 --- a/NorthstarDLL/core/convar/cvar.h +++ b/NorthstarDLL/core/convar/cvar.h @@ -13,7 +13,7 @@ class ConVar; //----------------------------------------------------------------------------- class CCVarIteratorInternal // Fully reversed table, just look at the virtual function table and rename the function. { - public: +public: virtual void SetFirst(void) = 0; // 0 virtual void Next(void) = 0; // 1 virtual bool IsValid(void) = 0; // 2 @@ -25,7 +25,7 @@ class CCVarIteratorInternal // Fully reversed table, just look at the virtual fu //----------------------------------------------------------------------------- class CCvar { - public: +public: M_VMETHOD(ConCommandBase*, FindCommandBase, 14, (const char* pszCommandName), (this, pszCommandName)); M_VMETHOD(ConVar*, FindVar, 16, (const char* pszVarName), (this, pszVarName)); M_VMETHOD(ConCommand*, FindCommand, 18, (const char* pszCommandName), (this, pszCommandName)); diff --git a/NorthstarDLL/core/filesystem/filesystem.h b/NorthstarDLL/core/filesystem/filesystem.h index 9c4e891b5..fcd1bb2f9 100644 --- a/NorthstarDLL/core/filesystem/filesystem.h +++ b/NorthstarDLL/core/filesystem/filesystem.h @@ -29,14 +29,14 @@ enum SearchPathAdd_t class CSearchPath { - public: +public: unsigned char unknown[0x18]; const char* debugPath; }; class IFileSystem { - public: +public: struct VTable { void* unknown[10]; diff --git a/NorthstarDLL/core/filesystem/rpakfilesystem.h b/NorthstarDLL/core/filesystem/rpakfilesystem.h index 3f608dba8..bcd57a731 100644 --- a/NorthstarDLL/core/filesystem/rpakfilesystem.h +++ b/NorthstarDLL/core/filesystem/rpakfilesystem.h @@ -17,11 +17,11 @@ struct LoadedPak class PakLoadManager { - private: +private: std::map m_vLoadedPaks {}; std::unordered_map m_HashToPakHandle {}; - public: +public: int LoadPakAsync(const char* pPath, const ePakLoadSource nLoadSource); void UnloadPak(const int nPakHandle); void UnloadMapPaks(); diff --git a/NorthstarDLL/core/hooks.h b/NorthstarDLL/core/hooks.h index 01244b3d2..15edbf0b0 100644 --- a/NorthstarDLL/core/hooks.h +++ b/NorthstarDLL/core/hooks.h @@ -25,7 +25,7 @@ enum class eDllLoadCallbackSide class __dllLoadCallback { - public: +public: __dllLoadCallback() = delete; __dllLoadCallback( eDllLoadCallbackSide side, @@ -67,7 +67,7 @@ class __autovar; class __fileAutohook { - public: +public: std::vector<__autohook*> hooks; std::vector<__autovar*> vars; @@ -91,7 +91,7 @@ uintptr_t ParseDLLOffsetString(const char* pAddrString); class __autohook { - public: +public: enum AddressResolutionMode { OFFSET_STRING, // we're using a string that of the format dllname.dll + offset @@ -111,7 +111,7 @@ class __autohook char* pModuleName; // for PROCADDRESS char* pProcName; // for PROCADDRESS - public: +public: __autohook() = delete; __autohook(__fileAutohook* autohook, const char* funcName, LPVOID absoluteAddress, LPVOID* orig, LPVOID func) @@ -250,13 +250,13 @@ class __autohook class ManualHook { - public: +public: char* pFuncName; LPVOID pHookFunc; LPVOID* ppOrigFunc; - public: +public: ManualHook() = delete; ManualHook(const char* funcName, LPVOID func); ManualHook(const char* funcName, LPVOID* orig, LPVOID func); @@ -284,11 +284,11 @@ void MakeHook(LPVOID pTarget, LPVOID pDetour, void* ppOriginal, const char* pFun class __autovar { - public: +public: char* m_pAddrString; void** m_pTarget; - public: +public: __autovar(__fileAutohook* pAutohook, const char* pAddrString, void** pTarget) { m_pTarget = pTarget; diff --git a/NorthstarDLL/core/math/bitbuf.h b/NorthstarDLL/core/math/bitbuf.h index 8e8e216fa..5ca754550 100644 --- a/NorthstarDLL/core/math/bitbuf.h +++ b/NorthstarDLL/core/math/bitbuf.h @@ -89,13 +89,13 @@ enum EBitCoordType class BitBufferBase { - protected: +protected: INLINE void SetName(const char* name) { m_BufferName = name; } - public: +public: INLINE bool IsOverflowed() { return m_Overflow; @@ -110,16 +110,16 @@ class BitBufferBase return m_BufferName; } - private: +private: const char* m_BufferName = ""; - protected: +protected: u8 m_Overflow = false; }; class BFRead : public BitBufferBase { - public: +public: BFRead() = default; INLINE BFRead(uptr data, size_t byteLength, size_t startPos = 0, const char* bufferName = 0) @@ -130,7 +130,7 @@ class BFRead : public BitBufferBase SetName(bufferName); } - public: +public: INLINE void StartReading(uptr data, size_t byteLength, size_t startPos = 0) { m_Data = reinterpret_cast(data); @@ -706,7 +706,7 @@ class BFRead : public BitBufferBase return GetNumBitsLeft() >> 3; } - private: +private: size_t m_DataBits; // 0x0010 size_t m_DataBytes; // 0x0018 @@ -720,7 +720,7 @@ class BFRead : public BitBufferBase class BFWrite : public BitBufferBase { - public: +public: BFWrite() = default; INLINE BFWrite(uptr data, size_t byteLength, const char* bufferName = 0) @@ -731,7 +731,7 @@ class BFWrite : public BitBufferBase SetName(bufferName); } - public: +public: INLINE void StartWriting(uptr data, size_t byteLength) { m_Data = reinterpret_cast(data); @@ -1131,7 +1131,7 @@ class BFWrite : public BitBufferBase WriteBitVec3Coord(tmp); }*/ - private: +private: size_t m_DataBits = 0; size_t m_DataBytes = 0; diff --git a/NorthstarDLL/core/math/color.h b/NorthstarDLL/core/math/color.h index 76cf8a478..013c4e4ca 100644 --- a/NorthstarDLL/core/math/color.h +++ b/NorthstarDLL/core/math/color.h @@ -57,7 +57,7 @@ struct SourceColor //----------------------------------------------------------------------------- class Color { - public: +public: Color(int r, int g, int b, int a = 255) { _color[0] = (unsigned char)r; @@ -169,7 +169,7 @@ class Color return SourceColor(_color[0], _color[1], _color[2], _color[3]); } - private: +private: unsigned char _color[4]; }; diff --git a/NorthstarDLL/core/memalloc.h b/NorthstarDLL/core/memalloc.h index 97f60012c..2f3833350 100644 --- a/NorthstarDLL/core/memalloc.h +++ b/NorthstarDLL/core/memalloc.h @@ -17,7 +17,7 @@ void operator delete(void* p) noexcept; class SourceAllocator { - public: +public: static const bool kNeedFree = true; void* Malloc(size_t size) { diff --git a/NorthstarDLL/core/memory.h b/NorthstarDLL/core/memory.h index db0a38b3b..a978963e4 100644 --- a/NorthstarDLL/core/memory.h +++ b/NorthstarDLL/core/memory.h @@ -2,10 +2,10 @@ class CMemoryAddress { - public: +public: uintptr_t m_nAddress; - public: +public: CMemoryAddress(); CMemoryAddress(const uintptr_t nAddress); CMemoryAddress(const void* pAddress); @@ -47,7 +47,7 @@ class CMemoryAddress // based on https://github.com/Mauler125/r5sdk/blob/master/r5dev/public/include/module.h class CModule : public CMemoryAddress { - public: +public: struct ModuleSections_t { ModuleSections_t(void) = default; @@ -71,7 +71,7 @@ class CModule : public CMemoryAddress ModuleSections_t m_RunTimeData; ModuleSections_t m_ReadOnlyData; - private: +private: std::string m_svModuleName; uintptr_t m_pModuleBase {}; DWORD m_nModuleSize {}; @@ -79,7 +79,7 @@ class CModule : public CMemoryAddress IMAGE_DOS_HEADER* m_pDOSHeader = nullptr; std::vector m_vModuleSections; - public: +public: CModule() = delete; // no default, we need a module name CModule(const HMODULE pModule); CModule(const char* pModuleName); diff --git a/NorthstarDLL/core/sourceinterface.h b/NorthstarDLL/core/sourceinterface.h index 474e961b3..7b5e81f3d 100644 --- a/NorthstarDLL/core/sourceinterface.h +++ b/NorthstarDLL/core/sourceinterface.h @@ -6,10 +6,10 @@ typedef void* (*CreateInterfaceFn)(const char* pName, int* pReturnCode); template class SourceInterface { - private: +private: T* m_interface; - public: +public: SourceInterface(const std::string& moduleName, const std::string& interfaceName) { HMODULE handle = GetModuleHandleA(moduleName.c_str()); diff --git a/NorthstarDLL/core/tier0.h b/NorthstarDLL/core/tier0.h index 047610b28..cc9af39e5 100644 --- a/NorthstarDLL/core/tier0.h +++ b/NorthstarDLL/core/tier0.h @@ -2,7 +2,7 @@ class IMemAlloc { - public: +public: struct VTable { void* unknown[1]; // alloc debug @@ -25,7 +25,7 @@ class IMemAlloc class CCommandLine { - public: +public: // based on the defs in the 2013 source sdk, but for some reason has an extra function (may be another CreateCmdLine overload?) // these seem to line up with what they should be though virtual void CreateCmdLine(const char* commandline) = 0; diff --git a/NorthstarDLL/core/vanilla.h b/NorthstarDLL/core/vanilla.h index fb809a1aa..b0797803a 100644 --- a/NorthstarDLL/core/vanilla.h +++ b/NorthstarDLL/core/vanilla.h @@ -6,7 +6,7 @@ /// as well as various other small changes for compatibility class VanillaCompatibility { - public: +public: void SetVanillaCompatibility(bool isVanilla) { static bool bInitialised = false; @@ -22,7 +22,7 @@ class VanillaCompatibility return m_bIsVanillaCompatible; } - private: +private: bool m_bIsVanillaCompatible = false; }; diff --git a/NorthstarDLL/dedicated/dedicatedlogtoclient.h b/NorthstarDLL/dedicated/dedicatedlogtoclient.h index 16f1e5844..82f4c56b4 100644 --- a/NorthstarDLL/dedicated/dedicatedlogtoclient.h +++ b/NorthstarDLL/dedicated/dedicatedlogtoclient.h @@ -4,7 +4,7 @@ class DedicatedServerLogToClientSink : public CustomSink { - protected: +protected: void custom_sink_it_(const custom_log_msg& msg); void sink_it_(const spdlog::details::log_msg& msg) override; void flush_() override; diff --git a/NorthstarDLL/engine/hoststate.h b/NorthstarDLL/engine/hoststate.h index 0536e91ce..290903ab1 100644 --- a/NorthstarDLL/engine/hoststate.h +++ b/NorthstarDLL/engine/hoststate.h @@ -14,7 +14,7 @@ enum class HostState_t struct CHostState { - public: +public: HostState_t m_iCurrentState; HostState_t m_iNextState; diff --git a/NorthstarDLL/engine/r2engine.h b/NorthstarDLL/engine/r2engine.h index 91676b6b6..e3bcc37e3 100644 --- a/NorthstarDLL/engine/r2engine.h +++ b/NorthstarDLL/engine/r2engine.h @@ -78,7 +78,7 @@ enum class EngineState_t class CEngine { - public: +public: virtual void unknown() = 0; // unsure if this is where virtual bool Load(bool dedicated, const char* baseDir) = 0; virtual void Unload() = 0; diff --git a/NorthstarDLL/logging/crashhandler.h b/NorthstarDLL/logging/crashhandler.h index e18de948b..c059a8ca4 100644 --- a/NorthstarDLL/logging/crashhandler.h +++ b/NorthstarDLL/logging/crashhandler.h @@ -7,7 +7,7 @@ //----------------------------------------------------------------------------- class CCrashHandler { - public: +public: CCrashHandler(); ~CCrashHandler(); @@ -77,7 +77,7 @@ class CCrashHandler //----------------------------------------------------------------------------- void WriteMinidump(); - private: +private: PVOID m_hExceptionFilter; EXCEPTION_POINTERS* m_pExceptionInfos; diff --git a/NorthstarDLL/logging/logging.h b/NorthstarDLL/logging/logging.h index af4b506c1..5056af27b 100644 --- a/NorthstarDLL/logging/logging.h +++ b/NorthstarDLL/logging/logging.h @@ -13,7 +13,7 @@ class ColoredLogger; struct custom_log_msg : spdlog::details::log_msg { - public: +public: custom_log_msg(ColoredLogger* origin, spdlog::details::log_msg msg) : origin(origin), spdlog::details::log_msg(msg) {} ColoredLogger* origin; @@ -21,7 +21,7 @@ struct custom_log_msg : spdlog::details::log_msg class CustomSink : public spdlog::sinks::base_sink { - public: +public: void custom_log(const custom_log_msg& msg); virtual void custom_sink_it_(const custom_log_msg& msg) { @@ -31,7 +31,7 @@ class CustomSink : public spdlog::sinks::base_sink class ColoredLogger : public spdlog::logger { - public: +public: std::string ANSIColor; SourceColor SRCColor; @@ -117,7 +117,7 @@ static const char* level_names[] {"trac", "dbug", "info", "warn", "errr", "crit" // spdlog logger, for cool colour things class ExternalConsoleSink : public CustomSink { - private: +private: std::map m_LogColours = { {spdlog::level::trace, NS::Colors::TRACE.ToANSIColor()}, {spdlog::level::debug, NS::Colors::DEBUG.ToANSIColor()}, @@ -129,7 +129,7 @@ class ExternalConsoleSink : public CustomSink std::string default_color = "\033[39;49m"; - protected: +protected: void sink_it_(const spdlog::details::log_msg& msg) override; void custom_sink_it_(const custom_log_msg& msg); void flush_() override; diff --git a/NorthstarDLL/logging/loghooks.cpp b/NorthstarDLL/logging/loghooks.cpp index 41e1bce23..7efb5b995 100644 --- a/NorthstarDLL/logging/loghooks.cpp +++ b/NorthstarDLL/logging/loghooks.cpp @@ -24,7 +24,7 @@ enum class TextMsgPrintType_t class ICenterPrint { - public: +public: virtual void ctor() = 0; virtual void Clear(void) = 0; virtual void ColorPrint(int r, int g, int b, int a, wchar_t* text) = 0; diff --git a/NorthstarDLL/logging/sourceconsole.h b/NorthstarDLL/logging/sourceconsole.h index 3abcc4705..44d738434 100644 --- a/NorthstarDLL/logging/sourceconsole.h +++ b/NorthstarDLL/logging/sourceconsole.h @@ -5,14 +5,14 @@ class EditablePanel { - public: +public: virtual ~EditablePanel() = 0; unsigned char unknown[0x2B0]; }; class IConsoleDisplayFunc { - public: +public: virtual void ColorPrint(const SourceColor& clr, const char* pMessage) = 0; virtual void Print(const char* pMessage) = 0; virtual void DPrint(const char* pMessage) = 0; @@ -24,7 +24,7 @@ class CConsolePanel : public EditablePanel, public IConsoleDisplayFunc class CConsoleDialog { - public: +public: struct VTable { void* unknown[298]; @@ -38,7 +38,7 @@ class CConsoleDialog class CGameConsole { - public: +public: virtual ~CGameConsole() = 0; // activates the console, makes it visible and brings it to the foreground @@ -66,7 +66,7 @@ extern SourceInterface* g_pSourceGameConsole; // spdlog logger class SourceConsoleSink : public CustomSink { - private: +private: std::map m_LogColours = { {spdlog::level::trace, NS::Colors::TRACE.ToSourceColor()}, {spdlog::level::debug, NS::Colors::DEBUG.ToSourceColor()}, @@ -76,7 +76,7 @@ class SourceConsoleSink : public CustomSink {spdlog::level::critical, NS::Colors::CRIT.ToSourceColor()}, {spdlog::level::off, NS::Colors::OFF.ToSourceColor()}}; - protected: +protected: void custom_sink_it_(const custom_log_msg& msg); void sink_it_(const spdlog::details::log_msg& msg) override; void flush_() override; diff --git a/NorthstarDLL/masterserver/masterserver.h b/NorthstarDLL/masterserver/masterserver.h index c4fa56c21..570db619f 100644 --- a/NorthstarDLL/masterserver/masterserver.h +++ b/NorthstarDLL/masterserver/masterserver.h @@ -13,14 +13,14 @@ extern ConVar* Cvar_ns_curl_log_enable; struct RemoteModInfo { - public: +public: std::string Name; std::string Version; }; class RemoteServerInfo { - public: +public: char id[33]; // 32 bytes + nullterminator // server info @@ -37,7 +37,7 @@ class RemoteServerInfo // connection stuff bool requiresPassword; - public: +public: RemoteServerInfo( const char* newId, const char* newName, @@ -52,7 +52,7 @@ class RemoteServerInfo struct RemoteServerConnectionInfo { - public: +public: char authToken[32]; in_addr ip; @@ -61,7 +61,7 @@ struct RemoteServerConnectionInfo struct MainMenuPromoData { - public: +public: std::string newInfoTitle1; std::string newInfoTitle2; std::string newInfoTitle3; @@ -82,11 +82,11 @@ struct MainMenuPromoData class MasterServerManager { - private: +private: bool m_bRequestingServerList = false; bool m_bAuthenticatingWithGameServer = false; - public: +public: char m_sOwnServerId[33]; char m_sOwnServerAuthToken[33]; char m_sOwnClientAuthToken[33]; @@ -123,7 +123,7 @@ class MasterServerManager std::unordered_set m_handledServerConnections; - public: +public: MasterServerManager(); void ClearServerList(); @@ -156,7 +156,7 @@ enum class MasterServerReportPresenceResult class MasterServerPresenceReporter : public ServerPresenceReporter { - public: +public: /** Full data returned in the std::future of a MasterServerPresenceReporter::ReportPresence() call. */ struct ReportPresenceResultData { @@ -180,7 +180,7 @@ class MasterServerPresenceReporter : public ServerPresenceReporter // Called every frame. void RunFrame(double flCurrentTime, const ServerPresence* pServerPresence) override; - protected: +protected: // Contains the async logic to add the server to the MS. void InternalAddServer(const ServerPresence* pServerPresence); diff --git a/NorthstarDLL/mods/autodownload/moddownloader.h b/NorthstarDLL/mods/autodownload/moddownloader.h index 747b3c01d..5302c21e5 100644 --- a/NorthstarDLL/mods/autodownload/moddownloader.h +++ b/NorthstarDLL/mods/autodownload/moddownloader.h @@ -1,6 +1,6 @@ class ModDownloader { - private: +private: const char* VERIFICATION_FLAG = "-disablemodverification"; const char* CUSTOM_MODS_URL_FLAG = "-customverifiedurl="; const char* STORE_URL = "https://gcdn.thunderstore.io/live/repository/packages/"; @@ -70,7 +70,7 @@ class ModDownloader */ void ExtractMod(fs::path modPath); - public: +public: ModDownloader(); /** diff --git a/NorthstarDLL/mods/modmanager.h b/NorthstarDLL/mods/modmanager.h index c141414f5..233f004d4 100644 --- a/NorthstarDLL/mods/modmanager.h +++ b/NorthstarDLL/mods/modmanager.h @@ -19,7 +19,7 @@ const std::set MODS_BLACKLIST = {"Mod Settings"}; struct ModConVar { - public: +public: std::string Name; std::string DefaultValue; std::string HelpString; @@ -28,7 +28,7 @@ struct ModConVar struct ModConCommand { - public: +public: std::string Name; std::string Function; std::string HelpString; @@ -38,7 +38,7 @@ struct ModConCommand struct ModScriptCallback { - public: +public: ScriptContext Context; // called before the codecallback is executed @@ -51,7 +51,7 @@ struct ModScriptCallback struct ModScript { - public: +public: std::string Path; std::string RunOn; @@ -61,14 +61,14 @@ struct ModScript // these are pretty much identical, could refactor to use the same stuff? struct ModVPKEntry { - public: +public: bool m_bAutoLoad; std::string m_sVpkPath; }; struct ModRpakEntry { - public: +public: bool m_bAutoLoad; std::string m_sPakName; std::string m_sLoadAfterPak; @@ -76,7 +76,7 @@ struct ModRpakEntry class Mod { - public: +public: // runtime stuff bool m_bEnabled = true; bool m_bWasReadSuccessfully = false; @@ -127,10 +127,10 @@ class Mod std::unordered_map DependencyConstants; std::vector PluginDependencyConstants; - public: +public: Mod(fs::path modPath, char* jsonBuf); - private: +private: void ParseConVars(rapidjson_document& json); void ParseConCommands(rapidjson_document& json); void ParseScripts(rapidjson_document& json); @@ -142,14 +142,14 @@ class Mod struct ModOverrideFile { - public: +public: Mod* m_pOwningMod; fs::path m_Path; }; class ModManager { - private: +private: bool m_bHasLoadedMods = false; bool m_bHasEnabledModsCfg; rapidjson_document m_EnabledModsCfg; @@ -159,13 +159,13 @@ class ModManager size_t m_hPdefHash; size_t m_hKBActHash; - public: +public: std::vector m_LoadedMods; std::unordered_map m_ModFiles; std::unordered_map m_DependencyConstants; std::unordered_set m_PluginDependencyConstants; - public: +public: ModManager(); void LoadMods(); void UnloadMods(); diff --git a/NorthstarDLL/mods/modsavefiles.h b/NorthstarDLL/mods/modsavefiles.h index a50fe62cd..f9d397239 100644 --- a/NorthstarDLL/mods/modsavefiles.h +++ b/NorthstarDLL/mods/modsavefiles.h @@ -4,13 +4,13 @@ bool ContainsInvalidChars(std::string str); class SaveFileManager { - public: +public: template void SaveFileAsync(fs::path file, std::string content); template int LoadFileAsync(fs::path file); template void DeleteFileAsync(fs::path file); // Future proofed in that if we ever get multi-threaded SSDs this code will take advantage of them. std::mutex fileMutex; - private: +private: int m_iLastRequestHandle = 0; }; diff --git a/NorthstarDLL/plugins/pluginbackend.h b/NorthstarDLL/plugins/pluginbackend.h index fc66a5971..45cd42f38 100644 --- a/NorthstarDLL/plugins/pluginbackend.h +++ b/NorthstarDLL/plugins/pluginbackend.h @@ -17,7 +17,7 @@ union PluginRespondDataCallable class PluginDataRequest { - public: +public: PluginDataRequestType type; PluginRespondDataCallable func; PluginDataRequest(PluginDataRequestType type, PluginRespondDataCallable func) : type(type), func(func) {} @@ -25,11 +25,11 @@ class PluginDataRequest class PluginCommunicationHandler { - public: +public: void RunFrame(); void PushRequest(PluginDataRequestType type, PluginRespondDataCallable func); - public: +public: std::queue requestQueue = {}; std::mutex requestMutex; diff --git a/NorthstarDLL/plugins/plugins.h b/NorthstarDLL/plugins/plugins.h index d91b28113..4e841f277 100644 --- a/NorthstarDLL/plugins/plugins.h +++ b/NorthstarDLL/plugins/plugins.h @@ -5,7 +5,7 @@ const int IDR_RCDATA1 = 101; class Plugin { - public: +public: std::string name; std::string displayName; std::string dependencyName; @@ -23,7 +23,7 @@ class Plugin bool run_on_client = false; bool run_on_server = false; - public: +public: PLUGIN_INIT_TYPE init; PLUGIN_INIT_SQVM_TYPE init_sqvm_client; PLUGIN_INIT_SQVM_TYPE init_sqvm_server; @@ -37,10 +37,10 @@ class Plugin class PluginManager { - public: +public: std::vector m_vLoadedPlugins; - public: +public: bool LoadPlugins(); std::optional LoadPlugin(fs::path path, PluginInitFuncs* funcs, PluginNorthstarData* data); @@ -52,7 +52,7 @@ class PluginManager void RunFrame(); - private: +private: std::string pluginPath; }; diff --git a/NorthstarDLL/scripts/scripthttprequesthandler.h b/NorthstarDLL/scripts/scripthttprequesthandler.h index 1f237bac2..f3921f4e7 100644 --- a/NorthstarDLL/scripts/scripthttprequesthandler.h +++ b/NorthstarDLL/scripts/scripthttprequesthandler.h @@ -99,7 +99,7 @@ struct HttpRequest */ class HttpRequestHandler { - public: +public: HttpRequestHandler(); // Start/Stop the HTTP request handler. Right now this doesn't do much. @@ -122,7 +122,7 @@ class HttpRequestHandler /** Registers the HTTP request Squirrel functions for the given script context. */ template void RegisterSQFuncs(); - private: +private: int m_iLastRequestHandle = 0; std::atomic_bool m_bIsHttpRequestHandlerRunning = false; }; diff --git a/NorthstarDLL/server/auth/bansystem.h b/NorthstarDLL/server/auth/bansystem.h index 6f180126e..d6ac5a4f3 100644 --- a/NorthstarDLL/server/auth/bansystem.h +++ b/NorthstarDLL/server/auth/bansystem.h @@ -3,11 +3,11 @@ class ServerBanSystem { - private: +private: std::ofstream m_sBanlistStream; std::vector m_vBannedUids; - public: +public: void OpenBanlist(); void ReloadBanlist(); void ClearBanlist(); diff --git a/NorthstarDLL/server/auth/serverauthentication.h b/NorthstarDLL/server/auth/serverauthentication.h index 32e1d0a81..996d20e1c 100644 --- a/NorthstarDLL/server/auth/serverauthentication.h +++ b/NorthstarDLL/server/auth/serverauthentication.h @@ -26,7 +26,7 @@ extern CBaseServer__RejectConnectionType CBaseServer__RejectConnection; class ServerAuthenticationManager { - public: +public: ConVar* Cvar_ns_erase_auth_info; ConVar* Cvar_ns_auth_allow_insecure; ConVar* Cvar_ns_auth_allow_insecure_write; @@ -40,7 +40,7 @@ class ServerAuthenticationManager bool m_bForceResetLocalPlayerPersistence = false; bool m_bStartingLocalSPGame = false; - public: +public: void AddRemotePlayer(std::string token, uint64_t uid, std::string username, std::string pdata); void AddPlayer(CBaseClient* pPlayer, const char* pAuthToken); diff --git a/NorthstarDLL/server/serverpresence.h b/NorthstarDLL/server/serverpresence.h index 3aabecdeb..c644cc377 100644 --- a/NorthstarDLL/server/serverpresence.h +++ b/NorthstarDLL/server/serverpresence.h @@ -3,7 +3,7 @@ struct ServerPresence { - public: +public: int m_iPort; std::string m_sServerId; @@ -44,7 +44,7 @@ struct ServerPresence class ServerPresenceReporter { - public: +public: virtual void CreatePresence(const ServerPresence* pServerPresence) {} virtual void ReportPresence(const ServerPresence* pServerPresence) {} virtual void DestroyPresence(const ServerPresence* pServerPresence) {} @@ -53,7 +53,7 @@ class ServerPresenceReporter class ServerPresenceManager { - private: +private: ServerPresence m_ServerPresence; bool m_bHasPresence = false; @@ -71,7 +71,7 @@ class ServerPresenceManager ConVar* Cvar_ns_report_server_to_masterserver; ConVar* Cvar_ns_report_sp_server_to_masterserver; - public: +public: void AddPresenceReporter(ServerPresenceReporter* reporter); void CreateConVars(); diff --git a/NorthstarDLL/shared/exploit_fixes/ns_limits.h b/NorthstarDLL/shared/exploit_fixes/ns_limits.h index a2cc431fc..546fec6f1 100644 --- a/NorthstarDLL/shared/exploit_fixes/ns_limits.h +++ b/NorthstarDLL/shared/exploit_fixes/ns_limits.h @@ -27,7 +27,7 @@ struct UnconnectedPlayerLimitData class ServerLimitsManager { - public: +public: ConVar* CVar_sv_quota_stringcmdspersecond; ConVar* Cvar_net_chan_limit_mode; ConVar* Cvar_net_chan_limit_msec_per_sec; @@ -40,7 +40,7 @@ class ServerLimitsManager std::unordered_map m_PlayerLimitData; std::vector m_UnconnectedPlayerLimitData; - public: +public: void RunFrame(double flCurrentTime, float flFrameTime); void AddPlayer(CBaseClient* player); void RemovePlayer(CBaseClient* player); diff --git a/NorthstarDLL/shared/keyvalues.cpp b/NorthstarDLL/shared/keyvalues.cpp index aa22ca658..88753723d 100644 --- a/NorthstarDLL/shared/keyvalues.cpp +++ b/NorthstarDLL/shared/keyvalues.cpp @@ -17,7 +17,7 @@ typedef int HKeySymbol; struct CKeyValuesSystem { - public: +public: struct __VTable { char pad0[8 * 3]; // 2 methods diff --git a/NorthstarDLL/shared/keyvalues.h b/NorthstarDLL/shared/keyvalues.h index 64ca0cc78..bd62797e3 100644 --- a/NorthstarDLL/shared/keyvalues.h +++ b/NorthstarDLL/shared/keyvalues.h @@ -48,10 +48,10 @@ enum MergeKeyValuesOp_t //----------------------------------------------------------------------------- class KeyValues { - private: +private: KeyValues(); // for internal use only - public: +public: // Constructors/destructors KeyValues(const char* pszSetName); KeyValues(const char* pszSetName, const char* pszFirstKey, const char* pszFirstValue); @@ -112,7 +112,7 @@ class KeyValues void CopySubkeys(KeyValues* pParent) const; KeyValues* MakeCopy(void) const; - public: +public: uint32_t m_iKeyName : 24; // 0x0000 uint32_t m_iKeyNameCaseSensitive1 : 8; // 0x0003 char* m_sValue; // 0x0008 diff --git a/NorthstarDLL/squirrel/squirrel.h b/NorthstarDLL/squirrel/squirrel.h index 50dd31d05..a4932044d 100644 --- a/NorthstarDLL/squirrel/squirrel.h +++ b/NorthstarDLL/squirrel/squirrel.h @@ -64,10 +64,10 @@ namespace NS::log // Cuts down on compile time by ~5 seconds class SquirrelManagerBase { - protected: +protected: std::vector m_funcRegistrations; - public: +public: CSquirrelVM* m_pSQVM; std::map m_funcOverrides = {}; std::map m_funcOriginals = {}; @@ -319,7 +319,7 @@ class SquirrelManagerBase template class SquirrelManager : public virtual SquirrelManagerBase { - public: +public: #pragma region MessageBuffer SquirrelMessageBuffer* messageBuffer; @@ -404,7 +404,7 @@ template class SquirrelManager : public virtual Squirrel #pragma endregion - public: +public: SquirrelManager() { m_pSQVM = nullptr; diff --git a/NorthstarDLL/squirrel/squirrelautobind.h b/NorthstarDLL/squirrel/squirrelautobind.h index 19ecb8084..0fc599f3d 100644 --- a/NorthstarDLL/squirrel/squirrelautobind.h +++ b/NorthstarDLL/squirrel/squirrelautobind.h @@ -5,7 +5,7 @@ typedef void (*SqAutoBindFunc)(); class SquirrelAutoBindContainer { - public: +public: std::vector> clientSqAutoBindFuncs; std::vector> serverSqAutoBindFuncs; }; @@ -61,7 +61,7 @@ class __squirrelautobind; class __squirrelautobind { - public: +public: __squirrelautobind() = delete; __squirrelautobind(std::function clientAutoBindFunc, std::function serverAutoBindFunc) diff --git a/NorthstarDLL/squirrel/squirrelclasstypes.h b/NorthstarDLL/squirrel/squirrelclasstypes.h index c193f2fc5..cd7775511 100644 --- a/NorthstarDLL/squirrel/squirrelclasstypes.h +++ b/NorthstarDLL/squirrel/squirrelclasstypes.h @@ -122,7 +122,7 @@ typedef void (*sq_schedule_call_externalType)( class SquirrelMessage { - public: +public: std::string functionName; FunctionVector args; bool isExternal = false; @@ -133,10 +133,10 @@ class SquirrelMessage class SquirrelMessageBuffer { - private: +private: std::queue messages = {}; - public: +public: std::mutex mutex; std::optional pop() { @@ -179,7 +179,7 @@ class SquirrelMessageBuffer // Super simple wrapper class to allow pushing Assets via call class SquirrelAsset { - public: +public: std::string path; SquirrelAsset(std::string path) : path(path) {}; }; From bb8ed59f6891b1196c5f5bbe7346cd171c8215fa Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Wed, 20 Dec 2023 16:03:31 +0100 Subject: [PATCH 21/30] Add Action to add label to PR on merge conflict (#621) Adds a GitHub Action that auto-adds a label to a PR in case there are merge conflicts. --- .github/workflows/merge-conflict-auto-label.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/merge-conflict-auto-label.yml diff --git a/.github/workflows/merge-conflict-auto-label.yml b/.github/workflows/merge-conflict-auto-label.yml new file mode 100644 index 000000000..e237726af --- /dev/null +++ b/.github/workflows/merge-conflict-auto-label.yml @@ -0,0 +1,16 @@ +name: Merge Conflict Auto Label +on: + push: + branches: + - main + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: mschilde/auto-label-merge-conflicts@master + with: + CONFLICT_LABEL_NAME: "merge conflicts" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAX_RETRIES: 5 + WAIT_MS: 5000 From f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287 Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Wed, 27 Dec 2023 00:32:01 +0000 Subject: [PATCH 22/30] Folder restructuring from primedev (#624) Copies of over the primedev folder structure for easier cherry-picking of further changes Co-authored-by: F1F7Y --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/release.yml | 6 +++--- .gitmodules | 6 +++--- CMakeLists.txt | 9 +++++---- README.md | 2 +- cmake/Findminhook.cmake | 8 -------- cmake/Findspdlog.cmake | 8 -------- primedev/CMakeLists.txt | 3 +++ .../CMakeLists.txt => primedev/Launcher.cmake | 4 ++-- .../CMakeLists.txt => primedev/Northstar.cmake | 5 ----- .../CMakeLists.txt => primedev/WSockProxy.cmake | 12 ++++++------ {NorthstarDLL => primedev}/client/audio.cpp | 0 {NorthstarDLL => primedev}/client/audio.h | 0 {NorthstarDLL => primedev}/client/chatcommand.cpp | 0 .../client/clientauthhooks.cpp | 0 .../client/clientruihooks.cpp | 0 .../client/clientvideooverrides.cpp | 0 {NorthstarDLL => primedev}/client/debugoverlay.cpp | 0 {NorthstarDLL => primedev}/client/demofixes.cpp | 0 {NorthstarDLL => primedev}/client/diskvmtfixes.cpp | 0 {NorthstarDLL => primedev}/client/languagehooks.cpp | 0 {NorthstarDLL => primedev}/client/latencyflex.cpp | 0 .../client/localchatwriter.cpp | 0 {NorthstarDLL => primedev}/client/localchatwriter.h | 0 .../client/modlocalisation.cpp | 0 {NorthstarDLL => primedev}/client/r2client.cpp | 0 {NorthstarDLL => primedev}/client/r2client.h | 0 .../client/rejectconnectionfixes.cpp | 0 {cmake => primedev/cmake}/Findlibcurl.cmake | 4 ++-- primedev/cmake/Findminhook.cmake | 7 +++++++ {cmake => primedev/cmake}/Findminizip.cmake | 4 ++-- primedev/cmake/Findspdlog.cmake | 7 +++++++ {cmake => primedev/cmake}/utils.cmake | 0 {NorthstarDLL => primedev}/config/profile.cpp | 0 {NorthstarDLL => primedev}/config/profile.h | 0 .../core/convar/concommand.cpp | 0 {NorthstarDLL => primedev}/core/convar/concommand.h | 0 {NorthstarDLL => primedev}/core/convar/convar.cpp | 0 {NorthstarDLL => primedev}/core/convar/convar.h | 0 {NorthstarDLL => primedev}/core/convar/cvar.cpp | 0 {NorthstarDLL => primedev}/core/convar/cvar.h | 0 .../core/filesystem/filesystem.cpp | 0 .../core/filesystem/filesystem.h | 0 .../core/filesystem/rpakfilesystem.cpp | 0 .../core/filesystem/rpakfilesystem.h | 0 {NorthstarDLL => primedev}/core/hooks.cpp | 0 {NorthstarDLL => primedev}/core/hooks.h | 0 {NorthstarDLL => primedev}/core/macros.h | 0 {NorthstarDLL => primedev}/core/math/bitbuf.h | 0 {NorthstarDLL => primedev}/core/math/bits.cpp | 0 {NorthstarDLL => primedev}/core/math/bits.h | 0 {NorthstarDLL => primedev}/core/math/color.cpp | 0 {NorthstarDLL => primedev}/core/math/color.h | 0 {NorthstarDLL => primedev}/core/math/vector.h | 0 {NorthstarDLL => primedev}/core/memalloc.cpp | 0 {NorthstarDLL => primedev}/core/memalloc.h | 0 {NorthstarDLL => primedev}/core/memory.cpp | 0 {NorthstarDLL => primedev}/core/memory.h | 0 {NorthstarDLL => primedev}/core/sourceinterface.cpp | 0 {NorthstarDLL => primedev}/core/sourceinterface.h | 0 {NorthstarDLL => primedev}/core/structs.h | 0 {NorthstarDLL => primedev}/core/tier0.cpp | 0 {NorthstarDLL => primedev}/core/tier0.h | 0 {NorthstarDLL => primedev}/core/vanilla.h | 0 {NorthstarDLL => primedev}/dedicated/dedicated.cpp | 0 {NorthstarDLL => primedev}/dedicated/dedicated.h | 0 .../dedicated/dedicatedlogtoclient.cpp | 0 .../dedicated/dedicatedlogtoclient.h | 0 .../dedicated/dedicatedmaterialsystem.cpp | 0 {NorthstarDLL => primedev}/dllmain.cpp | 0 {NorthstarDLL => primedev}/dllmain.h | 0 {NorthstarDLL => primedev}/engine/host.cpp | 0 {NorthstarDLL => primedev}/engine/hoststate.cpp | 0 {NorthstarDLL => primedev}/engine/hoststate.h | 0 {NorthstarDLL => primedev}/engine/r2engine.cpp | 0 {NorthstarDLL => primedev}/engine/r2engine.h | 0 {NorthstarDLL => primedev}/engine/runframe.cpp | 0 {NorthstarDLL => primedev}/logging/crashhandler.cpp | 0 {NorthstarDLL => primedev}/logging/crashhandler.h | 0 {NorthstarDLL => primedev}/logging/logging.cpp | 0 {NorthstarDLL => primedev}/logging/logging.h | 0 {NorthstarDLL => primedev}/logging/loghooks.cpp | 0 {NorthstarDLL => primedev}/logging/loghooks.h | 0 .../logging/sourceconsole.cpp | 0 {NorthstarDLL => primedev}/logging/sourceconsole.h | 0 .../masterserver/masterserver.cpp | 0 .../masterserver/masterserver.h | 0 .../mods/autodownload/moddownloader.cpp | 0 .../mods/autodownload/moddownloader.h | 0 {NorthstarDLL => primedev}/mods/compiled/kb_act.cpp | 0 .../mods/compiled/modkeyvalues.cpp | 0 .../mods/compiled/modpdef.cpp | 0 .../mods/compiled/modscriptsrson.cpp | 0 {NorthstarDLL => primedev}/mods/modmanager.cpp | 0 {NorthstarDLL => primedev}/mods/modmanager.h | 0 {NorthstarDLL => primedev}/mods/modsavefiles.cpp | 0 {NorthstarDLL => primedev}/mods/modsavefiles.h | 0 {NorthstarDLL => primedev}/ns_version.h | 0 {NorthstarDLL => primedev}/pch.h | 0 {NorthstarDLL => primedev}/plugins/plugin_abi.h | 0 .../plugins/pluginbackend.cpp | 0 {NorthstarDLL => primedev}/plugins/pluginbackend.h | 0 {NorthstarDLL => primedev}/plugins/plugins.cpp | 0 {NorthstarDLL => primedev}/plugins/plugins.h | 0 .../primelauncher}/main.cpp | 0 .../primelauncher}/ns_icon.ico | Bin .../primelauncher}/resource1.h | 0 .../primelauncher}/resources.rc | 2 +- {NorthstarLauncher => primedev}/resource1.h | 0 {NorthstarDLL => primedev}/resources.rc | 2 +- .../scripts/client/clientchathooks.cpp | 0 .../scripts/client/cursorposition.cpp | 0 .../scripts/client/scriptbrowserhooks.cpp | 0 .../scripts/client/scriptmainmenupromos.cpp | 0 .../scripts/client/scriptmodmenu.cpp | 0 .../scripts/client/scriptoriginauth.cpp | 0 .../scripts/client/scriptserverbrowser.cpp | 0 .../client/scriptservertoclientstringcommand.cpp | 0 .../scripts/scriptdatatables.cpp | 0 .../scripts/scripthttprequesthandler.cpp | 0 .../scripts/scripthttprequesthandler.h | 0 {NorthstarDLL => primedev}/scripts/scriptjson.cpp | 0 {NorthstarDLL => primedev}/scripts/scriptjson.h | 0 .../scripts/scriptutility.cpp | 0 .../scripts/server/miscserverfixes.cpp | 0 .../scripts/server/miscserverscript.cpp | 0 .../scripts/server/scriptuserinfo.cpp | 0 {NorthstarDLL => primedev}/server/alltalk.cpp | 0 .../server/auth/bansystem.cpp | 0 {NorthstarDLL => primedev}/server/auth/bansystem.h | 0 .../server/auth/serverauthentication.cpp | 0 .../server/auth/serverauthentication.h | 0 {NorthstarDLL => primedev}/server/buildainfile.cpp | 0 {NorthstarDLL => primedev}/server/r2server.cpp | 0 {NorthstarDLL => primedev}/server/r2server.h | 0 .../server/serverchathooks.cpp | 0 {NorthstarDLL => primedev}/server/serverchathooks.h | 0 .../server/servernethooks.cpp | 0 .../server/serverpresence.cpp | 0 {NorthstarDLL => primedev}/server/serverpresence.h | 0 .../shared/exploit_fixes/exploitfixes.cpp | 0 .../shared/exploit_fixes/exploitfixes_lzss.cpp | 0 .../exploit_fixes/exploitfixes_utf8parser.cpp | 0 .../shared/exploit_fixes/ns_limits.cpp | 0 .../shared/exploit_fixes/ns_limits.h | 0 {NorthstarDLL => primedev}/shared/keyvalues.cpp | 0 {NorthstarDLL => primedev}/shared/keyvalues.h | 0 {NorthstarDLL => primedev}/shared/maxplayers.cpp | 0 {NorthstarDLL => primedev}/shared/maxplayers.h | 0 {NorthstarDLL => primedev}/shared/misccommands.cpp | 0 {NorthstarDLL => primedev}/shared/misccommands.h | 0 {NorthstarDLL => primedev}/shared/playlist.cpp | 0 {NorthstarDLL => primedev}/shared/playlist.h | 0 {NorthstarDLL => primedev}/squirrel/squirrel.cpp | 0 {NorthstarDLL => primedev}/squirrel/squirrel.h | 0 .../squirrel/squirrelautobind.cpp | 0 .../squirrel/squirrelautobind.h | 0 .../squirrel/squirrelclasstypes.h | 0 .../squirrel/squirreldatatypes.h | 0 {thirdparty => primedev/thirdparty}/libcurl | 0 {thirdparty => primedev/thirdparty}/minhook | 0 {thirdparty => primedev/thirdparty}/minizip | 0 .../thirdparty}/rapidjson/allocators.h | 0 .../thirdparty}/rapidjson/document.h | 0 .../thirdparty}/rapidjson/encodedstream.h | 0 .../thirdparty}/rapidjson/encodings.h | 0 .../thirdparty}/rapidjson/error/en.h | 0 .../thirdparty}/rapidjson/error/error.h | 0 .../thirdparty}/rapidjson/filereadstream.h | 0 .../thirdparty}/rapidjson/filewritestream.h | 0 {thirdparty => primedev/thirdparty}/rapidjson/fwd.h | 0 .../thirdparty}/rapidjson/internal/biginteger.h | 0 .../thirdparty}/rapidjson/internal/diyfp.h | 0 .../thirdparty}/rapidjson/internal/dtoa.h | 0 .../thirdparty}/rapidjson/internal/ieee754.h | 0 .../thirdparty}/rapidjson/internal/itoa.h | 0 .../thirdparty}/rapidjson/internal/meta.h | 0 .../thirdparty}/rapidjson/internal/pow10.h | 0 .../thirdparty}/rapidjson/internal/regex.h | 0 .../thirdparty}/rapidjson/internal/stack.h | 0 .../thirdparty}/rapidjson/internal/strfunc.h | 0 .../thirdparty}/rapidjson/internal/strtod.h | 0 .../thirdparty}/rapidjson/internal/swap.h | 0 .../thirdparty}/rapidjson/istreamwrapper.h | 0 .../thirdparty}/rapidjson/memorybuffer.h | 0 .../thirdparty}/rapidjson/memorystream.h | 0 .../thirdparty}/rapidjson/msinttypes/inttypes.h | 0 .../thirdparty}/rapidjson/msinttypes/stdint.h | 0 .../thirdparty}/rapidjson/ostreamwrapper.h | 0 .../thirdparty}/rapidjson/pointer.h | 0 .../thirdparty}/rapidjson/prettywriter.h | 0 .../thirdparty}/rapidjson/rapidjson.h | 0 .../thirdparty}/rapidjson/reader.h | 0 .../thirdparty}/rapidjson/schema.h | 0 .../thirdparty}/rapidjson/stream.h | 0 .../thirdparty}/rapidjson/stringbuffer.h | 0 .../thirdparty}/rapidjson/writer.h | 0 {thirdparty => primedev/thirdparty}/spdlog/async.h | 0 .../thirdparty}/spdlog/async_logger-inl.h | 0 .../thirdparty}/spdlog/async_logger.h | 0 .../thirdparty}/spdlog/cfg/argv.h | 0 .../thirdparty}/spdlog/cfg/env.h | 0 .../thirdparty}/spdlog/cfg/helpers-inl.h | 0 .../thirdparty}/spdlog/cfg/helpers.h | 0 .../thirdparty}/spdlog/common-inl.h | 0 {thirdparty => primedev/thirdparty}/spdlog/common.h | 0 .../thirdparty}/spdlog/details/backtracer-inl.h | 0 .../thirdparty}/spdlog/details/backtracer.h | 0 .../thirdparty}/spdlog/details/circular_q.h | 0 .../thirdparty}/spdlog/details/console_globals.h | 0 .../thirdparty}/spdlog/details/file_helper-inl.h | 0 .../thirdparty}/spdlog/details/file_helper.h | 0 .../thirdparty}/spdlog/details/fmt_helper.h | 0 .../thirdparty}/spdlog/details/log_msg-inl.h | 0 .../thirdparty}/spdlog/details/log_msg.h | 0 .../thirdparty}/spdlog/details/log_msg_buffer-inl.h | 0 .../thirdparty}/spdlog/details/log_msg_buffer.h | 0 .../thirdparty}/spdlog/details/mpmc_blocking_q.h | 0 .../thirdparty}/spdlog/details/null_mutex.h | 0 .../thirdparty}/spdlog/details/os-inl.h | 0 .../thirdparty}/spdlog/details/os.h | 0 .../spdlog/details/periodic_worker-inl.h | 0 .../thirdparty}/spdlog/details/periodic_worker.h | 0 .../thirdparty}/spdlog/details/registry-inl.h | 0 .../thirdparty}/spdlog/details/registry.h | 0 .../spdlog/details/synchronous_factory.h | 0 .../thirdparty}/spdlog/details/tcp_client-windows.h | 0 .../thirdparty}/spdlog/details/tcp_client.h | 0 .../thirdparty}/spdlog/details/thread_pool-inl.h | 0 .../thirdparty}/spdlog/details/thread_pool.h | 0 .../thirdparty}/spdlog/details/windows_include.h | 0 .../thirdparty}/spdlog/fmt/bin_to_hex.h | 0 .../thirdparty}/spdlog/fmt/bundled/LICENSE.rst | 0 .../thirdparty}/spdlog/fmt/bundled/chrono.h | 0 .../thirdparty}/spdlog/fmt/bundled/color.h | 0 .../thirdparty}/spdlog/fmt/bundled/compile.h | 0 .../thirdparty}/spdlog/fmt/bundled/core.h | 0 .../thirdparty}/spdlog/fmt/bundled/format-inl.h | 0 .../thirdparty}/spdlog/fmt/bundled/format.h | 0 .../thirdparty}/spdlog/fmt/bundled/locale.h | 0 .../thirdparty}/spdlog/fmt/bundled/os.h | 0 .../thirdparty}/spdlog/fmt/bundled/ostream.h | 0 .../thirdparty}/spdlog/fmt/bundled/posix.h | 0 .../thirdparty}/spdlog/fmt/bundled/printf.h | 0 .../thirdparty}/spdlog/fmt/bundled/ranges.h | 0 .../thirdparty}/spdlog/fmt/chrono.h | 0 .../thirdparty}/spdlog/fmt/fmt.h | 0 .../thirdparty}/spdlog/fmt/ostr.h | 0 .../thirdparty}/spdlog/formatter.h | 0 {thirdparty => primedev/thirdparty}/spdlog/fwd.h | 0 .../thirdparty}/spdlog/logger-inl.h | 0 {thirdparty => primedev/thirdparty}/spdlog/logger.h | 0 .../thirdparty}/spdlog/pattern_formatter-inl.h | 0 .../thirdparty}/spdlog/pattern_formatter.h | 0 .../thirdparty}/spdlog/sinks/android_sink.h | 0 .../thirdparty}/spdlog/sinks/ansicolor_sink-inl.h | 0 .../thirdparty}/spdlog/sinks/ansicolor_sink.h | 0 .../thirdparty}/spdlog/sinks/base_sink-inl.h | 0 .../thirdparty}/spdlog/sinks/base_sink.h | 0 .../thirdparty}/spdlog/sinks/basic_file_sink-inl.h | 0 .../thirdparty}/spdlog/sinks/basic_file_sink.h | 0 .../thirdparty}/spdlog/sinks/daily_file_sink.h | 0 .../thirdparty}/spdlog/sinks/dist_sink.h | 0 .../thirdparty}/spdlog/sinks/dup_filter_sink.h | 0 .../thirdparty}/spdlog/sinks/hourly_file_sink.h | 0 .../thirdparty}/spdlog/sinks/msvc_sink.h | 0 .../thirdparty}/spdlog/sinks/null_sink.h | 0 .../thirdparty}/spdlog/sinks/ostream_sink.h | 0 .../thirdparty}/spdlog/sinks/ringbuffer_sink.h | 0 .../spdlog/sinks/rotating_file_sink-inl.h | 0 .../thirdparty}/spdlog/sinks/rotating_file_sink.h | 0 .../thirdparty}/spdlog/sinks/sink-inl.h | 0 .../thirdparty}/spdlog/sinks/sink.h | 0 .../spdlog/sinks/stdout_color_sinks-inl.h | 0 .../thirdparty}/spdlog/sinks/stdout_color_sinks.h | 0 .../thirdparty}/spdlog/sinks/stdout_sinks-inl.h | 0 .../thirdparty}/spdlog/sinks/stdout_sinks.h | 0 .../thirdparty}/spdlog/sinks/syslog_sink.h | 0 .../thirdparty}/spdlog/sinks/systemd_sink.h | 0 .../thirdparty}/spdlog/sinks/tcp_sink.h | 0 .../thirdparty}/spdlog/sinks/win_eventlog_sink.h | 0 .../thirdparty}/spdlog/sinks/wincolor_sink-inl.h | 0 .../thirdparty}/spdlog/sinks/wincolor_sink.h | 0 .../thirdparty}/spdlog/spdlog-inl.h | 0 {thirdparty => primedev/thirdparty}/spdlog/spdlog.h | 0 .../thirdparty}/spdlog/stopwatch.h | 0 .../thirdparty}/spdlog/tweakme.h | 0 .../thirdparty}/spdlog/version.h | 0 {NorthstarDLL => primedev}/util/printcommands.cpp | 0 {NorthstarDLL => primedev}/util/printcommands.h | 0 {NorthstarDLL => primedev}/util/printmaps.cpp | 0 {NorthstarDLL => primedev}/util/printmaps.h | 0 {NorthstarDLL => primedev}/util/utils.cpp | 0 {NorthstarDLL => primedev}/util/utils.h | 0 {NorthstarDLL => primedev}/util/version.cpp | 0 {NorthstarDLL => primedev}/util/version.h | 0 {NorthstarDLL => primedev}/util/wininfo.cpp | 0 {NorthstarDLL => primedev}/util/wininfo.h | 0 .../wsockproxy}/dllmain.cpp | 0 .../wsockproxy}/loader.cpp | 0 .../wsockproxy}/loader.h | 0 {loader_wsock32_proxy => primedev/wsockproxy}/pch.h | 0 .../wsockproxy}/wsock32.asm | 0 .../wsockproxy}/wsock32.def | 0 304 files changed, 48 insertions(+), 51 deletions(-) delete mode 100644 cmake/Findminhook.cmake delete mode 100644 cmake/Findspdlog.cmake create mode 100644 primedev/CMakeLists.txt rename NorthstarLauncher/CMakeLists.txt => primedev/Launcher.cmake (91%) rename NorthstarDLL/CMakeLists.txt => primedev/Northstar.cmake (97%) rename loader_wsock32_proxy/CMakeLists.txt => primedev/WSockProxy.cmake (81%) rename {NorthstarDLL => primedev}/client/audio.cpp (100%) rename {NorthstarDLL => primedev}/client/audio.h (100%) rename {NorthstarDLL => primedev}/client/chatcommand.cpp (100%) rename {NorthstarDLL => primedev}/client/clientauthhooks.cpp (100%) rename {NorthstarDLL => primedev}/client/clientruihooks.cpp (100%) rename {NorthstarDLL => primedev}/client/clientvideooverrides.cpp (100%) rename {NorthstarDLL => primedev}/client/debugoverlay.cpp (100%) rename {NorthstarDLL => primedev}/client/demofixes.cpp (100%) rename {NorthstarDLL => primedev}/client/diskvmtfixes.cpp (100%) rename {NorthstarDLL => primedev}/client/languagehooks.cpp (100%) rename {NorthstarDLL => primedev}/client/latencyflex.cpp (100%) rename {NorthstarDLL => primedev}/client/localchatwriter.cpp (100%) rename {NorthstarDLL => primedev}/client/localchatwriter.h (100%) rename {NorthstarDLL => primedev}/client/modlocalisation.cpp (100%) rename {NorthstarDLL => primedev}/client/r2client.cpp (100%) rename {NorthstarDLL => primedev}/client/r2client.h (100%) rename {NorthstarDLL => primedev}/client/rejectconnectionfixes.cpp (100%) rename {cmake => primedev/cmake}/Findlibcurl.cmake (79%) create mode 100644 primedev/cmake/Findminhook.cmake rename {cmake => primedev/cmake}/Findminizip.cmake (77%) create mode 100644 primedev/cmake/Findspdlog.cmake rename {cmake => primedev/cmake}/utils.cmake (100%) rename {NorthstarDLL => primedev}/config/profile.cpp (100%) rename {NorthstarDLL => primedev}/config/profile.h (100%) rename {NorthstarDLL => primedev}/core/convar/concommand.cpp (100%) rename {NorthstarDLL => primedev}/core/convar/concommand.h (100%) rename {NorthstarDLL => primedev}/core/convar/convar.cpp (100%) rename {NorthstarDLL => primedev}/core/convar/convar.h (100%) rename {NorthstarDLL => primedev}/core/convar/cvar.cpp (100%) rename {NorthstarDLL => primedev}/core/convar/cvar.h (100%) rename {NorthstarDLL => primedev}/core/filesystem/filesystem.cpp (100%) rename {NorthstarDLL => primedev}/core/filesystem/filesystem.h (100%) rename {NorthstarDLL => primedev}/core/filesystem/rpakfilesystem.cpp (100%) rename {NorthstarDLL => primedev}/core/filesystem/rpakfilesystem.h (100%) rename {NorthstarDLL => primedev}/core/hooks.cpp (100%) rename {NorthstarDLL => primedev}/core/hooks.h (100%) rename {NorthstarDLL => primedev}/core/macros.h (100%) rename {NorthstarDLL => primedev}/core/math/bitbuf.h (100%) rename {NorthstarDLL => primedev}/core/math/bits.cpp (100%) rename {NorthstarDLL => primedev}/core/math/bits.h (100%) rename {NorthstarDLL => primedev}/core/math/color.cpp (100%) rename {NorthstarDLL => primedev}/core/math/color.h (100%) rename {NorthstarDLL => primedev}/core/math/vector.h (100%) rename {NorthstarDLL => primedev}/core/memalloc.cpp (100%) rename {NorthstarDLL => primedev}/core/memalloc.h (100%) rename {NorthstarDLL => primedev}/core/memory.cpp (100%) rename {NorthstarDLL => primedev}/core/memory.h (100%) rename {NorthstarDLL => primedev}/core/sourceinterface.cpp (100%) rename {NorthstarDLL => primedev}/core/sourceinterface.h (100%) rename {NorthstarDLL => primedev}/core/structs.h (100%) rename {NorthstarDLL => primedev}/core/tier0.cpp (100%) rename {NorthstarDLL => primedev}/core/tier0.h (100%) rename {NorthstarDLL => primedev}/core/vanilla.h (100%) rename {NorthstarDLL => primedev}/dedicated/dedicated.cpp (100%) rename {NorthstarDLL => primedev}/dedicated/dedicated.h (100%) rename {NorthstarDLL => primedev}/dedicated/dedicatedlogtoclient.cpp (100%) rename {NorthstarDLL => primedev}/dedicated/dedicatedlogtoclient.h (100%) rename {NorthstarDLL => primedev}/dedicated/dedicatedmaterialsystem.cpp (100%) rename {NorthstarDLL => primedev}/dllmain.cpp (100%) rename {NorthstarDLL => primedev}/dllmain.h (100%) rename {NorthstarDLL => primedev}/engine/host.cpp (100%) rename {NorthstarDLL => primedev}/engine/hoststate.cpp (100%) rename {NorthstarDLL => primedev}/engine/hoststate.h (100%) rename {NorthstarDLL => primedev}/engine/r2engine.cpp (100%) rename {NorthstarDLL => primedev}/engine/r2engine.h (100%) rename {NorthstarDLL => primedev}/engine/runframe.cpp (100%) rename {NorthstarDLL => primedev}/logging/crashhandler.cpp (100%) rename {NorthstarDLL => primedev}/logging/crashhandler.h (100%) rename {NorthstarDLL => primedev}/logging/logging.cpp (100%) rename {NorthstarDLL => primedev}/logging/logging.h (100%) rename {NorthstarDLL => primedev}/logging/loghooks.cpp (100%) rename {NorthstarDLL => primedev}/logging/loghooks.h (100%) rename {NorthstarDLL => primedev}/logging/sourceconsole.cpp (100%) rename {NorthstarDLL => primedev}/logging/sourceconsole.h (100%) rename {NorthstarDLL => primedev}/masterserver/masterserver.cpp (100%) rename {NorthstarDLL => primedev}/masterserver/masterserver.h (100%) rename {NorthstarDLL => primedev}/mods/autodownload/moddownloader.cpp (100%) rename {NorthstarDLL => primedev}/mods/autodownload/moddownloader.h (100%) rename {NorthstarDLL => primedev}/mods/compiled/kb_act.cpp (100%) rename {NorthstarDLL => primedev}/mods/compiled/modkeyvalues.cpp (100%) rename {NorthstarDLL => primedev}/mods/compiled/modpdef.cpp (100%) rename {NorthstarDLL => primedev}/mods/compiled/modscriptsrson.cpp (100%) rename {NorthstarDLL => primedev}/mods/modmanager.cpp (100%) rename {NorthstarDLL => primedev}/mods/modmanager.h (100%) rename {NorthstarDLL => primedev}/mods/modsavefiles.cpp (100%) rename {NorthstarDLL => primedev}/mods/modsavefiles.h (100%) rename {NorthstarDLL => primedev}/ns_version.h (100%) rename {NorthstarDLL => primedev}/pch.h (100%) rename {NorthstarDLL => primedev}/plugins/plugin_abi.h (100%) rename {NorthstarDLL => primedev}/plugins/pluginbackend.cpp (100%) rename {NorthstarDLL => primedev}/plugins/pluginbackend.h (100%) rename {NorthstarDLL => primedev}/plugins/plugins.cpp (100%) rename {NorthstarDLL => primedev}/plugins/plugins.h (100%) rename {NorthstarLauncher => primedev/primelauncher}/main.cpp (100%) rename {NorthstarLauncher => primedev/primelauncher}/ns_icon.ico (100%) rename {NorthstarDLL => primedev/primelauncher}/resource1.h (100%) rename {NorthstarLauncher => primedev/primelauncher}/resources.rc (98%) rename {NorthstarLauncher => primedev}/resource1.h (100%) rename {NorthstarDLL => primedev}/resources.rc (97%) rename {NorthstarDLL => primedev}/scripts/client/clientchathooks.cpp (100%) rename {NorthstarDLL => primedev}/scripts/client/cursorposition.cpp (100%) rename {NorthstarDLL => primedev}/scripts/client/scriptbrowserhooks.cpp (100%) rename {NorthstarDLL => primedev}/scripts/client/scriptmainmenupromos.cpp (100%) rename {NorthstarDLL => primedev}/scripts/client/scriptmodmenu.cpp (100%) rename {NorthstarDLL => primedev}/scripts/client/scriptoriginauth.cpp (100%) rename {NorthstarDLL => primedev}/scripts/client/scriptserverbrowser.cpp (100%) rename {NorthstarDLL => primedev}/scripts/client/scriptservertoclientstringcommand.cpp (100%) rename {NorthstarDLL => primedev}/scripts/scriptdatatables.cpp (100%) rename {NorthstarDLL => primedev}/scripts/scripthttprequesthandler.cpp (100%) rename {NorthstarDLL => primedev}/scripts/scripthttprequesthandler.h (100%) rename {NorthstarDLL => primedev}/scripts/scriptjson.cpp (100%) rename {NorthstarDLL => primedev}/scripts/scriptjson.h (100%) rename {NorthstarDLL => primedev}/scripts/scriptutility.cpp (100%) rename {NorthstarDLL => primedev}/scripts/server/miscserverfixes.cpp (100%) rename {NorthstarDLL => primedev}/scripts/server/miscserverscript.cpp (100%) rename {NorthstarDLL => primedev}/scripts/server/scriptuserinfo.cpp (100%) rename {NorthstarDLL => primedev}/server/alltalk.cpp (100%) rename {NorthstarDLL => primedev}/server/auth/bansystem.cpp (100%) rename {NorthstarDLL => primedev}/server/auth/bansystem.h (100%) rename {NorthstarDLL => primedev}/server/auth/serverauthentication.cpp (100%) rename {NorthstarDLL => primedev}/server/auth/serverauthentication.h (100%) rename {NorthstarDLL => primedev}/server/buildainfile.cpp (100%) rename {NorthstarDLL => primedev}/server/r2server.cpp (100%) rename {NorthstarDLL => primedev}/server/r2server.h (100%) rename {NorthstarDLL => primedev}/server/serverchathooks.cpp (100%) rename {NorthstarDLL => primedev}/server/serverchathooks.h (100%) rename {NorthstarDLL => primedev}/server/servernethooks.cpp (100%) rename {NorthstarDLL => primedev}/server/serverpresence.cpp (100%) rename {NorthstarDLL => primedev}/server/serverpresence.h (100%) rename {NorthstarDLL => primedev}/shared/exploit_fixes/exploitfixes.cpp (100%) rename {NorthstarDLL => primedev}/shared/exploit_fixes/exploitfixes_lzss.cpp (100%) rename {NorthstarDLL => primedev}/shared/exploit_fixes/exploitfixes_utf8parser.cpp (100%) rename {NorthstarDLL => primedev}/shared/exploit_fixes/ns_limits.cpp (100%) rename {NorthstarDLL => primedev}/shared/exploit_fixes/ns_limits.h (100%) rename {NorthstarDLL => primedev}/shared/keyvalues.cpp (100%) rename {NorthstarDLL => primedev}/shared/keyvalues.h (100%) rename {NorthstarDLL => primedev}/shared/maxplayers.cpp (100%) rename {NorthstarDLL => primedev}/shared/maxplayers.h (100%) rename {NorthstarDLL => primedev}/shared/misccommands.cpp (100%) rename {NorthstarDLL => primedev}/shared/misccommands.h (100%) rename {NorthstarDLL => primedev}/shared/playlist.cpp (100%) rename {NorthstarDLL => primedev}/shared/playlist.h (100%) rename {NorthstarDLL => primedev}/squirrel/squirrel.cpp (100%) rename {NorthstarDLL => primedev}/squirrel/squirrel.h (100%) rename {NorthstarDLL => primedev}/squirrel/squirrelautobind.cpp (100%) rename {NorthstarDLL => primedev}/squirrel/squirrelautobind.h (100%) rename {NorthstarDLL => primedev}/squirrel/squirrelclasstypes.h (100%) rename {NorthstarDLL => primedev}/squirrel/squirreldatatypes.h (100%) rename {thirdparty => primedev/thirdparty}/libcurl (100%) rename {thirdparty => primedev/thirdparty}/minhook (100%) rename {thirdparty => primedev/thirdparty}/minizip (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/allocators.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/document.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/encodedstream.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/encodings.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/error/en.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/error/error.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/filereadstream.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/filewritestream.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/fwd.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/internal/biginteger.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/internal/diyfp.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/internal/dtoa.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/internal/ieee754.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/internal/itoa.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/internal/meta.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/internal/pow10.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/internal/regex.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/internal/stack.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/internal/strfunc.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/internal/strtod.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/internal/swap.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/istreamwrapper.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/memorybuffer.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/memorystream.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/msinttypes/inttypes.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/msinttypes/stdint.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/ostreamwrapper.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/pointer.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/prettywriter.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/rapidjson.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/reader.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/schema.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/stream.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/stringbuffer.h (100%) rename {thirdparty => primedev/thirdparty}/rapidjson/writer.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/async.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/async_logger-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/async_logger.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/cfg/argv.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/cfg/env.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/cfg/helpers-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/cfg/helpers.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/common-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/common.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/backtracer-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/backtracer.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/circular_q.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/console_globals.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/file_helper-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/file_helper.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/fmt_helper.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/log_msg-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/log_msg.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/log_msg_buffer-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/log_msg_buffer.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/mpmc_blocking_q.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/null_mutex.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/os-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/os.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/periodic_worker-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/periodic_worker.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/registry-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/registry.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/synchronous_factory.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/tcp_client-windows.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/tcp_client.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/thread_pool-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/thread_pool.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/details/windows_include.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bin_to_hex.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/LICENSE.rst (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/chrono.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/color.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/compile.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/core.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/format-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/format.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/locale.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/os.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/ostream.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/posix.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/printf.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/bundled/ranges.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/chrono.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/fmt.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fmt/ostr.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/formatter.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/fwd.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/logger-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/logger.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/pattern_formatter-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/pattern_formatter.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/android_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/ansicolor_sink-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/ansicolor_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/base_sink-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/base_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/basic_file_sink-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/basic_file_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/daily_file_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/dist_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/dup_filter_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/hourly_file_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/msvc_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/null_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/ostream_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/ringbuffer_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/rotating_file_sink-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/rotating_file_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/sink-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/stdout_color_sinks-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/stdout_color_sinks.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/stdout_sinks-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/stdout_sinks.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/syslog_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/systemd_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/tcp_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/win_eventlog_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/wincolor_sink-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/sinks/wincolor_sink.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/spdlog-inl.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/spdlog.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/stopwatch.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/tweakme.h (100%) rename {thirdparty => primedev/thirdparty}/spdlog/version.h (100%) rename {NorthstarDLL => primedev}/util/printcommands.cpp (100%) rename {NorthstarDLL => primedev}/util/printcommands.h (100%) rename {NorthstarDLL => primedev}/util/printmaps.cpp (100%) rename {NorthstarDLL => primedev}/util/printmaps.h (100%) rename {NorthstarDLL => primedev}/util/utils.cpp (100%) rename {NorthstarDLL => primedev}/util/utils.h (100%) rename {NorthstarDLL => primedev}/util/version.cpp (100%) rename {NorthstarDLL => primedev}/util/version.h (100%) rename {NorthstarDLL => primedev}/util/wininfo.cpp (100%) rename {NorthstarDLL => primedev}/util/wininfo.h (100%) rename {loader_wsock32_proxy => primedev/wsockproxy}/dllmain.cpp (100%) rename {loader_wsock32_proxy => primedev/wsockproxy}/loader.cpp (100%) rename {loader_wsock32_proxy => primedev/wsockproxy}/loader.h (100%) rename {loader_wsock32_proxy => primedev/wsockproxy}/pch.h (100%) rename {loader_wsock32_proxy => primedev/wsockproxy}/wsock32.asm (100%) rename {loader_wsock32_proxy => primedev/wsockproxy}/wsock32.def (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4aa37aab..6e0f28f59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,10 +20,10 @@ jobs: - name: Setup resource file version shell: bash run: | - sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' NorthstarLauncher/resources.rc - sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' NorthstarDLL/resources.rc + sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' primedev/primelauncher/resources.rc + sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' primedev/resources.rc FILEVERSION=$(echo ${{ env.NORTHSTAR_VERSION }} | tr '.' ',' | sed -E 's/-rc[0-9]+//' | tr -d '[:alpha:]') - sed -i "s/0,0,0,1/${FILEVERSION}/g" NorthstarDLL/ns_version.h + sed -i "s/0,0,0,1/${FILEVERSION}/g" primedev/ns_version.h - name: Build run: cmake --build . - name: Extract Short Commit Hash @@ -43,8 +43,8 @@ jobs: - uses: actions/checkout@v3 - uses: DoozyX/clang-format-lint-action@v0.16.2 with: - source: 'NorthstarDLL NorthstarLauncher' - exclude: 'NorthstarDLL/include loader_launcher_proxy loader_wsock32_proxy' + source: 'primedev' + exclude: 'primedev/include primedev/thirdparty primedev/wsockproxy' extensions: 'h,cpp' clangFormatVersion: 16 style: file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8aebf4953..e6dd8cc38 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,10 +25,10 @@ jobs: - name: Setup resource file version shell: bash run: | - sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' NorthstarLauncher/resources.rc - sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' NorthstarDLL/resources.rc + sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' primedev/primelauncher/resources.rc + sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' primedev/resources.rc FILEVERSION=$(echo ${{ env.NORTHSTAR_VERSION }} | tr '.' ',' | sed -E 's/-rc[0-9]+//' | tr -d '[:alpha:]') - sed -i "s/0,0,0,1/${FILEVERSION}/g" NorthstarDLL/ns_version.h + sed -i "s/0,0,0,1/${FILEVERSION}/g" primedev/ns_version.h - name: Build run: cmake --build . - name: Upload launcher build as artifact diff --git a/.gitmodules b/.gitmodules index c4cfc0a13..41f118e3f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,11 +1,11 @@ [submodule "thirdparty/libcurl"] - path = thirdparty/libcurl + path = primedev/thirdparty/libcurl url = https://github.com/curl/curl ignore = untracked [submodule "thirdparty/minhook"] - path = thirdparty/minhook + path = primedev/thirdparty/minhook url = https://github.com/TsudaKageyu/minhook ignore = untracked [submodule "thirdparty/minizip"] - path = thirdparty/minizip + path = primedev/thirdparty/minizip url = https://github.com/zlib-ng/minizip-ng.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 83c38a564..9bea0ce89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,10 +24,11 @@ set(NS_BINARY_DIR ${CMAKE_BINARY_DIR}/game) message(STATUS "NS: Building to ${NS_BINARY_DIR}") -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/primedev/cmake") include(utils) +include_directories(primedev) +include_directories(primedev/thirdparty) + # Targets -add_subdirectory(loader_wsock32_proxy) -add_subdirectory(NorthstarDLL) -add_subdirectory(NorthstarLauncher) +add_subdirectory(primedev) diff --git a/README.md b/README.md index f789b4869..80be8fd0f 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,4 @@ Check [BUILD.md](BUILD.md) for instructions on how to compile, you can also down ## Format -This project uses [clang-format](https://clang.llvm.org/docs/ClangFormat.html), make sure you run `clang-format -i --style=file NorthstarLauncher/*.cpp NorthstarLauncher/*.h NorthstarDLL/*.cpp NorthstarDLL/*.h` when opening a Pull Request. Check the tool's website for instructions on how to integrate it with your IDE. +This project uses [clang-format](https://clang.llvm.org/docs/ClangFormat.html), make sure you run `clang-format -i --style=file --exclude=primedev/include primedev/*.cpp primedev/*.h` when opening a Pull Request. Check the tool's website for instructions on how to integrate it with your IDE. diff --git a/cmake/Findminhook.cmake b/cmake/Findminhook.cmake deleted file mode 100644 index 8ec2e99ab..000000000 --- a/cmake/Findminhook.cmake +++ /dev/null @@ -1,8 +0,0 @@ - -if(NOT minhook_FOUND) - check_init_submodule(${PROJECT_SOURCE_DIR}/thirdparty/minhook) - - add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/minhook minhook) - set(minhook_FOUND 1 PARENT_SCOPE) -endif() - diff --git a/cmake/Findspdlog.cmake b/cmake/Findspdlog.cmake deleted file mode 100644 index 38b52a531..000000000 --- a/cmake/Findspdlog.cmake +++ /dev/null @@ -1,8 +0,0 @@ - -if(NOT spdlog_FOUND) - check_init_submodule(${PROJECT_SOURCE_DIR}/thirdparty/spdlog) - - add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/spdlog spdlog) - set(spdlog_FOUND 1 PARENT_SCOPE) -endif() - diff --git a/primedev/CMakeLists.txt b/primedev/CMakeLists.txt new file mode 100644 index 000000000..03f2628ef --- /dev/null +++ b/primedev/CMakeLists.txt @@ -0,0 +1,3 @@ +include(Northstar.cmake) +include(Launcher.cmake) +include(WSockProxy.cmake) diff --git a/NorthstarLauncher/CMakeLists.txt b/primedev/Launcher.cmake similarity index 91% rename from NorthstarLauncher/CMakeLists.txt rename to primedev/Launcher.cmake index f4d7bcb96..9edcf0e57 100644 --- a/NorthstarLauncher/CMakeLists.txt +++ b/primedev/Launcher.cmake @@ -1,8 +1,8 @@ # NorthstarLauncher add_executable(NorthstarLauncher - "main.cpp" - "resources.rc" + "primelauncher/main.cpp" + "primelauncher/resources.rc" ) target_compile_definitions(NorthstarLauncher PRIVATE diff --git a/NorthstarDLL/CMakeLists.txt b/primedev/Northstar.cmake similarity index 97% rename from NorthstarDLL/CMakeLists.txt rename to primedev/Northstar.cmake index d238f61fe..69db3d4e0 100644 --- a/NorthstarDLL/CMakeLists.txt +++ b/primedev/Northstar.cmake @@ -167,11 +167,6 @@ target_link_libraries(NorthstarDLL PRIVATE version.lib ) -target_include_directories(NorthstarDLL PRIVATE - ${CMAKE_SOURCE_DIR}/NorthstarDLL - ${CMAKE_SOURCE_DIR}/thirdparty -) - target_precompile_headers(NorthstarDLL PRIVATE pch.h) target_compile_definitions(NorthstarDLL PRIVATE diff --git a/loader_wsock32_proxy/CMakeLists.txt b/primedev/WSockProxy.cmake similarity index 81% rename from loader_wsock32_proxy/CMakeLists.txt rename to primedev/WSockProxy.cmake index 3157f6c55..84338bc79 100644 --- a/loader_wsock32_proxy/CMakeLists.txt +++ b/primedev/WSockProxy.cmake @@ -3,11 +3,11 @@ find_package(minhook REQUIRED) add_library(loader_wsock32_proxy SHARED - "dllmain.cpp" - "loader.cpp" - "loader.h" - "wsock32.asm" - "wsock32.def" + "wsockproxy/dllmain.cpp" + "wsockproxy/loader.cpp" + "wsockproxy/loader.h" + "wsockproxy/wsock32.asm" + "wsockproxy/wsock32.def" ) target_link_libraries(loader_wsock32_proxy PRIVATE @@ -31,7 +31,7 @@ target_link_libraries(loader_wsock32_proxy PRIVATE odbccp32.lib ) -target_precompile_headers(loader_wsock32_proxy PRIVATE pch.h) +target_precompile_headers(loader_wsock32_proxy PRIVATE wsockproxy/pch.h) target_compile_definitions(loader_wsock32_proxy PRIVATE UNICODE diff --git a/NorthstarDLL/client/audio.cpp b/primedev/client/audio.cpp similarity index 100% rename from NorthstarDLL/client/audio.cpp rename to primedev/client/audio.cpp diff --git a/NorthstarDLL/client/audio.h b/primedev/client/audio.h similarity index 100% rename from NorthstarDLL/client/audio.h rename to primedev/client/audio.h diff --git a/NorthstarDLL/client/chatcommand.cpp b/primedev/client/chatcommand.cpp similarity index 100% rename from NorthstarDLL/client/chatcommand.cpp rename to primedev/client/chatcommand.cpp diff --git a/NorthstarDLL/client/clientauthhooks.cpp b/primedev/client/clientauthhooks.cpp similarity index 100% rename from NorthstarDLL/client/clientauthhooks.cpp rename to primedev/client/clientauthhooks.cpp diff --git a/NorthstarDLL/client/clientruihooks.cpp b/primedev/client/clientruihooks.cpp similarity index 100% rename from NorthstarDLL/client/clientruihooks.cpp rename to primedev/client/clientruihooks.cpp diff --git a/NorthstarDLL/client/clientvideooverrides.cpp b/primedev/client/clientvideooverrides.cpp similarity index 100% rename from NorthstarDLL/client/clientvideooverrides.cpp rename to primedev/client/clientvideooverrides.cpp diff --git a/NorthstarDLL/client/debugoverlay.cpp b/primedev/client/debugoverlay.cpp similarity index 100% rename from NorthstarDLL/client/debugoverlay.cpp rename to primedev/client/debugoverlay.cpp diff --git a/NorthstarDLL/client/demofixes.cpp b/primedev/client/demofixes.cpp similarity index 100% rename from NorthstarDLL/client/demofixes.cpp rename to primedev/client/demofixes.cpp diff --git a/NorthstarDLL/client/diskvmtfixes.cpp b/primedev/client/diskvmtfixes.cpp similarity index 100% rename from NorthstarDLL/client/diskvmtfixes.cpp rename to primedev/client/diskvmtfixes.cpp diff --git a/NorthstarDLL/client/languagehooks.cpp b/primedev/client/languagehooks.cpp similarity index 100% rename from NorthstarDLL/client/languagehooks.cpp rename to primedev/client/languagehooks.cpp diff --git a/NorthstarDLL/client/latencyflex.cpp b/primedev/client/latencyflex.cpp similarity index 100% rename from NorthstarDLL/client/latencyflex.cpp rename to primedev/client/latencyflex.cpp diff --git a/NorthstarDLL/client/localchatwriter.cpp b/primedev/client/localchatwriter.cpp similarity index 100% rename from NorthstarDLL/client/localchatwriter.cpp rename to primedev/client/localchatwriter.cpp diff --git a/NorthstarDLL/client/localchatwriter.h b/primedev/client/localchatwriter.h similarity index 100% rename from NorthstarDLL/client/localchatwriter.h rename to primedev/client/localchatwriter.h diff --git a/NorthstarDLL/client/modlocalisation.cpp b/primedev/client/modlocalisation.cpp similarity index 100% rename from NorthstarDLL/client/modlocalisation.cpp rename to primedev/client/modlocalisation.cpp diff --git a/NorthstarDLL/client/r2client.cpp b/primedev/client/r2client.cpp similarity index 100% rename from NorthstarDLL/client/r2client.cpp rename to primedev/client/r2client.cpp diff --git a/NorthstarDLL/client/r2client.h b/primedev/client/r2client.h similarity index 100% rename from NorthstarDLL/client/r2client.h rename to primedev/client/r2client.h diff --git a/NorthstarDLL/client/rejectconnectionfixes.cpp b/primedev/client/rejectconnectionfixes.cpp similarity index 100% rename from NorthstarDLL/client/rejectconnectionfixes.cpp rename to primedev/client/rejectconnectionfixes.cpp diff --git a/cmake/Findlibcurl.cmake b/primedev/cmake/Findlibcurl.cmake similarity index 79% rename from cmake/Findlibcurl.cmake rename to primedev/cmake/Findlibcurl.cmake index a6f0b47c6..6e158b95e 100644 --- a/cmake/Findlibcurl.cmake +++ b/primedev/cmake/Findlibcurl.cmake @@ -1,7 +1,7 @@ if (NOT libcurl_FOUND) - check_init_submodule(${PROJECT_SOURCE_DIR}/thirdparty/libcurl) + check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/libcurl) set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries") set(BUILD_CURL_EXE OFF CACHE BOOL "Build curl EXE") @@ -13,6 +13,6 @@ if (NOT libcurl_FOUND) set(CURL_CA_BUNDLE "none" CACHE STRING "Disable CA Bundle") set(CURL_CA_PATH "none" CACHE STRING "Disable CA Path") - add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/libcurl libcurl) + add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/libcurl libcurl) set(libcurl_FOUND 1 PARENT_SCOPE) endif() diff --git a/primedev/cmake/Findminhook.cmake b/primedev/cmake/Findminhook.cmake new file mode 100644 index 000000000..aaf66c92d --- /dev/null +++ b/primedev/cmake/Findminhook.cmake @@ -0,0 +1,7 @@ + +if(NOT minhook_FOUND) + check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/minhook) + + add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/minhook minhook) + set(minhook_FOUND 1) +endif() diff --git a/cmake/Findminizip.cmake b/primedev/cmake/Findminizip.cmake similarity index 77% rename from cmake/Findminizip.cmake rename to primedev/cmake/Findminizip.cmake index 15cfa3732..ab48656a9 100644 --- a/cmake/Findminizip.cmake +++ b/primedev/cmake/Findminizip.cmake @@ -1,6 +1,6 @@ if(NOT minizip_FOUND) - check_init_submodule(${PROJECT_SOURCE_DIR}/thirdparty/minizip) + check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/minizip) set(MZ_ZLIB ON CACHE BOOL "Enable ZLIB compression, needed for DEFLATE") set(MZ_BZIP2 OFF CACHE BOOL "Disable BZIP2 compression") @@ -10,7 +10,7 @@ if(NOT minizip_FOUND) set(MZ_ZSTD OFF CACHE BOOL "Disable ZSTD compression") set(MZ_SIGNING OFF CACHE BOOL "Disable zip signing support") - add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/minizip minizip) + add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/minizip minizip) set(minizip_FOUND 1 PARENT_SCOPE) endif() diff --git a/primedev/cmake/Findspdlog.cmake b/primedev/cmake/Findspdlog.cmake new file mode 100644 index 000000000..81596762a --- /dev/null +++ b/primedev/cmake/Findspdlog.cmake @@ -0,0 +1,7 @@ + +if(NOT spdlog_FOUND) + check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/spdlog) + + add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/spdlog spdlog) + set(spdlog_FOUND 1) +endif() diff --git a/cmake/utils.cmake b/primedev/cmake/utils.cmake similarity index 100% rename from cmake/utils.cmake rename to primedev/cmake/utils.cmake diff --git a/NorthstarDLL/config/profile.cpp b/primedev/config/profile.cpp similarity index 100% rename from NorthstarDLL/config/profile.cpp rename to primedev/config/profile.cpp diff --git a/NorthstarDLL/config/profile.h b/primedev/config/profile.h similarity index 100% rename from NorthstarDLL/config/profile.h rename to primedev/config/profile.h diff --git a/NorthstarDLL/core/convar/concommand.cpp b/primedev/core/convar/concommand.cpp similarity index 100% rename from NorthstarDLL/core/convar/concommand.cpp rename to primedev/core/convar/concommand.cpp diff --git a/NorthstarDLL/core/convar/concommand.h b/primedev/core/convar/concommand.h similarity index 100% rename from NorthstarDLL/core/convar/concommand.h rename to primedev/core/convar/concommand.h diff --git a/NorthstarDLL/core/convar/convar.cpp b/primedev/core/convar/convar.cpp similarity index 100% rename from NorthstarDLL/core/convar/convar.cpp rename to primedev/core/convar/convar.cpp diff --git a/NorthstarDLL/core/convar/convar.h b/primedev/core/convar/convar.h similarity index 100% rename from NorthstarDLL/core/convar/convar.h rename to primedev/core/convar/convar.h diff --git a/NorthstarDLL/core/convar/cvar.cpp b/primedev/core/convar/cvar.cpp similarity index 100% rename from NorthstarDLL/core/convar/cvar.cpp rename to primedev/core/convar/cvar.cpp diff --git a/NorthstarDLL/core/convar/cvar.h b/primedev/core/convar/cvar.h similarity index 100% rename from NorthstarDLL/core/convar/cvar.h rename to primedev/core/convar/cvar.h diff --git a/NorthstarDLL/core/filesystem/filesystem.cpp b/primedev/core/filesystem/filesystem.cpp similarity index 100% rename from NorthstarDLL/core/filesystem/filesystem.cpp rename to primedev/core/filesystem/filesystem.cpp diff --git a/NorthstarDLL/core/filesystem/filesystem.h b/primedev/core/filesystem/filesystem.h similarity index 100% rename from NorthstarDLL/core/filesystem/filesystem.h rename to primedev/core/filesystem/filesystem.h diff --git a/NorthstarDLL/core/filesystem/rpakfilesystem.cpp b/primedev/core/filesystem/rpakfilesystem.cpp similarity index 100% rename from NorthstarDLL/core/filesystem/rpakfilesystem.cpp rename to primedev/core/filesystem/rpakfilesystem.cpp diff --git a/NorthstarDLL/core/filesystem/rpakfilesystem.h b/primedev/core/filesystem/rpakfilesystem.h similarity index 100% rename from NorthstarDLL/core/filesystem/rpakfilesystem.h rename to primedev/core/filesystem/rpakfilesystem.h diff --git a/NorthstarDLL/core/hooks.cpp b/primedev/core/hooks.cpp similarity index 100% rename from NorthstarDLL/core/hooks.cpp rename to primedev/core/hooks.cpp diff --git a/NorthstarDLL/core/hooks.h b/primedev/core/hooks.h similarity index 100% rename from NorthstarDLL/core/hooks.h rename to primedev/core/hooks.h diff --git a/NorthstarDLL/core/macros.h b/primedev/core/macros.h similarity index 100% rename from NorthstarDLL/core/macros.h rename to primedev/core/macros.h diff --git a/NorthstarDLL/core/math/bitbuf.h b/primedev/core/math/bitbuf.h similarity index 100% rename from NorthstarDLL/core/math/bitbuf.h rename to primedev/core/math/bitbuf.h diff --git a/NorthstarDLL/core/math/bits.cpp b/primedev/core/math/bits.cpp similarity index 100% rename from NorthstarDLL/core/math/bits.cpp rename to primedev/core/math/bits.cpp diff --git a/NorthstarDLL/core/math/bits.h b/primedev/core/math/bits.h similarity index 100% rename from NorthstarDLL/core/math/bits.h rename to primedev/core/math/bits.h diff --git a/NorthstarDLL/core/math/color.cpp b/primedev/core/math/color.cpp similarity index 100% rename from NorthstarDLL/core/math/color.cpp rename to primedev/core/math/color.cpp diff --git a/NorthstarDLL/core/math/color.h b/primedev/core/math/color.h similarity index 100% rename from NorthstarDLL/core/math/color.h rename to primedev/core/math/color.h diff --git a/NorthstarDLL/core/math/vector.h b/primedev/core/math/vector.h similarity index 100% rename from NorthstarDLL/core/math/vector.h rename to primedev/core/math/vector.h diff --git a/NorthstarDLL/core/memalloc.cpp b/primedev/core/memalloc.cpp similarity index 100% rename from NorthstarDLL/core/memalloc.cpp rename to primedev/core/memalloc.cpp diff --git a/NorthstarDLL/core/memalloc.h b/primedev/core/memalloc.h similarity index 100% rename from NorthstarDLL/core/memalloc.h rename to primedev/core/memalloc.h diff --git a/NorthstarDLL/core/memory.cpp b/primedev/core/memory.cpp similarity index 100% rename from NorthstarDLL/core/memory.cpp rename to primedev/core/memory.cpp diff --git a/NorthstarDLL/core/memory.h b/primedev/core/memory.h similarity index 100% rename from NorthstarDLL/core/memory.h rename to primedev/core/memory.h diff --git a/NorthstarDLL/core/sourceinterface.cpp b/primedev/core/sourceinterface.cpp similarity index 100% rename from NorthstarDLL/core/sourceinterface.cpp rename to primedev/core/sourceinterface.cpp diff --git a/NorthstarDLL/core/sourceinterface.h b/primedev/core/sourceinterface.h similarity index 100% rename from NorthstarDLL/core/sourceinterface.h rename to primedev/core/sourceinterface.h diff --git a/NorthstarDLL/core/structs.h b/primedev/core/structs.h similarity index 100% rename from NorthstarDLL/core/structs.h rename to primedev/core/structs.h diff --git a/NorthstarDLL/core/tier0.cpp b/primedev/core/tier0.cpp similarity index 100% rename from NorthstarDLL/core/tier0.cpp rename to primedev/core/tier0.cpp diff --git a/NorthstarDLL/core/tier0.h b/primedev/core/tier0.h similarity index 100% rename from NorthstarDLL/core/tier0.h rename to primedev/core/tier0.h diff --git a/NorthstarDLL/core/vanilla.h b/primedev/core/vanilla.h similarity index 100% rename from NorthstarDLL/core/vanilla.h rename to primedev/core/vanilla.h diff --git a/NorthstarDLL/dedicated/dedicated.cpp b/primedev/dedicated/dedicated.cpp similarity index 100% rename from NorthstarDLL/dedicated/dedicated.cpp rename to primedev/dedicated/dedicated.cpp diff --git a/NorthstarDLL/dedicated/dedicated.h b/primedev/dedicated/dedicated.h similarity index 100% rename from NorthstarDLL/dedicated/dedicated.h rename to primedev/dedicated/dedicated.h diff --git a/NorthstarDLL/dedicated/dedicatedlogtoclient.cpp b/primedev/dedicated/dedicatedlogtoclient.cpp similarity index 100% rename from NorthstarDLL/dedicated/dedicatedlogtoclient.cpp rename to primedev/dedicated/dedicatedlogtoclient.cpp diff --git a/NorthstarDLL/dedicated/dedicatedlogtoclient.h b/primedev/dedicated/dedicatedlogtoclient.h similarity index 100% rename from NorthstarDLL/dedicated/dedicatedlogtoclient.h rename to primedev/dedicated/dedicatedlogtoclient.h diff --git a/NorthstarDLL/dedicated/dedicatedmaterialsystem.cpp b/primedev/dedicated/dedicatedmaterialsystem.cpp similarity index 100% rename from NorthstarDLL/dedicated/dedicatedmaterialsystem.cpp rename to primedev/dedicated/dedicatedmaterialsystem.cpp diff --git a/NorthstarDLL/dllmain.cpp b/primedev/dllmain.cpp similarity index 100% rename from NorthstarDLL/dllmain.cpp rename to primedev/dllmain.cpp diff --git a/NorthstarDLL/dllmain.h b/primedev/dllmain.h similarity index 100% rename from NorthstarDLL/dllmain.h rename to primedev/dllmain.h diff --git a/NorthstarDLL/engine/host.cpp b/primedev/engine/host.cpp similarity index 100% rename from NorthstarDLL/engine/host.cpp rename to primedev/engine/host.cpp diff --git a/NorthstarDLL/engine/hoststate.cpp b/primedev/engine/hoststate.cpp similarity index 100% rename from NorthstarDLL/engine/hoststate.cpp rename to primedev/engine/hoststate.cpp diff --git a/NorthstarDLL/engine/hoststate.h b/primedev/engine/hoststate.h similarity index 100% rename from NorthstarDLL/engine/hoststate.h rename to primedev/engine/hoststate.h diff --git a/NorthstarDLL/engine/r2engine.cpp b/primedev/engine/r2engine.cpp similarity index 100% rename from NorthstarDLL/engine/r2engine.cpp rename to primedev/engine/r2engine.cpp diff --git a/NorthstarDLL/engine/r2engine.h b/primedev/engine/r2engine.h similarity index 100% rename from NorthstarDLL/engine/r2engine.h rename to primedev/engine/r2engine.h diff --git a/NorthstarDLL/engine/runframe.cpp b/primedev/engine/runframe.cpp similarity index 100% rename from NorthstarDLL/engine/runframe.cpp rename to primedev/engine/runframe.cpp diff --git a/NorthstarDLL/logging/crashhandler.cpp b/primedev/logging/crashhandler.cpp similarity index 100% rename from NorthstarDLL/logging/crashhandler.cpp rename to primedev/logging/crashhandler.cpp diff --git a/NorthstarDLL/logging/crashhandler.h b/primedev/logging/crashhandler.h similarity index 100% rename from NorthstarDLL/logging/crashhandler.h rename to primedev/logging/crashhandler.h diff --git a/NorthstarDLL/logging/logging.cpp b/primedev/logging/logging.cpp similarity index 100% rename from NorthstarDLL/logging/logging.cpp rename to primedev/logging/logging.cpp diff --git a/NorthstarDLL/logging/logging.h b/primedev/logging/logging.h similarity index 100% rename from NorthstarDLL/logging/logging.h rename to primedev/logging/logging.h diff --git a/NorthstarDLL/logging/loghooks.cpp b/primedev/logging/loghooks.cpp similarity index 100% rename from NorthstarDLL/logging/loghooks.cpp rename to primedev/logging/loghooks.cpp diff --git a/NorthstarDLL/logging/loghooks.h b/primedev/logging/loghooks.h similarity index 100% rename from NorthstarDLL/logging/loghooks.h rename to primedev/logging/loghooks.h diff --git a/NorthstarDLL/logging/sourceconsole.cpp b/primedev/logging/sourceconsole.cpp similarity index 100% rename from NorthstarDLL/logging/sourceconsole.cpp rename to primedev/logging/sourceconsole.cpp diff --git a/NorthstarDLL/logging/sourceconsole.h b/primedev/logging/sourceconsole.h similarity index 100% rename from NorthstarDLL/logging/sourceconsole.h rename to primedev/logging/sourceconsole.h diff --git a/NorthstarDLL/masterserver/masterserver.cpp b/primedev/masterserver/masterserver.cpp similarity index 100% rename from NorthstarDLL/masterserver/masterserver.cpp rename to primedev/masterserver/masterserver.cpp diff --git a/NorthstarDLL/masterserver/masterserver.h b/primedev/masterserver/masterserver.h similarity index 100% rename from NorthstarDLL/masterserver/masterserver.h rename to primedev/masterserver/masterserver.h diff --git a/NorthstarDLL/mods/autodownload/moddownloader.cpp b/primedev/mods/autodownload/moddownloader.cpp similarity index 100% rename from NorthstarDLL/mods/autodownload/moddownloader.cpp rename to primedev/mods/autodownload/moddownloader.cpp diff --git a/NorthstarDLL/mods/autodownload/moddownloader.h b/primedev/mods/autodownload/moddownloader.h similarity index 100% rename from NorthstarDLL/mods/autodownload/moddownloader.h rename to primedev/mods/autodownload/moddownloader.h diff --git a/NorthstarDLL/mods/compiled/kb_act.cpp b/primedev/mods/compiled/kb_act.cpp similarity index 100% rename from NorthstarDLL/mods/compiled/kb_act.cpp rename to primedev/mods/compiled/kb_act.cpp diff --git a/NorthstarDLL/mods/compiled/modkeyvalues.cpp b/primedev/mods/compiled/modkeyvalues.cpp similarity index 100% rename from NorthstarDLL/mods/compiled/modkeyvalues.cpp rename to primedev/mods/compiled/modkeyvalues.cpp diff --git a/NorthstarDLL/mods/compiled/modpdef.cpp b/primedev/mods/compiled/modpdef.cpp similarity index 100% rename from NorthstarDLL/mods/compiled/modpdef.cpp rename to primedev/mods/compiled/modpdef.cpp diff --git a/NorthstarDLL/mods/compiled/modscriptsrson.cpp b/primedev/mods/compiled/modscriptsrson.cpp similarity index 100% rename from NorthstarDLL/mods/compiled/modscriptsrson.cpp rename to primedev/mods/compiled/modscriptsrson.cpp diff --git a/NorthstarDLL/mods/modmanager.cpp b/primedev/mods/modmanager.cpp similarity index 100% rename from NorthstarDLL/mods/modmanager.cpp rename to primedev/mods/modmanager.cpp diff --git a/NorthstarDLL/mods/modmanager.h b/primedev/mods/modmanager.h similarity index 100% rename from NorthstarDLL/mods/modmanager.h rename to primedev/mods/modmanager.h diff --git a/NorthstarDLL/mods/modsavefiles.cpp b/primedev/mods/modsavefiles.cpp similarity index 100% rename from NorthstarDLL/mods/modsavefiles.cpp rename to primedev/mods/modsavefiles.cpp diff --git a/NorthstarDLL/mods/modsavefiles.h b/primedev/mods/modsavefiles.h similarity index 100% rename from NorthstarDLL/mods/modsavefiles.h rename to primedev/mods/modsavefiles.h diff --git a/NorthstarDLL/ns_version.h b/primedev/ns_version.h similarity index 100% rename from NorthstarDLL/ns_version.h rename to primedev/ns_version.h diff --git a/NorthstarDLL/pch.h b/primedev/pch.h similarity index 100% rename from NorthstarDLL/pch.h rename to primedev/pch.h diff --git a/NorthstarDLL/plugins/plugin_abi.h b/primedev/plugins/plugin_abi.h similarity index 100% rename from NorthstarDLL/plugins/plugin_abi.h rename to primedev/plugins/plugin_abi.h diff --git a/NorthstarDLL/plugins/pluginbackend.cpp b/primedev/plugins/pluginbackend.cpp similarity index 100% rename from NorthstarDLL/plugins/pluginbackend.cpp rename to primedev/plugins/pluginbackend.cpp diff --git a/NorthstarDLL/plugins/pluginbackend.h b/primedev/plugins/pluginbackend.h similarity index 100% rename from NorthstarDLL/plugins/pluginbackend.h rename to primedev/plugins/pluginbackend.h diff --git a/NorthstarDLL/plugins/plugins.cpp b/primedev/plugins/plugins.cpp similarity index 100% rename from NorthstarDLL/plugins/plugins.cpp rename to primedev/plugins/plugins.cpp diff --git a/NorthstarDLL/plugins/plugins.h b/primedev/plugins/plugins.h similarity index 100% rename from NorthstarDLL/plugins/plugins.h rename to primedev/plugins/plugins.h diff --git a/NorthstarLauncher/main.cpp b/primedev/primelauncher/main.cpp similarity index 100% rename from NorthstarLauncher/main.cpp rename to primedev/primelauncher/main.cpp diff --git a/NorthstarLauncher/ns_icon.ico b/primedev/primelauncher/ns_icon.ico similarity index 100% rename from NorthstarLauncher/ns_icon.ico rename to primedev/primelauncher/ns_icon.ico diff --git a/NorthstarDLL/resource1.h b/primedev/primelauncher/resource1.h similarity index 100% rename from NorthstarDLL/resource1.h rename to primedev/primelauncher/resource1.h diff --git a/NorthstarLauncher/resources.rc b/primedev/primelauncher/resources.rc similarity index 98% rename from NorthstarLauncher/resources.rc rename to primedev/primelauncher/resources.rc index 32038499e..436461227 100644 --- a/NorthstarLauncher/resources.rc +++ b/primedev/primelauncher/resources.rc @@ -1,7 +1,7 @@ // Microsoft Visual C++ generated resource script. // #include "resource1.h" -#include "../NorthstarDLL/ns_version.h" +#include "../ns_version.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// diff --git a/NorthstarLauncher/resource1.h b/primedev/resource1.h similarity index 100% rename from NorthstarLauncher/resource1.h rename to primedev/resource1.h diff --git a/NorthstarDLL/resources.rc b/primedev/resources.rc similarity index 97% rename from NorthstarDLL/resources.rc rename to primedev/resources.rc index 7e996617b..32739daad 100644 --- a/NorthstarDLL/resources.rc +++ b/primedev/resources.rc @@ -1,7 +1,7 @@ // Microsoft Visual C++ generated resource script. // #include "resource1.h" -#include "../NorthstarDLL/ns_version.h" +#include "../primedev/ns_version.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// diff --git a/NorthstarDLL/scripts/client/clientchathooks.cpp b/primedev/scripts/client/clientchathooks.cpp similarity index 100% rename from NorthstarDLL/scripts/client/clientchathooks.cpp rename to primedev/scripts/client/clientchathooks.cpp diff --git a/NorthstarDLL/scripts/client/cursorposition.cpp b/primedev/scripts/client/cursorposition.cpp similarity index 100% rename from NorthstarDLL/scripts/client/cursorposition.cpp rename to primedev/scripts/client/cursorposition.cpp diff --git a/NorthstarDLL/scripts/client/scriptbrowserhooks.cpp b/primedev/scripts/client/scriptbrowserhooks.cpp similarity index 100% rename from NorthstarDLL/scripts/client/scriptbrowserhooks.cpp rename to primedev/scripts/client/scriptbrowserhooks.cpp diff --git a/NorthstarDLL/scripts/client/scriptmainmenupromos.cpp b/primedev/scripts/client/scriptmainmenupromos.cpp similarity index 100% rename from NorthstarDLL/scripts/client/scriptmainmenupromos.cpp rename to primedev/scripts/client/scriptmainmenupromos.cpp diff --git a/NorthstarDLL/scripts/client/scriptmodmenu.cpp b/primedev/scripts/client/scriptmodmenu.cpp similarity index 100% rename from NorthstarDLL/scripts/client/scriptmodmenu.cpp rename to primedev/scripts/client/scriptmodmenu.cpp diff --git a/NorthstarDLL/scripts/client/scriptoriginauth.cpp b/primedev/scripts/client/scriptoriginauth.cpp similarity index 100% rename from NorthstarDLL/scripts/client/scriptoriginauth.cpp rename to primedev/scripts/client/scriptoriginauth.cpp diff --git a/NorthstarDLL/scripts/client/scriptserverbrowser.cpp b/primedev/scripts/client/scriptserverbrowser.cpp similarity index 100% rename from NorthstarDLL/scripts/client/scriptserverbrowser.cpp rename to primedev/scripts/client/scriptserverbrowser.cpp diff --git a/NorthstarDLL/scripts/client/scriptservertoclientstringcommand.cpp b/primedev/scripts/client/scriptservertoclientstringcommand.cpp similarity index 100% rename from NorthstarDLL/scripts/client/scriptservertoclientstringcommand.cpp rename to primedev/scripts/client/scriptservertoclientstringcommand.cpp diff --git a/NorthstarDLL/scripts/scriptdatatables.cpp b/primedev/scripts/scriptdatatables.cpp similarity index 100% rename from NorthstarDLL/scripts/scriptdatatables.cpp rename to primedev/scripts/scriptdatatables.cpp diff --git a/NorthstarDLL/scripts/scripthttprequesthandler.cpp b/primedev/scripts/scripthttprequesthandler.cpp similarity index 100% rename from NorthstarDLL/scripts/scripthttprequesthandler.cpp rename to primedev/scripts/scripthttprequesthandler.cpp diff --git a/NorthstarDLL/scripts/scripthttprequesthandler.h b/primedev/scripts/scripthttprequesthandler.h similarity index 100% rename from NorthstarDLL/scripts/scripthttprequesthandler.h rename to primedev/scripts/scripthttprequesthandler.h diff --git a/NorthstarDLL/scripts/scriptjson.cpp b/primedev/scripts/scriptjson.cpp similarity index 100% rename from NorthstarDLL/scripts/scriptjson.cpp rename to primedev/scripts/scriptjson.cpp diff --git a/NorthstarDLL/scripts/scriptjson.h b/primedev/scripts/scriptjson.h similarity index 100% rename from NorthstarDLL/scripts/scriptjson.h rename to primedev/scripts/scriptjson.h diff --git a/NorthstarDLL/scripts/scriptutility.cpp b/primedev/scripts/scriptutility.cpp similarity index 100% rename from NorthstarDLL/scripts/scriptutility.cpp rename to primedev/scripts/scriptutility.cpp diff --git a/NorthstarDLL/scripts/server/miscserverfixes.cpp b/primedev/scripts/server/miscserverfixes.cpp similarity index 100% rename from NorthstarDLL/scripts/server/miscserverfixes.cpp rename to primedev/scripts/server/miscserverfixes.cpp diff --git a/NorthstarDLL/scripts/server/miscserverscript.cpp b/primedev/scripts/server/miscserverscript.cpp similarity index 100% rename from NorthstarDLL/scripts/server/miscserverscript.cpp rename to primedev/scripts/server/miscserverscript.cpp diff --git a/NorthstarDLL/scripts/server/scriptuserinfo.cpp b/primedev/scripts/server/scriptuserinfo.cpp similarity index 100% rename from NorthstarDLL/scripts/server/scriptuserinfo.cpp rename to primedev/scripts/server/scriptuserinfo.cpp diff --git a/NorthstarDLL/server/alltalk.cpp b/primedev/server/alltalk.cpp similarity index 100% rename from NorthstarDLL/server/alltalk.cpp rename to primedev/server/alltalk.cpp diff --git a/NorthstarDLL/server/auth/bansystem.cpp b/primedev/server/auth/bansystem.cpp similarity index 100% rename from NorthstarDLL/server/auth/bansystem.cpp rename to primedev/server/auth/bansystem.cpp diff --git a/NorthstarDLL/server/auth/bansystem.h b/primedev/server/auth/bansystem.h similarity index 100% rename from NorthstarDLL/server/auth/bansystem.h rename to primedev/server/auth/bansystem.h diff --git a/NorthstarDLL/server/auth/serverauthentication.cpp b/primedev/server/auth/serverauthentication.cpp similarity index 100% rename from NorthstarDLL/server/auth/serverauthentication.cpp rename to primedev/server/auth/serverauthentication.cpp diff --git a/NorthstarDLL/server/auth/serverauthentication.h b/primedev/server/auth/serverauthentication.h similarity index 100% rename from NorthstarDLL/server/auth/serverauthentication.h rename to primedev/server/auth/serverauthentication.h diff --git a/NorthstarDLL/server/buildainfile.cpp b/primedev/server/buildainfile.cpp similarity index 100% rename from NorthstarDLL/server/buildainfile.cpp rename to primedev/server/buildainfile.cpp diff --git a/NorthstarDLL/server/r2server.cpp b/primedev/server/r2server.cpp similarity index 100% rename from NorthstarDLL/server/r2server.cpp rename to primedev/server/r2server.cpp diff --git a/NorthstarDLL/server/r2server.h b/primedev/server/r2server.h similarity index 100% rename from NorthstarDLL/server/r2server.h rename to primedev/server/r2server.h diff --git a/NorthstarDLL/server/serverchathooks.cpp b/primedev/server/serverchathooks.cpp similarity index 100% rename from NorthstarDLL/server/serverchathooks.cpp rename to primedev/server/serverchathooks.cpp diff --git a/NorthstarDLL/server/serverchathooks.h b/primedev/server/serverchathooks.h similarity index 100% rename from NorthstarDLL/server/serverchathooks.h rename to primedev/server/serverchathooks.h diff --git a/NorthstarDLL/server/servernethooks.cpp b/primedev/server/servernethooks.cpp similarity index 100% rename from NorthstarDLL/server/servernethooks.cpp rename to primedev/server/servernethooks.cpp diff --git a/NorthstarDLL/server/serverpresence.cpp b/primedev/server/serverpresence.cpp similarity index 100% rename from NorthstarDLL/server/serverpresence.cpp rename to primedev/server/serverpresence.cpp diff --git a/NorthstarDLL/server/serverpresence.h b/primedev/server/serverpresence.h similarity index 100% rename from NorthstarDLL/server/serverpresence.h rename to primedev/server/serverpresence.h diff --git a/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp b/primedev/shared/exploit_fixes/exploitfixes.cpp similarity index 100% rename from NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp rename to primedev/shared/exploit_fixes/exploitfixes.cpp diff --git a/NorthstarDLL/shared/exploit_fixes/exploitfixes_lzss.cpp b/primedev/shared/exploit_fixes/exploitfixes_lzss.cpp similarity index 100% rename from NorthstarDLL/shared/exploit_fixes/exploitfixes_lzss.cpp rename to primedev/shared/exploit_fixes/exploitfixes_lzss.cpp diff --git a/NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp b/primedev/shared/exploit_fixes/exploitfixes_utf8parser.cpp similarity index 100% rename from NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp rename to primedev/shared/exploit_fixes/exploitfixes_utf8parser.cpp diff --git a/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp b/primedev/shared/exploit_fixes/ns_limits.cpp similarity index 100% rename from NorthstarDLL/shared/exploit_fixes/ns_limits.cpp rename to primedev/shared/exploit_fixes/ns_limits.cpp diff --git a/NorthstarDLL/shared/exploit_fixes/ns_limits.h b/primedev/shared/exploit_fixes/ns_limits.h similarity index 100% rename from NorthstarDLL/shared/exploit_fixes/ns_limits.h rename to primedev/shared/exploit_fixes/ns_limits.h diff --git a/NorthstarDLL/shared/keyvalues.cpp b/primedev/shared/keyvalues.cpp similarity index 100% rename from NorthstarDLL/shared/keyvalues.cpp rename to primedev/shared/keyvalues.cpp diff --git a/NorthstarDLL/shared/keyvalues.h b/primedev/shared/keyvalues.h similarity index 100% rename from NorthstarDLL/shared/keyvalues.h rename to primedev/shared/keyvalues.h diff --git a/NorthstarDLL/shared/maxplayers.cpp b/primedev/shared/maxplayers.cpp similarity index 100% rename from NorthstarDLL/shared/maxplayers.cpp rename to primedev/shared/maxplayers.cpp diff --git a/NorthstarDLL/shared/maxplayers.h b/primedev/shared/maxplayers.h similarity index 100% rename from NorthstarDLL/shared/maxplayers.h rename to primedev/shared/maxplayers.h diff --git a/NorthstarDLL/shared/misccommands.cpp b/primedev/shared/misccommands.cpp similarity index 100% rename from NorthstarDLL/shared/misccommands.cpp rename to primedev/shared/misccommands.cpp diff --git a/NorthstarDLL/shared/misccommands.h b/primedev/shared/misccommands.h similarity index 100% rename from NorthstarDLL/shared/misccommands.h rename to primedev/shared/misccommands.h diff --git a/NorthstarDLL/shared/playlist.cpp b/primedev/shared/playlist.cpp similarity index 100% rename from NorthstarDLL/shared/playlist.cpp rename to primedev/shared/playlist.cpp diff --git a/NorthstarDLL/shared/playlist.h b/primedev/shared/playlist.h similarity index 100% rename from NorthstarDLL/shared/playlist.h rename to primedev/shared/playlist.h diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/primedev/squirrel/squirrel.cpp similarity index 100% rename from NorthstarDLL/squirrel/squirrel.cpp rename to primedev/squirrel/squirrel.cpp diff --git a/NorthstarDLL/squirrel/squirrel.h b/primedev/squirrel/squirrel.h similarity index 100% rename from NorthstarDLL/squirrel/squirrel.h rename to primedev/squirrel/squirrel.h diff --git a/NorthstarDLL/squirrel/squirrelautobind.cpp b/primedev/squirrel/squirrelautobind.cpp similarity index 100% rename from NorthstarDLL/squirrel/squirrelautobind.cpp rename to primedev/squirrel/squirrelautobind.cpp diff --git a/NorthstarDLL/squirrel/squirrelautobind.h b/primedev/squirrel/squirrelautobind.h similarity index 100% rename from NorthstarDLL/squirrel/squirrelautobind.h rename to primedev/squirrel/squirrelautobind.h diff --git a/NorthstarDLL/squirrel/squirrelclasstypes.h b/primedev/squirrel/squirrelclasstypes.h similarity index 100% rename from NorthstarDLL/squirrel/squirrelclasstypes.h rename to primedev/squirrel/squirrelclasstypes.h diff --git a/NorthstarDLL/squirrel/squirreldatatypes.h b/primedev/squirrel/squirreldatatypes.h similarity index 100% rename from NorthstarDLL/squirrel/squirreldatatypes.h rename to primedev/squirrel/squirreldatatypes.h diff --git a/thirdparty/libcurl b/primedev/thirdparty/libcurl similarity index 100% rename from thirdparty/libcurl rename to primedev/thirdparty/libcurl diff --git a/thirdparty/minhook b/primedev/thirdparty/minhook similarity index 100% rename from thirdparty/minhook rename to primedev/thirdparty/minhook diff --git a/thirdparty/minizip b/primedev/thirdparty/minizip similarity index 100% rename from thirdparty/minizip rename to primedev/thirdparty/minizip diff --git a/thirdparty/rapidjson/allocators.h b/primedev/thirdparty/rapidjson/allocators.h similarity index 100% rename from thirdparty/rapidjson/allocators.h rename to primedev/thirdparty/rapidjson/allocators.h diff --git a/thirdparty/rapidjson/document.h b/primedev/thirdparty/rapidjson/document.h similarity index 100% rename from thirdparty/rapidjson/document.h rename to primedev/thirdparty/rapidjson/document.h diff --git a/thirdparty/rapidjson/encodedstream.h b/primedev/thirdparty/rapidjson/encodedstream.h similarity index 100% rename from thirdparty/rapidjson/encodedstream.h rename to primedev/thirdparty/rapidjson/encodedstream.h diff --git a/thirdparty/rapidjson/encodings.h b/primedev/thirdparty/rapidjson/encodings.h similarity index 100% rename from thirdparty/rapidjson/encodings.h rename to primedev/thirdparty/rapidjson/encodings.h diff --git a/thirdparty/rapidjson/error/en.h b/primedev/thirdparty/rapidjson/error/en.h similarity index 100% rename from thirdparty/rapidjson/error/en.h rename to primedev/thirdparty/rapidjson/error/en.h diff --git a/thirdparty/rapidjson/error/error.h b/primedev/thirdparty/rapidjson/error/error.h similarity index 100% rename from thirdparty/rapidjson/error/error.h rename to primedev/thirdparty/rapidjson/error/error.h diff --git a/thirdparty/rapidjson/filereadstream.h b/primedev/thirdparty/rapidjson/filereadstream.h similarity index 100% rename from thirdparty/rapidjson/filereadstream.h rename to primedev/thirdparty/rapidjson/filereadstream.h diff --git a/thirdparty/rapidjson/filewritestream.h b/primedev/thirdparty/rapidjson/filewritestream.h similarity index 100% rename from thirdparty/rapidjson/filewritestream.h rename to primedev/thirdparty/rapidjson/filewritestream.h diff --git a/thirdparty/rapidjson/fwd.h b/primedev/thirdparty/rapidjson/fwd.h similarity index 100% rename from thirdparty/rapidjson/fwd.h rename to primedev/thirdparty/rapidjson/fwd.h diff --git a/thirdparty/rapidjson/internal/biginteger.h b/primedev/thirdparty/rapidjson/internal/biginteger.h similarity index 100% rename from thirdparty/rapidjson/internal/biginteger.h rename to primedev/thirdparty/rapidjson/internal/biginteger.h diff --git a/thirdparty/rapidjson/internal/diyfp.h b/primedev/thirdparty/rapidjson/internal/diyfp.h similarity index 100% rename from thirdparty/rapidjson/internal/diyfp.h rename to primedev/thirdparty/rapidjson/internal/diyfp.h diff --git a/thirdparty/rapidjson/internal/dtoa.h b/primedev/thirdparty/rapidjson/internal/dtoa.h similarity index 100% rename from thirdparty/rapidjson/internal/dtoa.h rename to primedev/thirdparty/rapidjson/internal/dtoa.h diff --git a/thirdparty/rapidjson/internal/ieee754.h b/primedev/thirdparty/rapidjson/internal/ieee754.h similarity index 100% rename from thirdparty/rapidjson/internal/ieee754.h rename to primedev/thirdparty/rapidjson/internal/ieee754.h diff --git a/thirdparty/rapidjson/internal/itoa.h b/primedev/thirdparty/rapidjson/internal/itoa.h similarity index 100% rename from thirdparty/rapidjson/internal/itoa.h rename to primedev/thirdparty/rapidjson/internal/itoa.h diff --git a/thirdparty/rapidjson/internal/meta.h b/primedev/thirdparty/rapidjson/internal/meta.h similarity index 100% rename from thirdparty/rapidjson/internal/meta.h rename to primedev/thirdparty/rapidjson/internal/meta.h diff --git a/thirdparty/rapidjson/internal/pow10.h b/primedev/thirdparty/rapidjson/internal/pow10.h similarity index 100% rename from thirdparty/rapidjson/internal/pow10.h rename to primedev/thirdparty/rapidjson/internal/pow10.h diff --git a/thirdparty/rapidjson/internal/regex.h b/primedev/thirdparty/rapidjson/internal/regex.h similarity index 100% rename from thirdparty/rapidjson/internal/regex.h rename to primedev/thirdparty/rapidjson/internal/regex.h diff --git a/thirdparty/rapidjson/internal/stack.h b/primedev/thirdparty/rapidjson/internal/stack.h similarity index 100% rename from thirdparty/rapidjson/internal/stack.h rename to primedev/thirdparty/rapidjson/internal/stack.h diff --git a/thirdparty/rapidjson/internal/strfunc.h b/primedev/thirdparty/rapidjson/internal/strfunc.h similarity index 100% rename from thirdparty/rapidjson/internal/strfunc.h rename to primedev/thirdparty/rapidjson/internal/strfunc.h diff --git a/thirdparty/rapidjson/internal/strtod.h b/primedev/thirdparty/rapidjson/internal/strtod.h similarity index 100% rename from thirdparty/rapidjson/internal/strtod.h rename to primedev/thirdparty/rapidjson/internal/strtod.h diff --git a/thirdparty/rapidjson/internal/swap.h b/primedev/thirdparty/rapidjson/internal/swap.h similarity index 100% rename from thirdparty/rapidjson/internal/swap.h rename to primedev/thirdparty/rapidjson/internal/swap.h diff --git a/thirdparty/rapidjson/istreamwrapper.h b/primedev/thirdparty/rapidjson/istreamwrapper.h similarity index 100% rename from thirdparty/rapidjson/istreamwrapper.h rename to primedev/thirdparty/rapidjson/istreamwrapper.h diff --git a/thirdparty/rapidjson/memorybuffer.h b/primedev/thirdparty/rapidjson/memorybuffer.h similarity index 100% rename from thirdparty/rapidjson/memorybuffer.h rename to primedev/thirdparty/rapidjson/memorybuffer.h diff --git a/thirdparty/rapidjson/memorystream.h b/primedev/thirdparty/rapidjson/memorystream.h similarity index 100% rename from thirdparty/rapidjson/memorystream.h rename to primedev/thirdparty/rapidjson/memorystream.h diff --git a/thirdparty/rapidjson/msinttypes/inttypes.h b/primedev/thirdparty/rapidjson/msinttypes/inttypes.h similarity index 100% rename from thirdparty/rapidjson/msinttypes/inttypes.h rename to primedev/thirdparty/rapidjson/msinttypes/inttypes.h diff --git a/thirdparty/rapidjson/msinttypes/stdint.h b/primedev/thirdparty/rapidjson/msinttypes/stdint.h similarity index 100% rename from thirdparty/rapidjson/msinttypes/stdint.h rename to primedev/thirdparty/rapidjson/msinttypes/stdint.h diff --git a/thirdparty/rapidjson/ostreamwrapper.h b/primedev/thirdparty/rapidjson/ostreamwrapper.h similarity index 100% rename from thirdparty/rapidjson/ostreamwrapper.h rename to primedev/thirdparty/rapidjson/ostreamwrapper.h diff --git a/thirdparty/rapidjson/pointer.h b/primedev/thirdparty/rapidjson/pointer.h similarity index 100% rename from thirdparty/rapidjson/pointer.h rename to primedev/thirdparty/rapidjson/pointer.h diff --git a/thirdparty/rapidjson/prettywriter.h b/primedev/thirdparty/rapidjson/prettywriter.h similarity index 100% rename from thirdparty/rapidjson/prettywriter.h rename to primedev/thirdparty/rapidjson/prettywriter.h diff --git a/thirdparty/rapidjson/rapidjson.h b/primedev/thirdparty/rapidjson/rapidjson.h similarity index 100% rename from thirdparty/rapidjson/rapidjson.h rename to primedev/thirdparty/rapidjson/rapidjson.h diff --git a/thirdparty/rapidjson/reader.h b/primedev/thirdparty/rapidjson/reader.h similarity index 100% rename from thirdparty/rapidjson/reader.h rename to primedev/thirdparty/rapidjson/reader.h diff --git a/thirdparty/rapidjson/schema.h b/primedev/thirdparty/rapidjson/schema.h similarity index 100% rename from thirdparty/rapidjson/schema.h rename to primedev/thirdparty/rapidjson/schema.h diff --git a/thirdparty/rapidjson/stream.h b/primedev/thirdparty/rapidjson/stream.h similarity index 100% rename from thirdparty/rapidjson/stream.h rename to primedev/thirdparty/rapidjson/stream.h diff --git a/thirdparty/rapidjson/stringbuffer.h b/primedev/thirdparty/rapidjson/stringbuffer.h similarity index 100% rename from thirdparty/rapidjson/stringbuffer.h rename to primedev/thirdparty/rapidjson/stringbuffer.h diff --git a/thirdparty/rapidjson/writer.h b/primedev/thirdparty/rapidjson/writer.h similarity index 100% rename from thirdparty/rapidjson/writer.h rename to primedev/thirdparty/rapidjson/writer.h diff --git a/thirdparty/spdlog/async.h b/primedev/thirdparty/spdlog/async.h similarity index 100% rename from thirdparty/spdlog/async.h rename to primedev/thirdparty/spdlog/async.h diff --git a/thirdparty/spdlog/async_logger-inl.h b/primedev/thirdparty/spdlog/async_logger-inl.h similarity index 100% rename from thirdparty/spdlog/async_logger-inl.h rename to primedev/thirdparty/spdlog/async_logger-inl.h diff --git a/thirdparty/spdlog/async_logger.h b/primedev/thirdparty/spdlog/async_logger.h similarity index 100% rename from thirdparty/spdlog/async_logger.h rename to primedev/thirdparty/spdlog/async_logger.h diff --git a/thirdparty/spdlog/cfg/argv.h b/primedev/thirdparty/spdlog/cfg/argv.h similarity index 100% rename from thirdparty/spdlog/cfg/argv.h rename to primedev/thirdparty/spdlog/cfg/argv.h diff --git a/thirdparty/spdlog/cfg/env.h b/primedev/thirdparty/spdlog/cfg/env.h similarity index 100% rename from thirdparty/spdlog/cfg/env.h rename to primedev/thirdparty/spdlog/cfg/env.h diff --git a/thirdparty/spdlog/cfg/helpers-inl.h b/primedev/thirdparty/spdlog/cfg/helpers-inl.h similarity index 100% rename from thirdparty/spdlog/cfg/helpers-inl.h rename to primedev/thirdparty/spdlog/cfg/helpers-inl.h diff --git a/thirdparty/spdlog/cfg/helpers.h b/primedev/thirdparty/spdlog/cfg/helpers.h similarity index 100% rename from thirdparty/spdlog/cfg/helpers.h rename to primedev/thirdparty/spdlog/cfg/helpers.h diff --git a/thirdparty/spdlog/common-inl.h b/primedev/thirdparty/spdlog/common-inl.h similarity index 100% rename from thirdparty/spdlog/common-inl.h rename to primedev/thirdparty/spdlog/common-inl.h diff --git a/thirdparty/spdlog/common.h b/primedev/thirdparty/spdlog/common.h similarity index 100% rename from thirdparty/spdlog/common.h rename to primedev/thirdparty/spdlog/common.h diff --git a/thirdparty/spdlog/details/backtracer-inl.h b/primedev/thirdparty/spdlog/details/backtracer-inl.h similarity index 100% rename from thirdparty/spdlog/details/backtracer-inl.h rename to primedev/thirdparty/spdlog/details/backtracer-inl.h diff --git a/thirdparty/spdlog/details/backtracer.h b/primedev/thirdparty/spdlog/details/backtracer.h similarity index 100% rename from thirdparty/spdlog/details/backtracer.h rename to primedev/thirdparty/spdlog/details/backtracer.h diff --git a/thirdparty/spdlog/details/circular_q.h b/primedev/thirdparty/spdlog/details/circular_q.h similarity index 100% rename from thirdparty/spdlog/details/circular_q.h rename to primedev/thirdparty/spdlog/details/circular_q.h diff --git a/thirdparty/spdlog/details/console_globals.h b/primedev/thirdparty/spdlog/details/console_globals.h similarity index 100% rename from thirdparty/spdlog/details/console_globals.h rename to primedev/thirdparty/spdlog/details/console_globals.h diff --git a/thirdparty/spdlog/details/file_helper-inl.h b/primedev/thirdparty/spdlog/details/file_helper-inl.h similarity index 100% rename from thirdparty/spdlog/details/file_helper-inl.h rename to primedev/thirdparty/spdlog/details/file_helper-inl.h diff --git a/thirdparty/spdlog/details/file_helper.h b/primedev/thirdparty/spdlog/details/file_helper.h similarity index 100% rename from thirdparty/spdlog/details/file_helper.h rename to primedev/thirdparty/spdlog/details/file_helper.h diff --git a/thirdparty/spdlog/details/fmt_helper.h b/primedev/thirdparty/spdlog/details/fmt_helper.h similarity index 100% rename from thirdparty/spdlog/details/fmt_helper.h rename to primedev/thirdparty/spdlog/details/fmt_helper.h diff --git a/thirdparty/spdlog/details/log_msg-inl.h b/primedev/thirdparty/spdlog/details/log_msg-inl.h similarity index 100% rename from thirdparty/spdlog/details/log_msg-inl.h rename to primedev/thirdparty/spdlog/details/log_msg-inl.h diff --git a/thirdparty/spdlog/details/log_msg.h b/primedev/thirdparty/spdlog/details/log_msg.h similarity index 100% rename from thirdparty/spdlog/details/log_msg.h rename to primedev/thirdparty/spdlog/details/log_msg.h diff --git a/thirdparty/spdlog/details/log_msg_buffer-inl.h b/primedev/thirdparty/spdlog/details/log_msg_buffer-inl.h similarity index 100% rename from thirdparty/spdlog/details/log_msg_buffer-inl.h rename to primedev/thirdparty/spdlog/details/log_msg_buffer-inl.h diff --git a/thirdparty/spdlog/details/log_msg_buffer.h b/primedev/thirdparty/spdlog/details/log_msg_buffer.h similarity index 100% rename from thirdparty/spdlog/details/log_msg_buffer.h rename to primedev/thirdparty/spdlog/details/log_msg_buffer.h diff --git a/thirdparty/spdlog/details/mpmc_blocking_q.h b/primedev/thirdparty/spdlog/details/mpmc_blocking_q.h similarity index 100% rename from thirdparty/spdlog/details/mpmc_blocking_q.h rename to primedev/thirdparty/spdlog/details/mpmc_blocking_q.h diff --git a/thirdparty/spdlog/details/null_mutex.h b/primedev/thirdparty/spdlog/details/null_mutex.h similarity index 100% rename from thirdparty/spdlog/details/null_mutex.h rename to primedev/thirdparty/spdlog/details/null_mutex.h diff --git a/thirdparty/spdlog/details/os-inl.h b/primedev/thirdparty/spdlog/details/os-inl.h similarity index 100% rename from thirdparty/spdlog/details/os-inl.h rename to primedev/thirdparty/spdlog/details/os-inl.h diff --git a/thirdparty/spdlog/details/os.h b/primedev/thirdparty/spdlog/details/os.h similarity index 100% rename from thirdparty/spdlog/details/os.h rename to primedev/thirdparty/spdlog/details/os.h diff --git a/thirdparty/spdlog/details/periodic_worker-inl.h b/primedev/thirdparty/spdlog/details/periodic_worker-inl.h similarity index 100% rename from thirdparty/spdlog/details/periodic_worker-inl.h rename to primedev/thirdparty/spdlog/details/periodic_worker-inl.h diff --git a/thirdparty/spdlog/details/periodic_worker.h b/primedev/thirdparty/spdlog/details/periodic_worker.h similarity index 100% rename from thirdparty/spdlog/details/periodic_worker.h rename to primedev/thirdparty/spdlog/details/periodic_worker.h diff --git a/thirdparty/spdlog/details/registry-inl.h b/primedev/thirdparty/spdlog/details/registry-inl.h similarity index 100% rename from thirdparty/spdlog/details/registry-inl.h rename to primedev/thirdparty/spdlog/details/registry-inl.h diff --git a/thirdparty/spdlog/details/registry.h b/primedev/thirdparty/spdlog/details/registry.h similarity index 100% rename from thirdparty/spdlog/details/registry.h rename to primedev/thirdparty/spdlog/details/registry.h diff --git a/thirdparty/spdlog/details/synchronous_factory.h b/primedev/thirdparty/spdlog/details/synchronous_factory.h similarity index 100% rename from thirdparty/spdlog/details/synchronous_factory.h rename to primedev/thirdparty/spdlog/details/synchronous_factory.h diff --git a/thirdparty/spdlog/details/tcp_client-windows.h b/primedev/thirdparty/spdlog/details/tcp_client-windows.h similarity index 100% rename from thirdparty/spdlog/details/tcp_client-windows.h rename to primedev/thirdparty/spdlog/details/tcp_client-windows.h diff --git a/thirdparty/spdlog/details/tcp_client.h b/primedev/thirdparty/spdlog/details/tcp_client.h similarity index 100% rename from thirdparty/spdlog/details/tcp_client.h rename to primedev/thirdparty/spdlog/details/tcp_client.h diff --git a/thirdparty/spdlog/details/thread_pool-inl.h b/primedev/thirdparty/spdlog/details/thread_pool-inl.h similarity index 100% rename from thirdparty/spdlog/details/thread_pool-inl.h rename to primedev/thirdparty/spdlog/details/thread_pool-inl.h diff --git a/thirdparty/spdlog/details/thread_pool.h b/primedev/thirdparty/spdlog/details/thread_pool.h similarity index 100% rename from thirdparty/spdlog/details/thread_pool.h rename to primedev/thirdparty/spdlog/details/thread_pool.h diff --git a/thirdparty/spdlog/details/windows_include.h b/primedev/thirdparty/spdlog/details/windows_include.h similarity index 100% rename from thirdparty/spdlog/details/windows_include.h rename to primedev/thirdparty/spdlog/details/windows_include.h diff --git a/thirdparty/spdlog/fmt/bin_to_hex.h b/primedev/thirdparty/spdlog/fmt/bin_to_hex.h similarity index 100% rename from thirdparty/spdlog/fmt/bin_to_hex.h rename to primedev/thirdparty/spdlog/fmt/bin_to_hex.h diff --git a/thirdparty/spdlog/fmt/bundled/LICENSE.rst b/primedev/thirdparty/spdlog/fmt/bundled/LICENSE.rst similarity index 100% rename from thirdparty/spdlog/fmt/bundled/LICENSE.rst rename to primedev/thirdparty/spdlog/fmt/bundled/LICENSE.rst diff --git a/thirdparty/spdlog/fmt/bundled/chrono.h b/primedev/thirdparty/spdlog/fmt/bundled/chrono.h similarity index 100% rename from thirdparty/spdlog/fmt/bundled/chrono.h rename to primedev/thirdparty/spdlog/fmt/bundled/chrono.h diff --git a/thirdparty/spdlog/fmt/bundled/color.h b/primedev/thirdparty/spdlog/fmt/bundled/color.h similarity index 100% rename from thirdparty/spdlog/fmt/bundled/color.h rename to primedev/thirdparty/spdlog/fmt/bundled/color.h diff --git a/thirdparty/spdlog/fmt/bundled/compile.h b/primedev/thirdparty/spdlog/fmt/bundled/compile.h similarity index 100% rename from thirdparty/spdlog/fmt/bundled/compile.h rename to primedev/thirdparty/spdlog/fmt/bundled/compile.h diff --git a/thirdparty/spdlog/fmt/bundled/core.h b/primedev/thirdparty/spdlog/fmt/bundled/core.h similarity index 100% rename from thirdparty/spdlog/fmt/bundled/core.h rename to primedev/thirdparty/spdlog/fmt/bundled/core.h diff --git a/thirdparty/spdlog/fmt/bundled/format-inl.h b/primedev/thirdparty/spdlog/fmt/bundled/format-inl.h similarity index 100% rename from thirdparty/spdlog/fmt/bundled/format-inl.h rename to primedev/thirdparty/spdlog/fmt/bundled/format-inl.h diff --git a/thirdparty/spdlog/fmt/bundled/format.h b/primedev/thirdparty/spdlog/fmt/bundled/format.h similarity index 100% rename from thirdparty/spdlog/fmt/bundled/format.h rename to primedev/thirdparty/spdlog/fmt/bundled/format.h diff --git a/thirdparty/spdlog/fmt/bundled/locale.h b/primedev/thirdparty/spdlog/fmt/bundled/locale.h similarity index 100% rename from thirdparty/spdlog/fmt/bundled/locale.h rename to primedev/thirdparty/spdlog/fmt/bundled/locale.h diff --git a/thirdparty/spdlog/fmt/bundled/os.h b/primedev/thirdparty/spdlog/fmt/bundled/os.h similarity index 100% rename from thirdparty/spdlog/fmt/bundled/os.h rename to primedev/thirdparty/spdlog/fmt/bundled/os.h diff --git a/thirdparty/spdlog/fmt/bundled/ostream.h b/primedev/thirdparty/spdlog/fmt/bundled/ostream.h similarity index 100% rename from thirdparty/spdlog/fmt/bundled/ostream.h rename to primedev/thirdparty/spdlog/fmt/bundled/ostream.h diff --git a/thirdparty/spdlog/fmt/bundled/posix.h b/primedev/thirdparty/spdlog/fmt/bundled/posix.h similarity index 100% rename from thirdparty/spdlog/fmt/bundled/posix.h rename to primedev/thirdparty/spdlog/fmt/bundled/posix.h diff --git a/thirdparty/spdlog/fmt/bundled/printf.h b/primedev/thirdparty/spdlog/fmt/bundled/printf.h similarity index 100% rename from thirdparty/spdlog/fmt/bundled/printf.h rename to primedev/thirdparty/spdlog/fmt/bundled/printf.h diff --git a/thirdparty/spdlog/fmt/bundled/ranges.h b/primedev/thirdparty/spdlog/fmt/bundled/ranges.h similarity index 100% rename from thirdparty/spdlog/fmt/bundled/ranges.h rename to primedev/thirdparty/spdlog/fmt/bundled/ranges.h diff --git a/thirdparty/spdlog/fmt/chrono.h b/primedev/thirdparty/spdlog/fmt/chrono.h similarity index 100% rename from thirdparty/spdlog/fmt/chrono.h rename to primedev/thirdparty/spdlog/fmt/chrono.h diff --git a/thirdparty/spdlog/fmt/fmt.h b/primedev/thirdparty/spdlog/fmt/fmt.h similarity index 100% rename from thirdparty/spdlog/fmt/fmt.h rename to primedev/thirdparty/spdlog/fmt/fmt.h diff --git a/thirdparty/spdlog/fmt/ostr.h b/primedev/thirdparty/spdlog/fmt/ostr.h similarity index 100% rename from thirdparty/spdlog/fmt/ostr.h rename to primedev/thirdparty/spdlog/fmt/ostr.h diff --git a/thirdparty/spdlog/formatter.h b/primedev/thirdparty/spdlog/formatter.h similarity index 100% rename from thirdparty/spdlog/formatter.h rename to primedev/thirdparty/spdlog/formatter.h diff --git a/thirdparty/spdlog/fwd.h b/primedev/thirdparty/spdlog/fwd.h similarity index 100% rename from thirdparty/spdlog/fwd.h rename to primedev/thirdparty/spdlog/fwd.h diff --git a/thirdparty/spdlog/logger-inl.h b/primedev/thirdparty/spdlog/logger-inl.h similarity index 100% rename from thirdparty/spdlog/logger-inl.h rename to primedev/thirdparty/spdlog/logger-inl.h diff --git a/thirdparty/spdlog/logger.h b/primedev/thirdparty/spdlog/logger.h similarity index 100% rename from thirdparty/spdlog/logger.h rename to primedev/thirdparty/spdlog/logger.h diff --git a/thirdparty/spdlog/pattern_formatter-inl.h b/primedev/thirdparty/spdlog/pattern_formatter-inl.h similarity index 100% rename from thirdparty/spdlog/pattern_formatter-inl.h rename to primedev/thirdparty/spdlog/pattern_formatter-inl.h diff --git a/thirdparty/spdlog/pattern_formatter.h b/primedev/thirdparty/spdlog/pattern_formatter.h similarity index 100% rename from thirdparty/spdlog/pattern_formatter.h rename to primedev/thirdparty/spdlog/pattern_formatter.h diff --git a/thirdparty/spdlog/sinks/android_sink.h b/primedev/thirdparty/spdlog/sinks/android_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/android_sink.h rename to primedev/thirdparty/spdlog/sinks/android_sink.h diff --git a/thirdparty/spdlog/sinks/ansicolor_sink-inl.h b/primedev/thirdparty/spdlog/sinks/ansicolor_sink-inl.h similarity index 100% rename from thirdparty/spdlog/sinks/ansicolor_sink-inl.h rename to primedev/thirdparty/spdlog/sinks/ansicolor_sink-inl.h diff --git a/thirdparty/spdlog/sinks/ansicolor_sink.h b/primedev/thirdparty/spdlog/sinks/ansicolor_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/ansicolor_sink.h rename to primedev/thirdparty/spdlog/sinks/ansicolor_sink.h diff --git a/thirdparty/spdlog/sinks/base_sink-inl.h b/primedev/thirdparty/spdlog/sinks/base_sink-inl.h similarity index 100% rename from thirdparty/spdlog/sinks/base_sink-inl.h rename to primedev/thirdparty/spdlog/sinks/base_sink-inl.h diff --git a/thirdparty/spdlog/sinks/base_sink.h b/primedev/thirdparty/spdlog/sinks/base_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/base_sink.h rename to primedev/thirdparty/spdlog/sinks/base_sink.h diff --git a/thirdparty/spdlog/sinks/basic_file_sink-inl.h b/primedev/thirdparty/spdlog/sinks/basic_file_sink-inl.h similarity index 100% rename from thirdparty/spdlog/sinks/basic_file_sink-inl.h rename to primedev/thirdparty/spdlog/sinks/basic_file_sink-inl.h diff --git a/thirdparty/spdlog/sinks/basic_file_sink.h b/primedev/thirdparty/spdlog/sinks/basic_file_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/basic_file_sink.h rename to primedev/thirdparty/spdlog/sinks/basic_file_sink.h diff --git a/thirdparty/spdlog/sinks/daily_file_sink.h b/primedev/thirdparty/spdlog/sinks/daily_file_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/daily_file_sink.h rename to primedev/thirdparty/spdlog/sinks/daily_file_sink.h diff --git a/thirdparty/spdlog/sinks/dist_sink.h b/primedev/thirdparty/spdlog/sinks/dist_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/dist_sink.h rename to primedev/thirdparty/spdlog/sinks/dist_sink.h diff --git a/thirdparty/spdlog/sinks/dup_filter_sink.h b/primedev/thirdparty/spdlog/sinks/dup_filter_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/dup_filter_sink.h rename to primedev/thirdparty/spdlog/sinks/dup_filter_sink.h diff --git a/thirdparty/spdlog/sinks/hourly_file_sink.h b/primedev/thirdparty/spdlog/sinks/hourly_file_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/hourly_file_sink.h rename to primedev/thirdparty/spdlog/sinks/hourly_file_sink.h diff --git a/thirdparty/spdlog/sinks/msvc_sink.h b/primedev/thirdparty/spdlog/sinks/msvc_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/msvc_sink.h rename to primedev/thirdparty/spdlog/sinks/msvc_sink.h diff --git a/thirdparty/spdlog/sinks/null_sink.h b/primedev/thirdparty/spdlog/sinks/null_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/null_sink.h rename to primedev/thirdparty/spdlog/sinks/null_sink.h diff --git a/thirdparty/spdlog/sinks/ostream_sink.h b/primedev/thirdparty/spdlog/sinks/ostream_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/ostream_sink.h rename to primedev/thirdparty/spdlog/sinks/ostream_sink.h diff --git a/thirdparty/spdlog/sinks/ringbuffer_sink.h b/primedev/thirdparty/spdlog/sinks/ringbuffer_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/ringbuffer_sink.h rename to primedev/thirdparty/spdlog/sinks/ringbuffer_sink.h diff --git a/thirdparty/spdlog/sinks/rotating_file_sink-inl.h b/primedev/thirdparty/spdlog/sinks/rotating_file_sink-inl.h similarity index 100% rename from thirdparty/spdlog/sinks/rotating_file_sink-inl.h rename to primedev/thirdparty/spdlog/sinks/rotating_file_sink-inl.h diff --git a/thirdparty/spdlog/sinks/rotating_file_sink.h b/primedev/thirdparty/spdlog/sinks/rotating_file_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/rotating_file_sink.h rename to primedev/thirdparty/spdlog/sinks/rotating_file_sink.h diff --git a/thirdparty/spdlog/sinks/sink-inl.h b/primedev/thirdparty/spdlog/sinks/sink-inl.h similarity index 100% rename from thirdparty/spdlog/sinks/sink-inl.h rename to primedev/thirdparty/spdlog/sinks/sink-inl.h diff --git a/thirdparty/spdlog/sinks/sink.h b/primedev/thirdparty/spdlog/sinks/sink.h similarity index 100% rename from thirdparty/spdlog/sinks/sink.h rename to primedev/thirdparty/spdlog/sinks/sink.h diff --git a/thirdparty/spdlog/sinks/stdout_color_sinks-inl.h b/primedev/thirdparty/spdlog/sinks/stdout_color_sinks-inl.h similarity index 100% rename from thirdparty/spdlog/sinks/stdout_color_sinks-inl.h rename to primedev/thirdparty/spdlog/sinks/stdout_color_sinks-inl.h diff --git a/thirdparty/spdlog/sinks/stdout_color_sinks.h b/primedev/thirdparty/spdlog/sinks/stdout_color_sinks.h similarity index 100% rename from thirdparty/spdlog/sinks/stdout_color_sinks.h rename to primedev/thirdparty/spdlog/sinks/stdout_color_sinks.h diff --git a/thirdparty/spdlog/sinks/stdout_sinks-inl.h b/primedev/thirdparty/spdlog/sinks/stdout_sinks-inl.h similarity index 100% rename from thirdparty/spdlog/sinks/stdout_sinks-inl.h rename to primedev/thirdparty/spdlog/sinks/stdout_sinks-inl.h diff --git a/thirdparty/spdlog/sinks/stdout_sinks.h b/primedev/thirdparty/spdlog/sinks/stdout_sinks.h similarity index 100% rename from thirdparty/spdlog/sinks/stdout_sinks.h rename to primedev/thirdparty/spdlog/sinks/stdout_sinks.h diff --git a/thirdparty/spdlog/sinks/syslog_sink.h b/primedev/thirdparty/spdlog/sinks/syslog_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/syslog_sink.h rename to primedev/thirdparty/spdlog/sinks/syslog_sink.h diff --git a/thirdparty/spdlog/sinks/systemd_sink.h b/primedev/thirdparty/spdlog/sinks/systemd_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/systemd_sink.h rename to primedev/thirdparty/spdlog/sinks/systemd_sink.h diff --git a/thirdparty/spdlog/sinks/tcp_sink.h b/primedev/thirdparty/spdlog/sinks/tcp_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/tcp_sink.h rename to primedev/thirdparty/spdlog/sinks/tcp_sink.h diff --git a/thirdparty/spdlog/sinks/win_eventlog_sink.h b/primedev/thirdparty/spdlog/sinks/win_eventlog_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/win_eventlog_sink.h rename to primedev/thirdparty/spdlog/sinks/win_eventlog_sink.h diff --git a/thirdparty/spdlog/sinks/wincolor_sink-inl.h b/primedev/thirdparty/spdlog/sinks/wincolor_sink-inl.h similarity index 100% rename from thirdparty/spdlog/sinks/wincolor_sink-inl.h rename to primedev/thirdparty/spdlog/sinks/wincolor_sink-inl.h diff --git a/thirdparty/spdlog/sinks/wincolor_sink.h b/primedev/thirdparty/spdlog/sinks/wincolor_sink.h similarity index 100% rename from thirdparty/spdlog/sinks/wincolor_sink.h rename to primedev/thirdparty/spdlog/sinks/wincolor_sink.h diff --git a/thirdparty/spdlog/spdlog-inl.h b/primedev/thirdparty/spdlog/spdlog-inl.h similarity index 100% rename from thirdparty/spdlog/spdlog-inl.h rename to primedev/thirdparty/spdlog/spdlog-inl.h diff --git a/thirdparty/spdlog/spdlog.h b/primedev/thirdparty/spdlog/spdlog.h similarity index 100% rename from thirdparty/spdlog/spdlog.h rename to primedev/thirdparty/spdlog/spdlog.h diff --git a/thirdparty/spdlog/stopwatch.h b/primedev/thirdparty/spdlog/stopwatch.h similarity index 100% rename from thirdparty/spdlog/stopwatch.h rename to primedev/thirdparty/spdlog/stopwatch.h diff --git a/thirdparty/spdlog/tweakme.h b/primedev/thirdparty/spdlog/tweakme.h similarity index 100% rename from thirdparty/spdlog/tweakme.h rename to primedev/thirdparty/spdlog/tweakme.h diff --git a/thirdparty/spdlog/version.h b/primedev/thirdparty/spdlog/version.h similarity index 100% rename from thirdparty/spdlog/version.h rename to primedev/thirdparty/spdlog/version.h diff --git a/NorthstarDLL/util/printcommands.cpp b/primedev/util/printcommands.cpp similarity index 100% rename from NorthstarDLL/util/printcommands.cpp rename to primedev/util/printcommands.cpp diff --git a/NorthstarDLL/util/printcommands.h b/primedev/util/printcommands.h similarity index 100% rename from NorthstarDLL/util/printcommands.h rename to primedev/util/printcommands.h diff --git a/NorthstarDLL/util/printmaps.cpp b/primedev/util/printmaps.cpp similarity index 100% rename from NorthstarDLL/util/printmaps.cpp rename to primedev/util/printmaps.cpp diff --git a/NorthstarDLL/util/printmaps.h b/primedev/util/printmaps.h similarity index 100% rename from NorthstarDLL/util/printmaps.h rename to primedev/util/printmaps.h diff --git a/NorthstarDLL/util/utils.cpp b/primedev/util/utils.cpp similarity index 100% rename from NorthstarDLL/util/utils.cpp rename to primedev/util/utils.cpp diff --git a/NorthstarDLL/util/utils.h b/primedev/util/utils.h similarity index 100% rename from NorthstarDLL/util/utils.h rename to primedev/util/utils.h diff --git a/NorthstarDLL/util/version.cpp b/primedev/util/version.cpp similarity index 100% rename from NorthstarDLL/util/version.cpp rename to primedev/util/version.cpp diff --git a/NorthstarDLL/util/version.h b/primedev/util/version.h similarity index 100% rename from NorthstarDLL/util/version.h rename to primedev/util/version.h diff --git a/NorthstarDLL/util/wininfo.cpp b/primedev/util/wininfo.cpp similarity index 100% rename from NorthstarDLL/util/wininfo.cpp rename to primedev/util/wininfo.cpp diff --git a/NorthstarDLL/util/wininfo.h b/primedev/util/wininfo.h similarity index 100% rename from NorthstarDLL/util/wininfo.h rename to primedev/util/wininfo.h diff --git a/loader_wsock32_proxy/dllmain.cpp b/primedev/wsockproxy/dllmain.cpp similarity index 100% rename from loader_wsock32_proxy/dllmain.cpp rename to primedev/wsockproxy/dllmain.cpp diff --git a/loader_wsock32_proxy/loader.cpp b/primedev/wsockproxy/loader.cpp similarity index 100% rename from loader_wsock32_proxy/loader.cpp rename to primedev/wsockproxy/loader.cpp diff --git a/loader_wsock32_proxy/loader.h b/primedev/wsockproxy/loader.h similarity index 100% rename from loader_wsock32_proxy/loader.h rename to primedev/wsockproxy/loader.h diff --git a/loader_wsock32_proxy/pch.h b/primedev/wsockproxy/pch.h similarity index 100% rename from loader_wsock32_proxy/pch.h rename to primedev/wsockproxy/pch.h diff --git a/loader_wsock32_proxy/wsock32.asm b/primedev/wsockproxy/wsock32.asm similarity index 100% rename from loader_wsock32_proxy/wsock32.asm rename to primedev/wsockproxy/wsock32.asm diff --git a/loader_wsock32_proxy/wsock32.def b/primedev/wsockproxy/wsock32.def similarity index 100% rename from loader_wsock32_proxy/wsock32.def rename to primedev/wsockproxy/wsock32.def From a78b7d857f86318ab69031d844f34587d2d84e86 Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Sat, 30 Dec 2023 22:59:56 +0000 Subject: [PATCH 23/30] Simplify vscript stub function (#627) Since we can get stack info from the sqvm, we don't need to give the function name in the template and stuff. Cherry picked from primedev --- primedev/squirrel/squirrel.cpp | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/primedev/squirrel/squirrel.cpp b/primedev/squirrel/squirrel.cpp index ac9a2ce99..43e43398a 100644 --- a/primedev/squirrel/squirrel.cpp +++ b/primedev/squirrel/squirrel.cpp @@ -619,20 +619,12 @@ template void ConCommand_script(const CCommand& args) g_pSquirrel->ExecuteCode(args.ArgS()); } -// literal class type that wraps a constant expression string -template struct TemplateStringLiteral +template SQRESULT SQ_StubbedFunc(HSquirrelVM* sqvm) { - constexpr TemplateStringLiteral(const char (&str)[N]) - { - std::copy_n(str, N, value); - } + SQStackInfos si; + g_pSquirrel->sq_stackinfos(sqvm, 0, si); - char value[N]; -}; - -template SQRESULT SQ_StubbedFunc(HSquirrelVM* sqvm) -{ - spdlog::info("Blocking call to stubbed function {} in {}", funcName.value, GetContextName(context)); + spdlog::warn("Blocking call to stubbed function {} in {}", si._name, GetContextName(context)); return SQRESULT_NULL; } @@ -640,12 +632,12 @@ template void StubUnsafeSQFuncs() { if (!CommandLine()->CheckParm("-allowunsafesqfuncs")) { - g_pSquirrel->AddFuncOverride("DevTextBufferWrite", SQ_StubbedFunc); - g_pSquirrel->AddFuncOverride("DevTextBufferClear", SQ_StubbedFunc); - g_pSquirrel->AddFuncOverride("DevTextBufferDumpToFile", SQ_StubbedFunc); - g_pSquirrel->AddFuncOverride("Dev_CommandLineAddParam", SQ_StubbedFunc); - g_pSquirrel->AddFuncOverride("DevP4Checkout", SQ_StubbedFunc); - g_pSquirrel->AddFuncOverride("DevP4Add", SQ_StubbedFunc); + g_pSquirrel->AddFuncOverride("DevTextBufferWrite", SQ_StubbedFunc); + g_pSquirrel->AddFuncOverride("DevTextBufferClear", SQ_StubbedFunc); + g_pSquirrel->AddFuncOverride("DevTextBufferDumpToFile", SQ_StubbedFunc); + g_pSquirrel->AddFuncOverride("Dev_CommandLineAddParam", SQ_StubbedFunc); + g_pSquirrel->AddFuncOverride("DevP4Checkout", SQ_StubbedFunc); + g_pSquirrel->AddFuncOverride("DevP4Add", SQ_StubbedFunc); } } From 4855b5684945631c7c0ecf5d526ff5224752b038 Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Wed, 3 Jan 2024 20:39:05 +0000 Subject: [PATCH 24/30] Schedule the merge conflict labelling to run daily (#631) --- .github/workflows/merge-conflict-auto-label.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/merge-conflict-auto-label.yml b/.github/workflows/merge-conflict-auto-label.yml index e237726af..dea1f0879 100644 --- a/.github/workflows/merge-conflict-auto-label.yml +++ b/.github/workflows/merge-conflict-auto-label.yml @@ -3,6 +3,8 @@ on: push: branches: - main + schedule: + - cron: "40 20 * * *" jobs: triage: From baa706d25aa0eb0962551ae7b7978481db841c02 Mon Sep 17 00:00:00 2001 From: GeckoEidechse Date: Wed, 3 Jan 2024 21:46:43 +0100 Subject: [PATCH 25/30] Run auto-label action at a later time for testing --- .github/workflows/merge-conflict-auto-label.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/merge-conflict-auto-label.yml b/.github/workflows/merge-conflict-auto-label.yml index dea1f0879..cf5598a6e 100644 --- a/.github/workflows/merge-conflict-auto-label.yml +++ b/.github/workflows/merge-conflict-auto-label.yml @@ -4,7 +4,7 @@ on: branches: - main schedule: - - cron: "40 20 * * *" + - cron: "10 21 * * *" jobs: triage: From 36e1093620c59f8ac10bd59d4d05ec3ceffd15f7 Mon Sep 17 00:00:00 2001 From: Northstar Date: Wed, 3 Jan 2024 23:39:55 +0100 Subject: [PATCH 26/30] Format cmake files --- primedev/Launcher.cmake | 51 ++--- primedev/Northstar.cmake | 352 ++++++++++++++++--------------- primedev/WSockProxy.cmake | 78 +++---- primedev/cmake/Findlibcurl.cmake | 57 +++-- primedev/cmake/Findminhook.cmake | 7 +- primedev/cmake/Findminizip.cmake | 46 ++-- primedev/cmake/Findspdlog.cmake | 7 +- primedev/cmake/utils.cmake | 39 +++- 8 files changed, 356 insertions(+), 281 deletions(-) diff --git a/primedev/Launcher.cmake b/primedev/Launcher.cmake index 9edcf0e57..c04fc70b1 100644 --- a/primedev/Launcher.cmake +++ b/primedev/Launcher.cmake @@ -1,33 +1,28 @@ # NorthstarLauncher -add_executable(NorthstarLauncher - "primelauncher/main.cpp" - "primelauncher/resources.rc" -) +add_executable(NorthstarLauncher "primelauncher/main.cpp" "primelauncher/resources.rc") -target_compile_definitions(NorthstarLauncher PRIVATE - UNICODE - _UNICODE -) +target_compile_definitions(NorthstarLauncher PRIVATE UNICODE _UNICODE) -target_link_libraries(NorthstarLauncher PRIVATE - shlwapi.lib - kernel32.lib - user32.lib - gdi32.lib - winspool.lib - comdlg32.lib - advapi32.lib - shell32.lib - ole32.lib - oleaut32.lib - uuid.lib - odbc32.lib - odbccp32.lib - WS2_32.lib -) +target_link_libraries( + NorthstarLauncher + PRIVATE shlwapi.lib + kernel32.lib + user32.lib + gdi32.lib + winspool.lib + comdlg32.lib + advapi32.lib + shell32.lib + ole32.lib + oleaut32.lib + uuid.lib + odbc32.lib + odbccp32.lib + WS2_32.lib + ) -set_target_properties(NorthstarLauncher PROPERTIES - RUNTIME_OUTPUT_DIRECTORY ${NS_BINARY_DIR} - LINK_FLAGS "/MANIFEST:NO /DEBUG /STACK:8000000" -) +set_target_properties( + NorthstarLauncher PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${NS_BINARY_DIR} LINK_FLAGS + "/MANIFEST:NO /DEBUG /STACK:8000000" + ) diff --git a/primedev/Northstar.cmake b/primedev/Northstar.cmake index 69db3d4e0..50b6adfdb 100644 --- a/primedev/Northstar.cmake +++ b/primedev/Northstar.cmake @@ -4,179 +4,187 @@ find_package(minhook REQUIRED) find_package(libcurl REQUIRED) find_package(minizip REQUIRED) -add_library(NorthstarDLL SHARED - "resources.rc" - "client/audio.cpp" - "client/audio.h" - "client/chatcommand.cpp" - "client/clientauthhooks.cpp" - "client/clientruihooks.cpp" - "client/clientvideooverrides.cpp" - "client/debugoverlay.cpp" - "client/demofixes.cpp" - "client/diskvmtfixes.cpp" - "client/languagehooks.cpp" - "client/latencyflex.cpp" - "client/localchatwriter.cpp" - "client/localchatwriter.h" - "client/modlocalisation.cpp" - "client/r2client.cpp" - "client/r2client.h" - "client/rejectconnectionfixes.cpp" - "config/profile.cpp" - "config/profile.h" - "core/convar/concommand.cpp" - "core/convar/concommand.h" - "core/convar/convar.cpp" - "core/convar/convar.h" - "core/convar/cvar.cpp" - "core/convar/cvar.h" - "core/filesystem/filesystem.cpp" - "core/filesystem/filesystem.h" - "core/filesystem/rpakfilesystem.cpp" - "core/filesystem/rpakfilesystem.h" - "core/math/bitbuf.h" - "core/math/bits.cpp" - "core/math/bits.h" - "core/math/color.cpp" - "core/math/color.h" - "core/math/vector.h" - "core/hooks.cpp" - "core/hooks.h" - "core/macros.h" - "core/memalloc.cpp" - "core/memalloc.h" - "core/memory.cpp" - "core/memory.h" - "core/sourceinterface.cpp" - "core/sourceinterface.h" - "core/structs.h" - "core/tier0.cpp" - "core/tier0.h" - "dedicated/dedicated.cpp" - "dedicated/dedicated.h" - "dedicated/dedicatedlogtoclient.cpp" - "dedicated/dedicatedlogtoclient.h" - "dedicated/dedicatedmaterialsystem.cpp" - "engine/host.cpp" - "engine/hoststate.cpp" - "engine/hoststate.h" - "engine/r2engine.cpp" - "engine/r2engine.h" - "engine/runframe.cpp" - "logging/crashhandler.cpp" - "logging/crashhandler.h" - "logging/logging.cpp" - "logging/logging.h" - "logging/loghooks.cpp" - "logging/loghooks.h" - "logging/sourceconsole.cpp" - "logging/sourceconsole.h" - "masterserver/masterserver.cpp" - "masterserver/masterserver.h" - "mods/autodownload/moddownloader.h" - "mods/autodownload/moddownloader.cpp" - "mods/compiled/kb_act.cpp" - "mods/compiled/modkeyvalues.cpp" - "mods/compiled/modpdef.cpp" - "mods/compiled/modscriptsrson.cpp" - "mods/modmanager.cpp" - "mods/modmanager.h" - "mods/modsavefiles.cpp" - "mods/modsavefiles.h" - "plugins/plugin_abi.h" - "plugins/pluginbackend.cpp" - "plugins/pluginbackend.h" - "plugins/plugins.cpp" - "plugins/plugins.h" - "scripts/client/clientchathooks.cpp" - "scripts/client/cursorposition.cpp" - "scripts/client/scriptbrowserhooks.cpp" - "scripts/client/scriptmainmenupromos.cpp" - "scripts/client/scriptmodmenu.cpp" - "scripts/client/scriptoriginauth.cpp" - "scripts/client/scriptserverbrowser.cpp" - "scripts/client/scriptservertoclientstringcommand.cpp" - "scripts/server/miscserverfixes.cpp" - "scripts/server/miscserverscript.cpp" - "scripts/server/scriptuserinfo.cpp" - "scripts/scriptdatatables.cpp" - "scripts/scripthttprequesthandler.cpp" - "scripts/scripthttprequesthandler.h" - "scripts/scriptjson.cpp" - "scripts/scriptjson.h" - "scripts/scriptutility.cpp" - "server/auth/bansystem.cpp" - "server/auth/bansystem.h" - "server/auth/serverauthentication.cpp" - "server/auth/serverauthentication.h" - "server/alltalk.cpp" - "server/buildainfile.cpp" - "server/r2server.cpp" - "server/r2server.h" - "server/serverchathooks.cpp" - "server/serverchathooks.h" - "server/servernethooks.cpp" - "server/serverpresence.cpp" - "server/serverpresence.h" - "shared/exploit_fixes/exploitfixes.cpp" - "shared/exploit_fixes/exploitfixes_lzss.cpp" - "shared/exploit_fixes/exploitfixes_utf8parser.cpp" - "shared/exploit_fixes/ns_limits.cpp" - "shared/exploit_fixes/ns_limits.h" - "shared/keyvalues.cpp" - "shared/keyvalues.h" - "shared/maxplayers.cpp" - "shared/maxplayers.h" - "shared/misccommands.cpp" - "shared/misccommands.h" - "shared/playlist.cpp" - "shared/playlist.h" - "squirrel/squirrel.cpp" - "squirrel/squirrel.h" - "squirrel/squirrelautobind.cpp" - "squirrel/squirrelautobind.h" - "squirrel/squirrelclasstypes.h" - "squirrel/squirreldatatypes.h" - "util/printcommands.cpp" - "util/printcommands.h" - "util/printmaps.cpp" - "util/printmaps.h" - "util/utils.cpp" - "util/utils.h" - "util/version.cpp" - "util/version.h" - "util/wininfo.cpp" - "util/wininfo.h" - "dllmain.cpp" - "dllmain.h" - "ns_version.h" -) +add_library( + NorthstarDLL SHARED + "resources.rc" + "client/audio.cpp" + "client/audio.h" + "client/chatcommand.cpp" + "client/clientauthhooks.cpp" + "client/clientruihooks.cpp" + "client/clientvideooverrides.cpp" + "client/debugoverlay.cpp" + "client/demofixes.cpp" + "client/diskvmtfixes.cpp" + "client/languagehooks.cpp" + "client/latencyflex.cpp" + "client/localchatwriter.cpp" + "client/localchatwriter.h" + "client/modlocalisation.cpp" + "client/r2client.cpp" + "client/r2client.h" + "client/rejectconnectionfixes.cpp" + "config/profile.cpp" + "config/profile.h" + "core/convar/concommand.cpp" + "core/convar/concommand.h" + "core/convar/convar.cpp" + "core/convar/convar.h" + "core/convar/cvar.cpp" + "core/convar/cvar.h" + "core/filesystem/filesystem.cpp" + "core/filesystem/filesystem.h" + "core/filesystem/rpakfilesystem.cpp" + "core/filesystem/rpakfilesystem.h" + "core/math/bitbuf.h" + "core/math/bits.cpp" + "core/math/bits.h" + "core/math/color.cpp" + "core/math/color.h" + "core/math/vector.h" + "core/hooks.cpp" + "core/hooks.h" + "core/macros.h" + "core/memalloc.cpp" + "core/memalloc.h" + "core/memory.cpp" + "core/memory.h" + "core/sourceinterface.cpp" + "core/sourceinterface.h" + "core/structs.h" + "core/tier0.cpp" + "core/tier0.h" + "dedicated/dedicated.cpp" + "dedicated/dedicated.h" + "dedicated/dedicatedlogtoclient.cpp" + "dedicated/dedicatedlogtoclient.h" + "dedicated/dedicatedmaterialsystem.cpp" + "engine/host.cpp" + "engine/hoststate.cpp" + "engine/hoststate.h" + "engine/r2engine.cpp" + "engine/r2engine.h" + "engine/runframe.cpp" + "logging/crashhandler.cpp" + "logging/crashhandler.h" + "logging/logging.cpp" + "logging/logging.h" + "logging/loghooks.cpp" + "logging/loghooks.h" + "logging/sourceconsole.cpp" + "logging/sourceconsole.h" + "masterserver/masterserver.cpp" + "masterserver/masterserver.h" + "mods/autodownload/moddownloader.h" + "mods/autodownload/moddownloader.cpp" + "mods/compiled/kb_act.cpp" + "mods/compiled/modkeyvalues.cpp" + "mods/compiled/modpdef.cpp" + "mods/compiled/modscriptsrson.cpp" + "mods/modmanager.cpp" + "mods/modmanager.h" + "mods/modsavefiles.cpp" + "mods/modsavefiles.h" + "plugins/plugin_abi.h" + "plugins/pluginbackend.cpp" + "plugins/pluginbackend.h" + "plugins/plugins.cpp" + "plugins/plugins.h" + "scripts/client/clientchathooks.cpp" + "scripts/client/cursorposition.cpp" + "scripts/client/scriptbrowserhooks.cpp" + "scripts/client/scriptmainmenupromos.cpp" + "scripts/client/scriptmodmenu.cpp" + "scripts/client/scriptoriginauth.cpp" + "scripts/client/scriptserverbrowser.cpp" + "scripts/client/scriptservertoclientstringcommand.cpp" + "scripts/server/miscserverfixes.cpp" + "scripts/server/miscserverscript.cpp" + "scripts/server/scriptuserinfo.cpp" + "scripts/scriptdatatables.cpp" + "scripts/scripthttprequesthandler.cpp" + "scripts/scripthttprequesthandler.h" + "scripts/scriptjson.cpp" + "scripts/scriptjson.h" + "scripts/scriptutility.cpp" + "server/auth/bansystem.cpp" + "server/auth/bansystem.h" + "server/auth/serverauthentication.cpp" + "server/auth/serverauthentication.h" + "server/alltalk.cpp" + "server/buildainfile.cpp" + "server/r2server.cpp" + "server/r2server.h" + "server/serverchathooks.cpp" + "server/serverchathooks.h" + "server/servernethooks.cpp" + "server/serverpresence.cpp" + "server/serverpresence.h" + "shared/exploit_fixes/exploitfixes.cpp" + "shared/exploit_fixes/exploitfixes_lzss.cpp" + "shared/exploit_fixes/exploitfixes_utf8parser.cpp" + "shared/exploit_fixes/ns_limits.cpp" + "shared/exploit_fixes/ns_limits.h" + "shared/keyvalues.cpp" + "shared/keyvalues.h" + "shared/maxplayers.cpp" + "shared/maxplayers.h" + "shared/misccommands.cpp" + "shared/misccommands.h" + "shared/playlist.cpp" + "shared/playlist.h" + "squirrel/squirrel.cpp" + "squirrel/squirrel.h" + "squirrel/squirrelautobind.cpp" + "squirrel/squirrelautobind.h" + "squirrel/squirrelclasstypes.h" + "squirrel/squirreldatatypes.h" + "util/printcommands.cpp" + "util/printcommands.h" + "util/printmaps.cpp" + "util/printmaps.h" + "util/utils.cpp" + "util/utils.h" + "util/version.cpp" + "util/version.h" + "util/wininfo.cpp" + "util/wininfo.h" + "dllmain.cpp" + "dllmain.h" + "ns_version.h" + ) -target_link_libraries(NorthstarDLL PRIVATE - minhook - libcurl - minizip - WS2_32.lib - Crypt32.lib - Cryptui.lib - dbghelp.lib - Wldap32.lib - Normaliz.lib - Bcrypt.lib - version.lib -) +target_link_libraries( + NorthstarDLL + PRIVATE minhook + libcurl + minizip + WS2_32.lib + Crypt32.lib + Cryptui.lib + dbghelp.lib + Wldap32.lib + Normaliz.lib + Bcrypt.lib + version.lib + ) -target_precompile_headers(NorthstarDLL PRIVATE pch.h) +target_precompile_headers( + NorthstarDLL + PRIVATE + pch.h + ) -target_compile_definitions(NorthstarDLL PRIVATE - UNICODE - _UNICODE - CURL_STATICLIB -) +target_compile_definitions( + NorthstarDLL + PRIVATE UNICODE + _UNICODE + CURL_STATICLIB + ) -set_target_properties(NorthstarDLL PROPERTIES - RUNTIME_OUTPUT_DIRECTORY ${NS_BINARY_DIR} - OUTPUT_NAME Northstar - LINK_FLAGS "/MANIFEST:NO /DEBUG" -) +set_target_properties( + NorthstarDLL + PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${NS_BINARY_DIR} + OUTPUT_NAME Northstar + LINK_FLAGS "/MANIFEST:NO /DEBUG" + ) diff --git a/primedev/WSockProxy.cmake b/primedev/WSockProxy.cmake index 84338bc79..017e358a1 100644 --- a/primedev/WSockProxy.cmake +++ b/primedev/WSockProxy.cmake @@ -2,44 +2,48 @@ find_package(minhook REQUIRED) -add_library(loader_wsock32_proxy SHARED - "wsockproxy/dllmain.cpp" - "wsockproxy/loader.cpp" - "wsockproxy/loader.h" - "wsockproxy/wsock32.asm" - "wsockproxy/wsock32.def" -) +add_library( + loader_wsock32_proxy SHARED + "wsockproxy/dllmain.cpp" + "wsockproxy/loader.cpp" + "wsockproxy/loader.h" + "wsockproxy/wsock32.asm" + "wsockproxy/wsock32.def" + ) -target_link_libraries(loader_wsock32_proxy PRIVATE - minhook - mswsock.lib - ws2_32.lib - ShLwApi.lib - imagehlp.lib - dbghelp.lib - kernel32.lib - user32.lib - gdi32.lib - winspool.lib - comdlg32.lib - advapi32.lib - shell32.lib - ole32.lib - oleaut32.lib - uuid.lib - odbc32.lib - odbccp32.lib -) +target_link_libraries( + loader_wsock32_proxy + PRIVATE minhook + mswsock.lib + ws2_32.lib + ShLwApi.lib + imagehlp.lib + dbghelp.lib + kernel32.lib + user32.lib + gdi32.lib + winspool.lib + comdlg32.lib + advapi32.lib + shell32.lib + ole32.lib + oleaut32.lib + uuid.lib + odbc32.lib + odbccp32.lib + ) -target_precompile_headers(loader_wsock32_proxy PRIVATE wsockproxy/pch.h) +target_precompile_headers( + loader_wsock32_proxy + PRIVATE + wsockproxy/pch.h + ) -target_compile_definitions(loader_wsock32_proxy PRIVATE - UNICODE - _UNICODE -) +target_compile_definitions(loader_wsock32_proxy PRIVATE UNICODE _UNICODE) -set_target_properties(loader_wsock32_proxy PROPERTIES - RUNTIME_OUTPUT_DIRECTORY ${NS_BINARY_DIR}/bin/x64_retail - OUTPUT_NAME wsock32 - LINK_FLAGS "/MANIFEST:NO /DEBUG" -) +set_target_properties( + loader_wsock32_proxy + PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${NS_BINARY_DIR}/bin/x64_retail + OUTPUT_NAME wsock32 + LINK_FLAGS "/MANIFEST:NO /DEBUG" + ) diff --git a/primedev/cmake/Findlibcurl.cmake b/primedev/cmake/Findlibcurl.cmake index 6e158b95e..3f059665d 100644 --- a/primedev/cmake/Findlibcurl.cmake +++ b/primedev/cmake/Findlibcurl.cmake @@ -1,18 +1,47 @@ +if(NOT libcurl_FOUND) + check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/libcurl) -if (NOT libcurl_FOUND) - check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/libcurl) + set(BUILD_SHARED_LIBS + OFF + CACHE BOOL "Build shared libraries" + ) + set(BUILD_CURL_EXE + OFF + CACHE BOOL "Build curl EXE" + ) + set(HTTP_ONLY + ON + CACHE BOOL "Only build HTTP and HTTPS" + ) + set(CURL_ENABLE_SSL + ON + CACHE BOOL "Enable SSL support" + ) + set(CURL_USE_OPENSSL + OFF + CACHE BOOL "Disable OpenSSL" + ) + set(CURL_USE_LIBSSH2 + OFF + CACHE BOOL "Disable libSSH2" + ) + set(CURL_USE_SCHANNEL + ON + CACHE BOOL "Enable Secure Channel" + ) + set(CURL_CA_BUNDLE + "none" + CACHE STRING "Disable CA Bundle" + ) + set(CURL_CA_PATH + "none" + CACHE STRING "Disable CA Path" + ) - set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries") - set(BUILD_CURL_EXE OFF CACHE BOOL "Build curl EXE") - set(HTTP_ONLY ON CACHE BOOL "Only build HTTP and HTTPS") - set(CURL_ENABLE_SSL ON CACHE BOOL "Enable SSL support") - set(CURL_USE_OPENSSL OFF CACHE BOOL "Disable OpenSSL") - set(CURL_USE_LIBSSH2 OFF CACHE BOOL "Disable libSSH2") - set(CURL_USE_SCHANNEL ON CACHE BOOL "Enable Secure Channel") - set(CURL_CA_BUNDLE "none" CACHE STRING "Disable CA Bundle") - set(CURL_CA_PATH "none" CACHE STRING "Disable CA Path") - - add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/libcurl libcurl) - set(libcurl_FOUND 1 PARENT_SCOPE) + add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/libcurl libcurl) + set(libcurl_FOUND + 1 + PARENT_SCOPE + ) endif() diff --git a/primedev/cmake/Findminhook.cmake b/primedev/cmake/Findminhook.cmake index aaf66c92d..155232a0e 100644 --- a/primedev/cmake/Findminhook.cmake +++ b/primedev/cmake/Findminhook.cmake @@ -1,7 +1,6 @@ - if(NOT minhook_FOUND) - check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/minhook) + check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/minhook) - add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/minhook minhook) - set(minhook_FOUND 1) + add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/minhook minhook) + set(minhook_FOUND 1) endif() diff --git a/primedev/cmake/Findminizip.cmake b/primedev/cmake/Findminizip.cmake index ab48656a9..a6d0f9142 100644 --- a/primedev/cmake/Findminizip.cmake +++ b/primedev/cmake/Findminizip.cmake @@ -1,16 +1,38 @@ - if(NOT minizip_FOUND) - check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/minizip) + check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/minizip) - set(MZ_ZLIB ON CACHE BOOL "Enable ZLIB compression, needed for DEFLATE") - set(MZ_BZIP2 OFF CACHE BOOL "Disable BZIP2 compression") - set(MZ_LZMA OFF CACHE BOOL "Disable LZMA & XZ compression") - set(MZ_PKCRYPT OFF CACHE BOOL "Disable PKWARE traditional encryption") - set(MZ_WZAES OFF CACHE BOOL "Disable WinZIP AES encryption") - set(MZ_ZSTD OFF CACHE BOOL "Disable ZSTD compression") - set(MZ_SIGNING OFF CACHE BOOL "Disable zip signing support") + set(MZ_ZLIB + ON + CACHE BOOL "Enable ZLIB compression, needed for DEFLATE" + ) + set(MZ_BZIP2 + OFF + CACHE BOOL "Disable BZIP2 compression" + ) + set(MZ_LZMA + OFF + CACHE BOOL "Disable LZMA & XZ compression" + ) + set(MZ_PKCRYPT + OFF + CACHE BOOL "Disable PKWARE traditional encryption" + ) + set(MZ_WZAES + OFF + CACHE BOOL "Disable WinZIP AES encryption" + ) + set(MZ_ZSTD + OFF + CACHE BOOL "Disable ZSTD compression" + ) + set(MZ_SIGNING + OFF + CACHE BOOL "Disable zip signing support" + ) - add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/minizip minizip) - set(minizip_FOUND 1 PARENT_SCOPE) + add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/minizip minizip) + set(minizip_FOUND + 1 + PARENT_SCOPE + ) endif() - diff --git a/primedev/cmake/Findspdlog.cmake b/primedev/cmake/Findspdlog.cmake index 81596762a..660e19506 100644 --- a/primedev/cmake/Findspdlog.cmake +++ b/primedev/cmake/Findspdlog.cmake @@ -1,7 +1,6 @@ - if(NOT spdlog_FOUND) - check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/spdlog) + check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/spdlog) - add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/spdlog spdlog) - set(spdlog_FOUND 1) + add_subdirectory(${PROJECT_SOURCE_DIR}/primedev/thirdparty/spdlog spdlog) + set(spdlog_FOUND 1) endif() diff --git a/primedev/cmake/utils.cmake b/primedev/cmake/utils.cmake index d84505514..80a2288d2 100644 --- a/primedev/cmake/utils.cmake +++ b/primedev/cmake/utils.cmake @@ -1,24 +1,43 @@ - # Check if a dependency exist before trying to init git submodules function(check_init_submodule path) - file(GLOB DIR_CONTENT "${path}/*") - list(LENGTH DIR_CONTENT CONTENT_COUNT) - if (CONTENT_COUNT EQUAL 0) - if (NOT EXISTS "${PROJECT_SOURCE_DIR}/.git") + file( + GLOB + DIR_CONTENT + "${path}/*" + ) + list( + LENGTH + DIR_CONTENT + CONTENT_COUNT + ) + if(CONTENT_COUNT + EQUAL + 0 + ) + if(NOT + EXISTS + "${PROJECT_SOURCE_DIR}/.git" + ) message(FATAL_ERROR "Failed to find third party dependency in '${path}'") endif() find_package(Git QUIET) - if (NOT Git_FOUND) + if(NOT Git_FOUND) message(FATAL_ERROR "Failed to find Git, third party dependency could not be setup at `${path}") endif() message(STATUS "Setting up dependencies as git submodules") - execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - RESULT_VARIABLE GIT_SUBMOD_RESULT) + execute_process( + COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT + ) - if(NOT GIT_SUBMOD_RESULT EQUAL "0") + if(NOT + GIT_SUBMOD_RESULT + EQUAL + "0" + ) message(FATAL_ERROR "Initializing Git submodules failed with ${GIT_SUBMOD_RESULT}") endif() endif() From 1220958ab8333d22605b2dccdd4a81ee278fa22b Mon Sep 17 00:00:00 2001 From: Northstar Date: Wed, 3 Jan 2024 23:54:41 +0100 Subject: [PATCH 27/30] Format cmake files --- CMakeLists.txt | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bea0ce89..ab461ae29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,18 @@ cmake_minimum_required(VERSION 3.15) -project(Northstar CXX ASM_MASM) +project( + Northstar + CXX + ASM_MASM + ) if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release" CACHE STRING - "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) + set(CMAKE_BUILD_TYPE + "Release" + CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE + ) endif() # Language specs @@ -15,16 +23,18 @@ set(CMAKE_VS_PLATFORM_TOOLSET v143) # This determines the real binary root directory set(NS_BINARY_DIR ${CMAKE_BINARY_DIR}/game) -# NOTE [Fifty]: Visual studio deems Build root with the value "${projectDir}" -# in CMakeSettings.json as invalid and defaults to using a temporary dir -# somewhere in %USER%/CMakeBuilds. To combat this we set it to "${projectDir}/build" -# and then link binaries in ${CMAKE_BINARY_DIR}/game. This means you can copy your -# game into ${CMAKE_BINARY_DIR}/game without it being cluttered up by cmake files. +# NOTE [Fifty]: Visual studio deems Build root with the value "${projectDir}" in CMakeSettings.json as invalid and +# defaults to using a temporary dir somewhere in %USER%/CMakeBuilds. To combat this we set it to "${projectDir}/build" +# and then link binaries in ${CMAKE_BINARY_DIR}/game. This means you can copy your game into ${CMAKE_BINARY_DIR}/game +# without it being cluttered up by cmake files. message(STATUS "NS: Building to ${NS_BINARY_DIR}") - -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/primedev/cmake") +list( + APPEND + CMAKE_MODULE_PATH + "${CMAKE_CURRENT_SOURCE_DIR}/primedev/cmake" + ) include(utils) include_directories(primedev) From a59c64becdbd83766fa91ecfdf90295353e8d742 Mon Sep 17 00:00:00 2001 From: Northstar Date: Thu, 4 Jan 2024 00:01:43 +0100 Subject: [PATCH 28/30] Format cmake files --- primedev/cmake/Findlibcurl.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/primedev/cmake/Findlibcurl.cmake b/primedev/cmake/Findlibcurl.cmake index 3f059665d..7843aae37 100644 --- a/primedev/cmake/Findlibcurl.cmake +++ b/primedev/cmake/Findlibcurl.cmake @@ -1,4 +1,3 @@ - if(NOT libcurl_FOUND) check_init_submodule(${PROJECT_SOURCE_DIR}/primedev/thirdparty/libcurl) From eda88bd1707aa1f736cec41b61ed73aa15585271 Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:10:06 +0000 Subject: [PATCH 29/30] Add cmake format check to CI (#630) --- .cmake-format.json | 26 ++++++++++++++++++++++++++ .github/workflows/ci.yml | 10 ++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .cmake-format.json diff --git a/.cmake-format.json b/.cmake-format.json new file mode 100644 index 000000000..b819f8cd8 --- /dev/null +++ b/.cmake-format.json @@ -0,0 +1,26 @@ +{ + "format": { + "line_width": 120, + "tab_size": 4, + "use_tabchars": false, + "fractional_tab_policy": "use-space", + "max_subgroups_hwrap": 2, + "max_pargs_hwrap": 2, + "max_rows_cmdline": 2, + "separate_ctrl_name_with_space": false, + "separate_fn_name_with_space": false, + "dangle_parens": true, + "dangle_align": "child", + "min_prefix_chars": 4, + "max_prefix_chars": 10, + "max_lines_hwrap": 2, + "line_ending": "unix", + "command_case": "canonical", + "keyword_case": "unchanged", + "always_wrap": [], + "enable_sort": true, + "autosort": false, + "require_valid_layout": false, + "layout_passes": {} + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e0f28f59..e6048a57d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,3 +48,13 @@ jobs: extensions: 'h,cpp' clangFormatVersion: 16 style: file + + format-check-cmake-files: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: puneetmatharu/cmake-format-lint-action@v1.0.4 + with: + args: "--in-place" + - run: | + git diff --exit-code From dcf6e1b1fd93d3afa7e0c5869c16d9760a3b4ece Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:32:20 +0000 Subject: [PATCH 30/30] Use .def for function exports (#625) Cherry-picked from primedev Co-authored-by: F1F7Y --- primedev/Northstar.cmake | 2 +- primedev/Northstar.def | 4 ++++ primedev/dllmain.cpp | 1 - primedev/dllmain.h | 3 --- 4 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 primedev/Northstar.def delete mode 100644 primedev/dllmain.h diff --git a/primedev/Northstar.cmake b/primedev/Northstar.cmake index 50b6adfdb..433326c2b 100644 --- a/primedev/Northstar.cmake +++ b/primedev/Northstar.cmake @@ -150,8 +150,8 @@ add_library( "util/wininfo.cpp" "util/wininfo.h" "dllmain.cpp" - "dllmain.h" "ns_version.h" + "Northstar.def" ) target_link_libraries( diff --git a/primedev/Northstar.def b/primedev/Northstar.def new file mode 100644 index 000000000..4e3c53182 --- /dev/null +++ b/primedev/Northstar.def @@ -0,0 +1,4 @@ +LIBRARY dedicated + +EXPORTS + InitialiseNorthstar @1 diff --git a/primedev/dllmain.cpp b/primedev/dllmain.cpp index 3d9bdc974..a656dac7a 100644 --- a/primedev/dllmain.cpp +++ b/primedev/dllmain.cpp @@ -1,4 +1,3 @@ -#include "dllmain.h" #include "logging/logging.h" #include "logging/crashhandler.h" #include "core/memalloc.h" diff --git a/primedev/dllmain.h b/primedev/dllmain.h deleted file mode 100644 index 0debf379c..000000000 --- a/primedev/dllmain.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -extern "C" __declspec(dllexport) bool InitialiseNorthstar();