Last active
March 7, 2022 10:01
-
-
Save nkrapivin/ac74cde7c0283e8e4c966cdfa90038bf to your computer and use it in GitHub Desktop.
Runshi (Ранши) - RUN.SH IMproved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# lo and behold, runshi 2, aka the worst piece of bash ever written! | |
# -- PLEASE CHANGE THIS ONE, IT'S A RELATIVE PATH TO YOUR GAME EXECUTABLE -- | |
NIK_MYCMD="./Mondealy_Full" | |
# in seconds, if your computer is extremely slow you may want to use higher amounts. | |
NIK_DELAY=1 | |
# You usually do not need to touch the rest... | |
NIK_OLDIFS="$IFS" | |
IFS=":" | |
read -ra NIK_LIBSARR <<< "$LD_LIBRARY_PATH" | |
IFS="$NIK_OLDIFS" | |
NIK_LD_PINNEDLIBS="" | |
# Get pinned libs... | |
for NIK_VAL in "${NIK_LIBSARR[@]}"; do | |
if [[ $NIK_VAL == *"pinned_libs_64"* ]]; then | |
NIK_LD_PINNEDLIBS="$NIK_VAL" | |
fi | |
done | |
# 'kill' faulty libcurl4 | |
if [[ -z "$NIK_LD_PINNEDLIBS" ]]; then | |
echo "RUNSHI: Unable to find pinned_libs_64." | |
else | |
echo "RUNSHI: Found pinned_libs_64 at $NIK_LD_PINNEDLIBS" | |
mv "$NIK_LD_PINNEDLIBS/libcurl.so.4" "$NIK_LD_PINNEDLIBS/libcurl.so.4.nikbaka" | |
fi | |
# Run the game in detached mode (at symbol at the end) | |
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/assets" LD_PRELOAD="$LD_PRELOAD:libnikxfix.so" "$NIK_MYCMD" "$@" & | |
sleep $NIK_DELAY | |
# restore faulty libcurl4 | |
if [[ -z "$NIK_LD_PINNEDLIBS" ]]; then | |
echo "RUNSHI: Did not find pinned_libs_64 so not restoring curl..." | |
else | |
echo "RUNSHI: Restoring curl..." | |
mv "$NIK_LD_PINNEDLIBS/libcurl.so.4.nikbaka" "$NIK_LD_PINNEDLIBS/libcurl.so.4" | |
echo "RUNSHI: Sanity decreased OK." | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment