Skip to content

Instantly share code, notes, and snippets.

@xlash123
Last active January 4, 2024 17:00
Show Gist options
  • Save xlash123/74e8671848d0c13920e182af96945ba5 to your computer and use it in GitHub Desktop.
Save xlash123/74e8671848d0c13920e182af96945ba5 to your computer and use it in GitHub Desktop.
Launch Kingdom Hearts 1.5+2.5 on Linux using Legendary and Heroic Games Launcher
#!/bin/sh
# This script requires that you set certain variables before running it.
# After that, you can just run the command and the game will launch!
# Instructions can be found at https://github.com/FlaareZero/Kingdom_Hearts_Collection_Linux/issues/2#issuecomment-890655837
# STEP 1: Environment variables from Heroic
HEROIC_ENV="" # Paste in the quotes
# STEP 2: Wine command from Heroic
HEROIC_WINE="" # Paste in the quotes
# STEP 3: Directory of KH1.5
# By default, this is ~/legendary/KH_1.5_2.5
# If you have it there too, you may skip this step
KH_DIR="$HOME/legendary/KH_1.5_2.5"
# STEP 4: You're all done! Run the command now
# The Id of the game as seen in the output of `legendary list-games`
KH_GAMEID="68c214c58f694ae88c2dab6f209b43e4"
# Ask what game to play
echo "Launch which game?"
echo "1) Kingdom Hearts 1"
echo "2) Kingdom Hearts 2"
echo "3) Kingdom Hearts Re: Chain of Memories"
echo "4) Kingdom Hearts Birth by Sleep"
read KH_CHOICE
# Get the path for the KH binary to play
KH_BIN=""
case $KH_CHOICE in
1)
KH_BIN="'$KH_DIR/KINGDOM HEARTS FINAL MIX.exe'";;
2)
KH_BIN="'$KH_DIR/KINGDOM HEARTS II FINAL MIX.exe'";;
3)
KH_BIN="'$KH_DIR/KINGDOM HEARTS Re_Chain of Memories.exe'";;
4)
KH_BIN="'$KH_DIR/KINGDOM HEARTS Birth by Sleep FINAL MIX.exe'";;
*)
echo "Invalid game selection" && exit;;
esac
# Get the session from Legendary
RAW_LEGEND=$(legendary launch $KH_GAMEID --dry-run 2>&1 >/dev/null)
TMP=${RAW_LEGEND#*.exe\'\ }
# This holds the session tokens in argument form
ARG_AUTH=${TMP%\[cli\]\ INFO:\ Working*}
# The command all combined
FINAL_COMMAND="$HEROIC_ENV $HEROIC_WINE $KH_BIN $ARG_AUTH"
# Echo for debugging purposes
echo $FINAL_COMMAND
# Run it
sh -c "$FINAL_COMMAND"
@JayH2971
Copy link

JayH2971 commented Apr 5, 2022

Hey, that's great info. Thanks for the link!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment