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

Commit ead3328

Browse files
committed
Improve additional launch parameter handling
Closes #1
1 parent b49bdac commit ead3328

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

src/rktlnch.py

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import subprocess
66
import json
77
import os
8+
import shlex
89
from sys import exit as _exit
910

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

34-
args = parser.parse_args()
35+
args, extra = parser.parse_known_args()
3536

3637
elfs = EPCLFS()
3738

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

120-
# Launching the game!
121-
print('Launching the game... ', end='', flush=True)
122121
exe_path = os.path.join(game_manifest['InstallLocation'],
123122
game_manifest['LaunchExecutable'])
123+
124+
params = [exe_path,
125+
'-AUTH_LOGIN=unused',
126+
f'-AUTH_PASSWORD={game_token["code"]}',
127+
'-AUTH_TYPE=exchangecode',
128+
f'-epicapp={game_manifest["AppName"]}',
129+
'-epicenv=Prod',
130+
'-EpicPortal',
131+
f'-epicusername={auth_data["displayName"]}',
132+
f'-epicuserid={auth_data["account_id"]}',
133+
'-epiclocale=en']
134+
135+
# add params from manifest (required for e.g. Fornite)
136+
if game_manifest.get('LaunchCommand', ''):
137+
print('Adding "LaunchCommand" from manifest...')
138+
params.extend(shlex.split(game_manifest['LaunchCommand']))
139+
140+
# allow passing params through to the game
141+
if extra:
142+
print('Adding extra params:', ', '.join(extra))
143+
params.extend(extra)
144+
124145
try:
125-
subprocess.Popen([exe_path,
126-
game_manifest.get('LaunchCommand', ''), # this is gnarly, but works!
127-
'-AUTH_LOGIN=unused',
128-
f'-AUTH_PASSWORD={game_token["code"]}',
129-
'-AUTH_TYPE=exchangecode',
130-
f'-epicapp={game_manifest["AppName"]}',
131-
'-epicenv=Prod',
132-
'-EpicPortal',
133-
f'-epicusername={auth_data["displayName"]}',
134-
f'-epicuserid={auth_data["account_id"]}',
135-
'-epiclocale=en'],
136-
cwd=game_manifest['InstallLocation'])
146+
# Launching the game!
147+
print('Launching the game... ', end='', flush=True)
148+
subprocess.Popen(params, cwd=game_manifest['InstallLocation'])
137149
print('[OK!]')
138150
except Exception as e:
139151
print('[FAIL]\nFailed to launch game:', repr(e))

0 commit comments

Comments
 (0)