-
-
Save xlash123/74e8671848d0c13920e182af96945ba5 to your computer and use it in GitHub Desktop.
#!/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" | |
Updated due to legendary having a different order of arguments.
Hi, I'm trying to run the command. This is the output I get:
/home/REMOVED/Games/Heroic/Prefixes/KINGDOM-HEARTS-HD-1.52.5-ReMIX/drive_c/Program Files/Epic Games/KH_1.5_2.5/KINGDOM HEARTS FINAL MIX.exe' -AUTH_LOGIN=unused -AUTH_PASSWORD=REMOVED -AUTH_TYPE=exchangecode -epicapp=REMOVED -epicenv=Prod -EpicPortal '-epicusername=REMOVED' -epicuserid=REMOVED -epiclocale=en -epicsandboxid=REMOVED sh: 1: /home/REMOVED/Games/Heroic/Prefixes/KINGDOM-HEARTS-HD-1.52.5-ReMIX/drive_c/Program Files/Epic Games/KH_1.5_2.5/KINGDOM HEARTS FINAL MIX.exe: Exec format error
I removed my personal information from the text, but the key here is the exec format error. The shebang is properly formatted at the top of the script, so I don't know why it gives this error.
@JayH2971 I was able to get all the games working without using this script using the Heroic Games launcher. Others have had success, so hopefully you can find success too. I don't really plan to maintain or provide updates to this script since it was just a hack to get this working. Now that there's a better, more accessible method available, there's no need for this.
Hey, that's great info. Thanks for the link!
As stated in the comments, this is not a run-and-done script to launch the game. You should instead edit the top few variables with the correct information to get it running. Follow this link to get better instructions on how to obtain that information.