diff --git a/NorthstarDLL/core/hooks.cpp b/NorthstarDLL/core/hooks.cpp index 4363c0e22..0c5ed5af2 100644 --- a/NorthstarDLL/core/hooks.cpp +++ b/NorthstarDLL/core/hooks.cpp @@ -218,67 +218,6 @@ void MakeHook(LPVOID pTarget, LPVOID pDetour, void* ppOriginal, const char* pFun spdlog::error("MH_CreateHook failed for function {}", pStrippedFuncName); } -AUTOHOOK_ABSOLUTEADDR(_GetCommandLineA, (LPVOID)GetCommandLineA, LPSTR, WINAPI, ()) -{ - static char* cmdlineModified; - static char* cmdlineOrg; - - if (cmdlineOrg == nullptr || cmdlineModified == nullptr) - { - cmdlineOrg = _GetCommandLineA(); - 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; - - // it looks like CommandLine() prioritizes parameters apprearing first, so we want the real commandline to take priority - // not to mention that cmdlineOrg starts with the EXE path - args.append(cmdlineOrg); - args.append(" "); - - // append those from the file - - if (!ignoreStartupArgs) - { - - 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(); - cmdlineModified = new char[len + 1]; - if (!cmdlineModified) - { - spdlog::error("malloc failed for command line"); - return cmdlineOrg; - } - memcpy(cmdlineModified, args.c_str(), len + 1); - } - - return cmdlineModified; -} - std::vector calledTags; void CallLoadLibraryACallbacks(LPCSTR lpLibFileName, HMODULE moduleAddress) { diff --git a/NorthstarLauncher/main.cpp b/NorthstarLauncher/main.cpp index ecc18c458..e1ae180c0 100644 --- a/NorthstarLauncher/main.cpp +++ b/NorthstarLauncher/main.cpp @@ -419,19 +419,14 @@ int main(int argc, char* argv[]) { PrependPath(); - if (!fs::exists("ns_startup_args.txt")) + // NOTE [Fifty]: Functionality removed in https://github.com/R2Northstar/NorthstarLauncher/pull/517 + 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(); + std::cout << "[*] WARNING: 'ns_startup_args.txt' is no longer supported!" << std::endl; } - if (!fs::exists("ns_startup_args_dedi.txt")) + 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(); + std::cout << "[*] WARNING: 'ns_startup_args_dedi.txt' is no longer supported!" << std::endl; } std::cout << "[*] Loading tier0.dll" << std::endl;