From 3d4eb42b4aaf89a4f5f3e74cb50f1fa557b272ee Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Fri, 5 Nov 2021 21:22:43 +0000 Subject: small dedi changes --- NorthstarDedicatedTest/dedicated.cpp | 6 +++++- NorthstarDedicatedTest/dedicatedmaterialsystem.cpp | 5 ++++- NorthstarDedicatedTest/modmanager.cpp | 11 ++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp index b6db8583..cebcd8ad 100644 --- a/NorthstarDedicatedTest/dedicated.cpp +++ b/NorthstarDedicatedTest/dedicated.cpp @@ -59,7 +59,11 @@ void RunServer(CDedicatedExports* dedicated) g_pEngine->Frame(); // this way of getting playercount/maxplayers honestly really sucks, but not got any other methods of doing it rn - SetConsoleTitleA(fmt::format("Titanfall 2 dedicated server - {} {}/{} players", g_pHostState->m_levelName, g_ServerAuthenticationManager->m_additionalPlayerData.size(), GetCurrentPlaylistVar("max_players", false)).c_str()); + const char* maxPlayers = GetCurrentPlaylistVar("max_players", false); + if (!maxPlayers) + maxPlayers = "6"; + + SetConsoleTitleA(fmt::format("Titanfall 2 dedicated server - {} {}/{} players", g_pHostState->m_levelName, g_ServerAuthenticationManager->m_additionalPlayerData.size(), maxPlayers).c_str()); Sleep(50); } } diff --git a/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp b/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp index 327f2c1f..3c96ef22 100644 --- a/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp +++ b/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp @@ -13,6 +13,7 @@ void InitialiseDedicatedMaterialSystem(HMODULE baseAddress) // Sleep(100); // not using these for now since they're related to nopping renderthread/gamewindow i.e. very hard + // we use -noshaderapi instead now //{ // // function that launches renderthread // char* ptr = (char*)baseAddress + 0x87047; @@ -63,7 +64,7 @@ void InitialiseDedicatedMaterialSystem(HMODULE baseAddress) *(ptr + 4) = (char)0x90; } - // these don't work, they cause game to hang on rpak init, needs reworking + // these don't fully work, they cause game to hang on rpak init, needs reworking { // materialsystem rpak type: texture char* ptr = (char*)baseAddress + 0x2B3A; @@ -152,6 +153,8 @@ void* RegisterRpakTypeHook(RpakTypeDefinition* rpakStruct, unsigned int a1, unsi void InitialiseDedicatedRtechGame(HMODULE baseAddress) { + // potentially do this somewhere other than dedicated stuff if it's going to be used in non-dedi + HookEnabler hook; ENABLER_CREATEHOOK(hook, (char*)GetModuleHandleA("rtech_game.dll") + 0x7BE0, &RegisterRpakTypeHook, reinterpret_cast(&RegisterRpakType)); diff --git a/NorthstarDedicatedTest/modmanager.cpp b/NorthstarDedicatedTest/modmanager.cpp index 956ea90f..cd479408 100644 --- a/NorthstarDedicatedTest/modmanager.cpp +++ b/NorthstarDedicatedTest/modmanager.cpp @@ -12,6 +12,7 @@ #include #include #include +#include "filesystem.h" ModManager* g_ModManager; @@ -189,8 +190,6 @@ void ModManager::LoadMods() if (m_hasLoadedMods) UnloadMods(); - m_hasLoadedMods = true; - std::vector modDirs; // ensure dirs exist @@ -289,7 +288,11 @@ void ModManager::LoadMods() std::string formattedPath = file.path().filename().string(); // this really fucking sucks but it'll work - mod->Vpks.push_back((file.path().parent_path() / formattedPath.substr(strlen("english"), formattedPath.find(".bsp") - 3)).string()); + std::string vpkName = (file.path().parent_path() / formattedPath.substr(strlen("english"), formattedPath.find(".bsp") - 3)).string(); + mod->Vpks.push_back(vpkName); + + if (m_hasLoadedMods) + (*g_Filesystem)->m_vtable->MountVPK(*g_Filesystem, vpkName.c_str()); } } } @@ -332,6 +335,8 @@ void ModManager::LoadMods() } } } + + m_hasLoadedMods = true; } void ModManager::UnloadMods() -- cgit v1.2.3