Software: Launching League of Legends spectator mode from Command Line (Mac)
Posted
by
Alex Popov
on Super User
See other posts from Super User
or by Alex Popov
Published on 2014-05-30T21:18:53Z
Indexed on
2014/05/30
21:35 UTC
Read the original article
Hit count: 317
Background: tl;dr at the end
League of Legends has a spectator mode, in which you can watch someone else's game (essentially a replay) with a 3 minute delay. Popular LoL website OP.GG has figured out a clever way of hosting these spectator games on their own servers, thereby making them replayable, as opposed to only being available while the game is on (as Riot does it).
If you request a replay from OP.GG, it sends a batch file which looks for where the League is situated and then the magic happens:
@start "" "League of Legends.exe" "8394" "LoLLauncher.exe" "" "spectator fspectate.op.gg:4081 tjJbtRLQ/HMV7HuAxWV0XsXoRB4OmFBr 1391881421 NA1"
This works fine on Windows. I'm trying to get it to work on Mac (which has an official client).
First I tried running the same command by hand, (split for convenience)
/Applications/ ... /LeagueOfLegends.app/ ... /LeagueofLegends 8393 LoLLauncher \
/Applications/ ... /LolClient spectator fspectate.op.gg:4081 tjJbtRLQ/HMV7HuAxWV0XsXoRB4OmFBr 1391881421 NA1
Running this, however, just starts the LoLLauncher, which closes all the active League processes. The exactly same thing happens if I just call /Applications/ ... /LeagueOfLegends.app/ ... /LeagueofLegends
Next I tried seeing what actually happens when Spectator mode is initiated so I ran $ ps -axf | grep -i lol
which showed
UID PID PPID C STIME TTY TIME CMD
503 3085 1 0 Wed02pm ?? 0:00.00 (LolClient)
503 24607 1 0 9:19am ?? 0:00.98 /Applications/League of Legends.app/Contents/LOL/RADS/system/UserKernel.app/Contents/MacOS/UserKernel updateandrun lol_launcher LoLLauncher.app
503 24610 24607 0 9:19am ?? 1:08.76 /Applications/League of Legends.app/Contents/LoL/RADS/projects/lol_launcher/releases/0.0.0.122/deploy/LoLLauncher.app/Contents/MacOS/LoLLauncher
503 24611 24610 0 9:19am ?? 1:23.02 /Applications/League of Legends.app/Contents/LoL/RADS/projects/lol_air_client/releases/0.0.0.127/deploy/bin/LolClient -runtime .\ -nodebug META-INF\AIR\application.xml .\ -- 8393
503 24927 24610 0 9:44am ?? 0:03.37 /Applications/League of Legends.app/Contents/LoL/RADS/solutions/lol_game_client_sln/releases/0.0.0.117/deploy/LeagueOfLegends.app/Contents/MacOS/LeagueofLegends 8394 LoLLauncher /Applications/League of Legends.app/Contents/LoL/RADS/projects/lol_air_client/releases/0.0.0.127/deploy/bin/LolClient spectator 216.133.234.17:8088 Yn1oMX/n3LpXNebibzUa1i3Z+s2HV0ul 1400781241 NA1
Of Interest:
- there is
(LolClient)
which I cannot kill by it's PID. UserKernel updateandrun lol_launcher LoLLauncher.app
is launched first.LoLLauncher
is launched by theUserKernel
(as we can see from the PPID)- The very long command (PID: 24927) is how Spectator mode is launched, and is also launched by
UserKernel
. - Spectator mode is launched in exactly the same way that the OP.GG .bat wanted to, with the only difference that Spectator mode connects to Riot instead of OP.GG's spectate server.
I tried attaching GDB to the LolClient, but I couldn't get anything meaningful from it since it's an Adobe AIR application (and I've never used GDB with code other than mine own).
Next I ran dtruss -a -b 100m -f -p $PID
on everything I could think of: the LolClient
, the LolLauncher
and the UserKernel
and skimmed the half a million lines produced. I found stuff like the GET request used to get the information of the game to spectate, but I could not see any launch of the equivalent of League of Legends.exe with spectator options.
Finally, I ran lsof | grep -i lol
to see if anything else was opened in the process, but didn't find anything that seemed appropriate. Open were UserKernel
, LolLauncher
, LolClient
, Adobe AIR
, LeagueofLegends
and then Bugsplat
, all of which are expected. None of this seemed especially relevant to figuring out how LeagueofLegends was opened into spectator mode.
It obviously can be done, since Spectator mode is accessible from within the client. It seems likely that it can be done from the CLI, since Windows can do it and the clients are supposed to equals. Unless I'm missing something in the difference between how UNIX and Windows handle CLI application launches.
My question is if there are any other things I can try to figure out how to launch Spectator mode myself.
tl;dr:
Trying to get into spectator mode from the CLI. It's possible on Windows (see first code block) but it just restarts League on Mac. What else can I try to find what call is made, and how to reproduce it?
PS: Please let me know how I can improve this question or its formatting, I'd love to use StackOverflow/SuperUser, but as the guys said on the podcast this week (Ep. 59) it's very intimidating. Sorry for posting this on StackOverflow the first time :(
© Super User or respective owner