aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LauncherInjector/main.cpp17
-rw-r--r--NorthstarDedicatedTest/hooks.cpp42
2 files changed, 40 insertions, 19 deletions
diff --git a/LauncherInjector/main.cpp b/LauncherInjector/main.cpp
index e62f83db..f262730d 100644
--- a/LauncherInjector/main.cpp
+++ b/LauncherInjector/main.cpp
@@ -312,6 +312,21 @@ int main(int argc, char* argv[])
{
PrependPath();
+ if (!fs::exists("ns_startup_args.txt"))
+ {
+ std::ofstream file("ns_startup_args.txt");
+ std::string defaultArgs = "-multiple";
+ file.write(defaultArgs.c_str(), defaultArgs.length());
+ file.close();
+ }
+ if (!fs::exists("ns_startup_args_dedi.txt"))
+ {
+ std::ofstream file("ns_startup_args_dedi.txt");
+ std::string defaultArgs = "+setplaylist private_match";
+ file.write(defaultArgs.c_str(), defaultArgs.length());
+ file.close();
+ }
+
printf("[*] Loading tier0.dll\n");
swprintf_s(buffer, L"%s\\bin\\x64_retail\\tier0.dll", exePath);
hTier0Module = LoadLibraryExW(buffer, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
@@ -351,4 +366,4 @@ int main(int argc, char* argv[])
// auto result = ((signed __int64(__fastcall*)(__int64))LauncherMain)(0i64);
return ((int(/*__fastcall*/*)(HINSTANCE, HINSTANCE, LPSTR, int))LauncherMain)(
NULL, NULL, NULL, 0); // the parameters aren't really used anyways
-} \ No newline at end of file
+}
diff --git a/NorthstarDedicatedTest/hooks.cpp b/NorthstarDedicatedTest/hooks.cpp
index 7d7f39fb..f44f1745 100644
--- a/NorthstarDedicatedTest/hooks.cpp
+++ b/NorthstarDedicatedTest/hooks.cpp
@@ -54,6 +54,7 @@ LPSTR GetCommandLineAHook()
{
cmdlineOrg = GetCommandLineAOriginal();
bool isDedi = strstr(cmdlineOrg, "-dedicated"); // well, this one has to be a real argument
+ bool ignoreStartupArgs = strstr(cmdlineOrg, "-nostartupargs");
std::string args;
std::ifstream cmdlineArgFile;
@@ -65,25 +66,30 @@ LPSTR GetCommandLineAHook()
// append those from the file
- cmdlineArgFile = std::ifstream(!isDedi ? "ns_startup_args.txt" : "ns_startup_args_dedi.txt");
-
- if (cmdlineArgFile)
+ if (!ignoreStartupArgs)
{
- std::stringstream argBuffer;
- argBuffer << cmdlineArgFile.rdbuf();
- cmdlineArgFile.close();
-
- // if some other command line option includes "-northstar" in the future then you have to refactor this check to check with both
- // either space after or ending with
- if (!isDedi && argBuffer.str().find("-northstar") != std::string::npos)
- MessageBoxA(
- NULL,
- "The \"-northstar\" command line option is NOT supposed to go into ns_startup_args.txt file!\n\nThis option is "
- "supposed to go into Origin/Steam game launch options, and then you are supposed to launch the original Titanfall2.exe "
- "rather than NorthstarLauncher.exe to make use of it.",
- "Northstar Warning", MB_ICONWARNING);
-
- args.append(argBuffer.str());
+
+ cmdlineArgFile = std::ifstream(!isDedi ? "ns_startup_args.txt" : "ns_startup_args_dedi.txt");
+
+ if (cmdlineArgFile)
+ {
+ std::stringstream argBuffer;
+ argBuffer << cmdlineArgFile.rdbuf();
+ cmdlineArgFile.close();
+
+ // if some other command line option includes "-northstar" in the future then you have to refactor this check to check with
+ // both either space after or ending with
+ if (!isDedi && argBuffer.str().find("-northstar") != std::string::npos)
+ MessageBoxA(
+ NULL,
+ "The \"-northstar\" command line option is NOT supposed to go into ns_startup_args.txt file!\n\nThis option is "
+ "supposed to go into Origin/Steam game launch options, and then you are supposed to launch the original "
+ "Titanfall2.exe "
+ "rather than NorthstarLauncher.exe to make use of it.",
+ "Northstar Warning", MB_ICONWARNING);
+
+ args.append(argBuffer.str());
+ }
}
auto len = args.length();