From d016cd720036e9a288d8f5adf9b32d387f710262 Mon Sep 17 00:00:00 2001 From: Toofy Date: Fri, 12 Jan 2024 19:34:36 +0000 Subject: [PATCH] Fix for CK3/other games with similar directory structure --- .gitignore | 4 +++- README.md | 7 ++++++- package/cream.sh | 30 ++++++++++++++++++++++++------ package/cream_api.ini | 4 ++++ 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index cadc890..5e35689 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ build/ .cache .vscode lib/ -output \ No newline at end of file +output +.idea +cmake-build-debug/ diff --git a/README.md b/README.md index 8c3deec..cd63cd1 100644 --- a/README.md +++ b/README.md @@ -64,10 +64,15 @@ chmod +x cream.sh Please collect a log using the instructions below, then post an issue describing your situation [here](https://github.com/anticitizn/creamlinux/issues/new). ## Gathering logs -Install `konsole` and set your game launch options to this: +If using a KDE environment, set your game launch options to this: ``` konsole --hold -e sh ./cream.sh %command% ``` +Or if you are using Gnome environment, you can set your launch options to this: +``` +gnome-terminal -- sh -c "./cream.sh %command%; exec bash" +``` +If using neither, install `konsole` and follow the KDE step. Then launch the game (skip any launchers like the Paradox launcher if possible, they interfere with the logging). Wait for the game to load if applicable, close it, then copy and paste the contents of the terminal. # Advanced diff --git a/package/cream.sh b/package/cream.sh index 3e325ef..7947169 100755 --- a/package/cream.sh +++ b/package/cream.sh @@ -1,10 +1,28 @@ #!/bin/bash -cp "$PWD/lib32Creamlinux.so" /tmp/lib32Creamlinux.so -cp "$PWD/lib64Creamlinux.so" /tmp/lib64Creamlinux.so -cp "$PWD/$(find . -name "libsteam_api.so" -printf "%P\n" | head -n 1)" /tmp/libsteam_api.so +copy_file() { + cp "$1" "$2" || { echo "Error: Failed to copy $1 to $2"; exit 1; } +} + +LIBSTEAM_API_DIR=$(find . -name "libsteam_api.so" -printf "%h\n" | head -n 1) +[ -z "$LIBSTEAM_API_DIR" ] && { echo "Error: libsteam_api.so not found."; exit 1; } +if [ ! -z "$CREAM_CONFIG_PATH" ]; then + if [ ! -f "$CREAM_CONFIG_PATH/cream_api.ini" ]; then + echo "Error: cream_api.ini not found in CREAM_CONFIG_PATH."; exit 1; + fi +else + if [ ! -f "$PWD/cream_api.ini" ]; then + echo "Error: cream_api.ini not found in the current working directory."; exit 1; + fi +fi +if [ -z "$CREAM_CONFIG_PATH" ] && [ "$LIBSTEAM_API_DIR" != "$PWD" ]; then + export CREAM_CONFIG_PATH="$PWD/cream_api.ini" +fi + +copy_file "$PWD/lib32Creamlinux.so" /tmp/lib32Creamlinux.so +copy_file "$PWD/lib64Creamlinux.so" /tmp/lib64Creamlinux.so +copy_file "$LIBSTEAM_API_DIR/libsteam_api.so" /tmp/libsteam_api.so + LD_PRELOAD="$LD_PRELOAD /tmp/lib64Creamlinux.so /tmp/lib32Creamlinux.so /tmp/libsteam_api.so" "$@" EXITCODE=$? -rm /tmp/lib32Creamlinux.so -rm /tmp/lib64Creamlinux.so -rm /tmp/libsteam_api.so +rm -f /tmp/lib32Creamlinux.so /tmp/lib64Creamlinux.so /tmp/libsteam_api.so exit $EXITCODE diff --git a/package/cream_api.ini b/package/cream_api.ini index f608b20..f552081 100644 --- a/package/cream_api.ini +++ b/package/cream_api.ini @@ -84,6 +84,10 @@ disable_steamapps_issubscribedapp = false 1303182 = Crusader Kings III: Royal Court 1303184 = Crusader Kings III: Fate of Iberia 2114760 = Crusader Kings III: Friends & Foes +2311920 = Crusader Kings III: Tours and Tournaments +2311930 = Crusader Kings III: Elegance of the Empire +2313541 = Crusader Kings III: Wards and Wardens +2313540 = Crusader Kings III: Legacy of Persia 801650 = Surviving Mars - Stellaris Dome Set 801710 = Surviving Mars: Deluxe Edition Upgrade Pack 801690 = Surviving Mars: Mysteries Resupply Pack