diff options
author | Emma Miler <27428383+emma-miler@users.noreply.github.com> | 2022-02-28 21:27:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 17:27:54 -0300 |
commit | 62e137b32ad7c601b2db37e69b9f435a7dbc730d (patch) | |
tree | a9477685c45fda66f5247323a816d28682cf48d5 /NorthstarDedicatedTest | |
parent | e5bfd1259f8d991f85dddd509b71c3270dc43086 (diff) | |
download | NorthstarLauncher-62e137b32ad7c601b2db37e69b9f435a7dbc730d.tar.gz NorthstarLauncher-62e137b32ad7c601b2db37e69b9f435a7dbc730d.zip |
Autogenerate startup args text files (#99)
Adds `-nostartupargs`
Diffstat (limited to 'NorthstarDedicatedTest')
-rw-r--r-- | NorthstarDedicatedTest/hooks.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
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(); |