fixed paradox launcher, removed zenity gui

This commit is contained in:
Onni Kukkonen
2022-11-20 22:12:40 +02:00
parent 966a030d88
commit 16f0a99a60
8 changed files with 324 additions and 135 deletions

View File

@@ -1,108 +1,10 @@
#!/bin/bash
# this is going to be the default going forwards
if [ "$CREAM_SIMPLE" ]; then
cp "$PWD/libCreamlinux.so" /tmp/libCreamlinux.so
LD_PRELOAD="$LD_PRELOAD /tmp/libCreamlinux.so" "$@"
cp "$PWD/lib32Creamlinux.so" /tmp/lib32Creamlinux.so
cp "$PWD/lib64Creamlinux.so" /tmp/lib64Creamlinux.so
cp "$PWD/libsteam_api.so" /tmp/libsteam_api.so
LD_PRELOAD="$LD_PRELOAD /tmp/lib64Creamlinux.so /tmp/lib32Creamlinux.so /tmp/libsteam_api.so" "$@"
EXITCODE=$?
rm /tmp/libCreamlinux.so
rm /tmp/lib32Creamlinux.so
rm /tmp/lib64Creamlinux.so
rm /tmp/libsteam_api.so
exit $EXITCODE
fi
result=$(zenity --title="Launch Options" --list "Start Game" "Edit Creamlinux settings" --column="Launch Options")
# Supported games
GAME_NAMES=("Hearts Of Iron IV" "Europa Universalis IV" "Cities: Skylines" "Stellaris" "PDX Launcher" "PAYDAY 2")
GAME_BINARIES=("./run_hoi4" "./eu4" "./Cities.x64" "./stellaris" "./dowser" "./payday2_release")
function launch_game {
# LD_PRELOAD doesn't support spaces, do this instead
cp "$PWD/libCreamlinux.so" /tmp/libCreamlinux.so
# reset backwards compatible stuff so games that DO use it don't break
unset IFS
# paradox launcher segfaults with creamlinux, if launching launcher, do it differently
if [ "$SELECTED_GAME" = "./dowser" ]; then
$SELECTED_GAME "$@"
exit 0
fi
# actually launch the game
if [ "$CREAM_DEBUGGER" ]; then
LD_PRELOAD="$LD_PRELOAD /tmp/libCreamlinux.so" $CREAM_DEBUGGER $SELECTED_GAME
exit 0
fi
LD_PRELOAD="$LD_PRELOAD /tmp/libCreamlinux.so" $SELECTED_GAME
exit 0
}
# ifs is required because zenity fucks up without it
export IFS=""
if [ -z "$CREAM_GAME_NAME" ]; then
echo "showing dialog"
else
echo "launching directly"
SELECTED_GAME="./$CREAM_GAME_NAME"
launch_game
fi
case $result in
"Start Game")
FOUND_BINS=()
INDEX=0
INDEX_ADDED=0
MANGLED_OUTPUT=()
for GAMEBIN in "${GAME_BINARIES[@]}"
do
if [ -f "$GAMEBIN" ]; then
echo "$GAMEBIN exists."
FOUND_BINS+=("$GAMEBIN")
MANGLED_OUTPUT+=("$INDEX_ADDED")
MANGLED_OUTPUT+=("\"${GAME_NAMES[$INDEX]}\"")
MANGLED_OUTPUT+=("\"${GAME_BINARIES[$INDEX]}\"")
((INDEX_ADDED++))
fi
((INDEX++))
# do whatever on "$bin" here
done
if [ "${#FOUND_BINS[@]}" -eq "0" ]; then
echo "No binaries found."
zenity --error --text="No games were found in script directory."
exit 1
fi
if [ "${#FOUND_BINS[@]}" -eq "1" ]; then
echo "Found one binary, running"
SELECTED_GAME="${FOUND_BINS[0]}"
SELECTED_INDEX=1
else
echo "Found multiple binaries, triggering prompt"
SELECTED_INDEX=$(zenity --list --column="I" --column="Game Name" --column="Binary Path" --title="Launch Options" --text="Multiple game binaries were found. Please pick the game you want to run." ${MANGLED_OUTPUT[@]} )
SELECTED_GAME=${FOUND_BINS[$SELECTED_INDEX]}
fi
# is the game variable set
if [ -z "$SELECTED_INDEX" ]; then
zenity --error --text="Cancelled: No game selected"
# unset ifs before we quit
unset IFS
exit 1
else
launch_game
fi
;;
"Edit Creamlinux settings")
# is the cream_api.ini path set
if [ -z "$CREAM_CONFIG_PATH" ]; then
# no path was set
xdg-open $PWD/cream_api.ini
else
# custom path was set
xdg-open $CREAM_CONFIG_PATH
fi
# restart the script
$PWD/cream.sh
;;
*)
;;
esac

View File

@@ -46,8 +46,6 @@ disable_steamapps_issubscribedapp = false
1579991 = Hearts of Iron IV: Eastern Front Planes Pack
1579992 = Hearts of Iron IV: Eastern Front Music Pack
1785140 = Hearts of Iron IV: No Step Back - "Katyusha" (Pre-Order Bonus)
1880650 = Hearts of Iron IV: By Blood Alone
1880660 = Hearts of Iron IV: By Blood Alone (Pre-Order Bonus)
447680 = Stellaris: Symbols of Domination
447681 = Stellaris: Sign-up Campaign Bonus
447683 = Stellaris: Arachnoid Portrait Pack
@@ -66,8 +64,6 @@ disable_steamapps_issubscribedapp = false
1341520 = Stellaris: Necroids Species Pack
1522090 = Stellaris: Nemesis
1749080 = Stellaris: Aquatics Species Pack
1889490 = Stellaris: Overlord
2115770 = Stellaris: Toxoids Species Pack
218630 = PAYDAY 2: Career Criminal Content
247450 = PAYDAY 2: Pre-order Bonus
259381 = PAYDAY 2: Gage Mod Courier