minor refactoring

This commit is contained in:
Onni Kukkonen
2022-04-30 15:37:03 +03:00
parent 8b1c371608
commit 3a25a56ee9
2 changed files with 23 additions and 24 deletions

View File

@@ -1,6 +0,0 @@
#!/bin/bash
mkdir build
cd build
cmake ..
make
cp ../package/* ./lib/

View File

@@ -1,19 +1,32 @@
#!/bin/bash #!/bin/bash
result=$(zenity --title="Launch Options" --list "Start Game" "Edit Creamlinux settings" --column="Launch Options") result=$(zenity --title="Launch Options" --list "Start Game" "Edit Creamlinux settings" --column="Launch Options")
# Supported games # Supported games
GAME_NAMES=("Hearts Of Iron IV" "Europa Universalis IV" "Cities: Skylines" "Stellaris" "Paradox Launcher (Don't launch game here)") GAME_NAMES=("Hearts Of Iron IV" "Europa Universalis IV" "Cities: Skylines" "Stellaris" "PDX Launcher (don't click play)")
GAME_BINARIES=("./hoi4" "./eu4" "./Cities.x64" "./stellaris" "./dowser") GAME_BINARIES=("./hoi4" "./eu4" "./Cities.x64" "./stellaris" "./dowser")
# stupid fix for stupid "backwards compatability" reasons launch_game () {
# seriously i spent fucking 1h and 30mins figuring this shit out # LD_PRELOAD doesn't support spaces, do this instead
# really, backwards compatibility is stupid and breaks stuff most of the time (windows is a good example) cp "$PWD/libCreamlinux.so" /tmp/libCreamlinux.so
# word splitting is one of those cases # reset backwards compatible stuff so games that DO use it don't break
# who has any genuine use for word splitting???? unset IFS
# paradox launcher segfaults with creamlinux, if launching launcher, do it differently
if [ "$SELECTED_GAME" -eq "./dowser" ]; then
$SELECTED_GAME "$@"
exit 0
fi
# actually launch the game
LD_PRELOAD="$LD_PRELOAD /tmp/libCreamlinux.so" $SELECTED_GAME "$@"
}
# ifs is required because zenity fucks up without it
export IFS="" export IFS=""
if [ -z "$CREAM_GAME_NAME" ]; then
SELECTED_GAME=$CREAM_GAME_NAME
launch_game
fi
case $result in case $result in
"Start Game") "Start Game")
# LD_PRELOAD doesn't support spaces, do this instead
cp "$PWD/libCreamlinux.so" /tmp/libCreamlinux.so
FOUND_BINS=() FOUND_BINS=()
INDEX=0 INDEX=0
INDEX_ADDED=0 INDEX_ADDED=0
@@ -49,19 +62,11 @@ case $result in
# is the game variable set # is the game variable set
if [ -z "$SELECTED_INDEX" ]; then if [ -z "$SELECTED_INDEX" ]; then
zenity --error --text="Cancelled: No game selected" zenity --error --text="Cancelled: No game selected"
# unset ifs so we don't fuck up every other program # unset ifs before we quit
unset IFS unset IFS
exit 1 exit 1
else else
# reset stupid backwards compatible stuff so games that DO use it don't break launch_game
unset IFS
# paradox launcher segfaults with creamlinux, if launching launcher, do it differently
if [ "$SELECTED_GAME" -eq "./dowser" ]; then
$SELECTED_GAME "$@"
exit 0
fi
# actually launch the game
LD_PRELOAD="$LD_PRELOAD /tmp/libCreamlinux.so" $SELECTED_GAME "$@"
fi fi
;; ;;