From fb27a8c3b1c5b0142cfd5010a3020a751c8c46de Mon Sep 17 00:00:00 2001 From: Jonathing Date: Fri, 27 Sep 2024 22:28:32 -0400 Subject: [PATCH] add flag to skip game launch prompt --- GModCEFCodecFix.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/GModCEFCodecFix.py b/GModCEFCodecFix.py index 110bceb..c0d7a6b 100644 --- a/GModCEFCodecFix.py +++ b/GModCEFCodecFix.py @@ -92,11 +92,13 @@ launchSuccess = False autoMode = False +skipPrompt = False @atexit.register def exitHandler(): if not launchSuccess or autoMode is False: - input("Press Enter to continue...") + if not skipPrompt: + input("Press Enter to continue...") # Set the title so it's not just some boring path if sys.platform == "win32": @@ -177,6 +179,7 @@ def exitHandler(): # Optional command line arguments parser = argparse.ArgumentParser(prog="GModCEFCodecFix") parser.add_argument("-a", required=False, type=int, metavar="LAUNCH_OPTION", help="Force a specific GMod launch option (auto mode)") +parser.add_argument("-s", required=False, action='store_true', help="Skip the prompt to launch GMod, preventing automatic launch") parser.add_argument("-steam_path", required=False, help="Force a specific Steam install path (NOT a Steam library path)") args = parser.parse_args() @@ -184,6 +187,10 @@ def exitHandler(): autoMode = int(args.a) print(colored("AUTO MODE: Enabled - Option " + str(autoMode) + "\n", "cyan")) +if args.s: + skipPrompt = True + print(colored("SKIP PROMPT: Enabled\n", "cyan")) + timeStart = perf_counter() # Get Home Dir (used for finding Steam if necessary) @@ -697,7 +704,7 @@ def determineFileIntegrityStatus(file): if gmodEXELaunchOptionsLen == 1: gmodEXESelected = 0 - validShouldLaunch = False + validShouldLaunch = skipPrompt while validShouldLaunch == False: print("\nDo you want to Launch Garry's Mod now? (yes/no)") @@ -720,7 +727,7 @@ def determineFileIntegrityStatus(file): print("That's not a valid option.") autoMode = False - if not shouldLaunch: + if skipPrompt or not shouldLaunch: sys.exit() elif sys.platform == "win32":