Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to skip game launch prompt #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions GModCEFCodecFix.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,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":
Expand Down Expand Up @@ -175,13 +177,18 @@ 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()

if args.a:
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)
Expand Down Expand Up @@ -693,7 +700,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)")

Expand All @@ -716,7 +723,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":
Expand Down