diff options
author | p0358 <p0358@users.noreply.github.com> | 2022-01-02 08:16:44 +0100 |
---|---|---|
committer | p0358 <p0358@users.noreply.github.com> | 2022-01-02 08:16:44 +0100 |
commit | 6b46d5a0617ce2c87aa1428bcd25c304f94a2749 (patch) | |
tree | 846c2fc2c6043957c144905db13f86608b516844 /loader_wsock32_proxy/loader.cpp | |
parent | 9cb76890b310fe8872dfbe68a880c75e5eb5a7ac (diff) | |
download | NorthstarLauncher-6b46d5a0617ce2c87aa1428bcd25c304f94a2749.tar.gz NorthstarLauncher-6b46d5a0617ce2c87aa1428bcd25c304f94a2749.zip |
restore ShouldLoadNorthstar() to wsock32 proxy as well
Diffstat (limited to 'loader_wsock32_proxy/loader.cpp')
-rw-r--r-- | loader_wsock32_proxy/loader.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
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 <string> #include <system_error> +#include <sstream> +#include <fstream> 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); } |