diff --git a/include/Options.h b/include/Options.h index 73a5c68..683a4ef 100644 --- a/include/Options.h +++ b/include/Options.h @@ -11,6 +11,8 @@ struct Options { bool no_launch = false; char **game_arguments = nullptr; int game_arguments_length = 0; + char** argv = nullptr; + int argc = 0; }; void InitOptions(int argc, char *argv[], Options &options); diff --git a/src/Options.cpp b/src/Options.cpp index 665d1ff..caa0db8 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -6,6 +6,9 @@ void InitOptions(int argc, char *argv[], Options &options) { int i = 1; + options.argc = argc; + options.argv = argv; + if (argc > 2) if (std::string(argv[1]) == "0" && std::string(argv[2]) == "0") { options.verbose = true; diff --git a/src/Startup.cpp b/src/Startup.cpp index 73394e9..6c688f6 100644 --- a/src/Startup.cpp +++ b/src/Startup.cpp @@ -97,9 +97,9 @@ std::string GetEP(char* P) { #if defined(_WIN32) void ReLaunch() { std::string Arg; - for (int c = 0; c <= options.game_arguments_length; c++) { + for (int c = 2; c <= options.argc; c++) { + Arg += options.argv[c - 1]; Arg += " "; - Arg += options.game_arguments[c - 1]; } info("Relaunch!"); system("cls"); @@ -110,9 +110,9 @@ void ReLaunch() { } void URelaunch() { std::string Arg; - for (int c = 0; c <= options.game_arguments_length; c++) { + for (int c = 2; c <= options.argc; c++) { + Arg += options.argv[c - 1]; Arg += " "; - Arg += options.game_arguments[c - 1]; } ShellExecute(nullptr, "open", (GetEP() + GetEN()).c_str(), Arg.c_str(), nullptr, SW_SHOWNORMAL); ShowWindow(GetConsoleWindow(), 0); @@ -122,9 +122,9 @@ void URelaunch() { #elif defined(__linux__) void ReLaunch() { std::string Arg; - for (int c = 0; c <= options.game_arguments_length; c++) { + for (int c = 2; c <= options.argc; c++) { + Arg += options.argv[c - 1]; Arg += " "; - Arg += options.game_arguments[c - 1]; } info("Relaunch!"); system("clear"); @@ -134,9 +134,9 @@ void ReLaunch() { } void URelaunch() { std::string Arg; - for (int c = 0; c <= options.game_arguments_length; c++) { + for (int c = 2; c <= options.argc; c++) { + Arg += options.argv[c - 1]; Arg += " "; - Arg += options.game_arguments[c - 1]; } execl((GetEP() + GetEN()).c_str(), Arg.c_str(), NULL); std::this_thread::sleep_for(std::chrono::seconds(1));