55import subprocess
66import json
77import os
8+ import shlex
89from sys import exit as _exit
910
1011from 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]\n Failed 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]\n Failed to launch game:' , repr (e ))
0 commit comments