diff options
author | Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> | 2023-12-20 13:24:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-20 14:24:07 +0100 |
commit | 0438b5c8cfa99ac01c7e142d959aa40f88f1cc70 (patch) | |
tree | bbfdded20f8686cf188dba148db4b6c1b1211872 /NorthstarDLL/dedicated | |
parent | 210dab2b0e5c686829bafdc857d2910f6b216b85 (diff) | |
download | NorthstarLauncher-1.21.2-rc2.tar.gz NorthstarLauncher-1.21.2-rc2.zip |
Cherry pick "remove unnecessary namespaces" from primedev (#618)v1.21.2-rc2
Cherry-picks the removal of unnecessary namespaces from `primedev`
https://github.com/F1F7Y/NorthstarPrime/
Co-authored-by: F1F7Y <filip.bartos07@proton.me>
Diffstat (limited to 'NorthstarDLL/dedicated')
-rw-r--r-- | NorthstarDLL/dedicated/dedicated.cpp | 32 | ||||
-rw-r--r-- | NorthstarDLL/dedicated/dedicatedlogtoclient.cpp | 14 | ||||
-rw-r--r-- | NorthstarDLL/dedicated/dedicatedmaterialsystem.cpp | 2 |
3 files changed, 23 insertions, 25 deletions
diff --git a/NorthstarDLL/dedicated/dedicated.cpp b/NorthstarDLL/dedicated/dedicated.cpp index 34282f51..df6e5787 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<double, std::ratio<1>>(g_pGlobals->m_flTickInterval - fmin(Tier0::Plat_FloatTime() - frameStart, 0.25))); + std::chrono::duration<double, std::ratio<1>>(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<DedicatedServerLogToClientSink>()); // 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 a48b1b39..bf2cf77a 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<eSendPrintsToClient>(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<void (*)(R2::CBaseClient*, const char*, ...)>(); + CGameClient__ClientPrintf = module.Offset(0x1016A0).RCast<void (*)(CBaseClient*, const char*, ...)>(); } diff --git a/NorthstarDLL/dedicated/dedicatedmaterialsystem.cpp b/NorthstarDLL/dedicated/dedicatedmaterialsystem.cpp index 5bd6ea93..01078086 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( |