From 6b46d5a0617ce2c87aa1428bcd25c304f94a2749 Mon Sep 17 00:00:00 2001 From: p0358 Date: Sun, 2 Jan 2022 08:16:44 +0100 Subject: restore ShouldLoadNorthstar() to wsock32 proxy as well --- loader_wsock32_proxy/loader.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'loader_wsock32_proxy') diff --git a/loader_wsock32_proxy/loader.cpp b/loader_wsock32_proxy/loader.cpp index 19a448b2..49096bb0 100644 --- a/loader_wsock32_proxy/loader.cpp +++ b/loader_wsock32_proxy/loader.cpp @@ -3,6 +3,8 @@ #include "../NorthstarDedicatedTest/hookutils.h" #include #include +#include +#include void LibraryLoadError(DWORD dwMessageId, const wchar_t* libName, const wchar_t* location) { @@ -12,6 +14,25 @@ void LibraryLoadError(DWORD dwMessageId, const wchar_t* libName, const wchar_t* MessageBoxA(GetForegroundWindow(), text, "Northstar Wsock32 Proxy Error", 0); } +bool ShouldLoadNorthstar() +{ + bool loadNorthstar = !strstr(GetCommandLineA(), "-vanilla"); + + if (!loadNorthstar) + return loadNorthstar; + + auto runNorthstarFile = std::ifstream("run_northstar.txt"); + if (runNorthstarFile) + { + std::stringstream runNorthstarFileBuffer; + runNorthstarFileBuffer << runNorthstarFile.rdbuf(); + runNorthstarFile.close(); + if (runNorthstarFileBuffer.str()._Starts_with("0")) + loadNorthstar = false; + } + return loadNorthstar; +} + bool LoadNorthstar() { FARPROC Hook_Init = nullptr; @@ -35,7 +56,8 @@ LauncherMainType LauncherMainOriginal; int LauncherMainHook(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { - LoadNorthstar(); + if (ShouldLoadNorthstar()) + LoadNorthstar(); return LauncherMainOriginal(hInstance, hPrevInstance, lpCmdLine, nCmdShow); } -- cgit v1.2.3