aboutsummaryrefslogtreecommitdiff
path: root/loader_wsock32_proxy/loader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'loader_wsock32_proxy/loader.cpp')
-rw-r--r--loader_wsock32_proxy/loader.cpp24
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);
}