Skip to content
This repository has been archived by the owner on Dec 2, 2021. It is now read-only.

Commit

Permalink
Improve additional launch parameter handling
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
derrod committed Mar 15, 2020
1 parent b49bdac commit ead3328
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions src/rktlnch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import subprocess
import json
import os
import shlex
from sys import exit as _exit

from base64 import b64decode, b64encode
Expand All @@ -31,7 +32,7 @@ def exit(code=0):
parser.add_argument('--skip-version-check', dest='skip_version_check', action='store_true',
default=False, help='Skip version check')

args = parser.parse_args()
args, extra = parser.parse_known_args()

elfs = EPCLFS()

Expand Down Expand Up @@ -117,23 +118,34 @@ def exit(code=0):
print('[FAIL]\nFailed to get game token with:', repr(e))
exit(1)

# Launching the game!
print('Launching the game... ', end='', flush=True)
exe_path = os.path.join(game_manifest['InstallLocation'],
game_manifest['LaunchExecutable'])

params = [exe_path,
'-AUTH_LOGIN=unused',
f'-AUTH_PASSWORD={game_token["code"]}',
'-AUTH_TYPE=exchangecode',
f'-epicapp={game_manifest["AppName"]}',
'-epicenv=Prod',
'-EpicPortal',
f'-epicusername={auth_data["displayName"]}',
f'-epicuserid={auth_data["account_id"]}',
'-epiclocale=en']

# add params from manifest (required for e.g. Fornite)
if game_manifest.get('LaunchCommand', ''):
print('Adding "LaunchCommand" from manifest...')
params.extend(shlex.split(game_manifest['LaunchCommand']))

# allow passing params through to the game
if extra:
print('Adding extra params:', ', '.join(extra))
params.extend(extra)

try:
subprocess.Popen([exe_path,
game_manifest.get('LaunchCommand', ''), # this is gnarly, but works!
'-AUTH_LOGIN=unused',
f'-AUTH_PASSWORD={game_token["code"]}',
'-AUTH_TYPE=exchangecode',
f'-epicapp={game_manifest["AppName"]}',
'-epicenv=Prod',
'-EpicPortal',
f'-epicusername={auth_data["displayName"]}',
f'-epicuserid={auth_data["account_id"]}',
'-epiclocale=en'],
cwd=game_manifest['InstallLocation'])
# Launching the game!
print('Launching the game... ', end='', flush=True)
subprocess.Popen(params, cwd=game_manifest['InstallLocation'])
print('[OK!]')
except Exception as e:
print('[FAIL]\nFailed to launch game:', repr(e))
Expand Down

0 comments on commit ead3328

Please sign in to comment.