From 46cbb8f0fde77ce6cc7d9baa0551e46704cfc2e8 Mon Sep 17 00:00:00 2001 From: cdeletre Date: Fri, 6 Dec 2024 11:39:24 -0500 Subject: [PATCH] Split patchscript (patching vs updating) --- ports/riskofrain/Risk of Rain (2013).sh | 9 ++- .../riskofrain/riskofrain/gmloadernext.armhf | Bin ports/riskofrain/riskofrain/lib/README | 17 ++++ .../{lib => libs.armhf}/libcrypto.so.1.1 | Bin .../{lib => libs.armhf}/libzip.so.5 | Bin ports/riskofrain/riskofrain/tools/patchscript | 47 +---------- .../riskofrain/riskofrain/tools/updatescript | 76 ++++++++++++++++++ 7 files changed, 104 insertions(+), 45 deletions(-) mode change 100644 => 100755 ports/riskofrain/Risk of Rain (2013).sh mode change 100644 => 100755 ports/riskofrain/riskofrain/gmloadernext.armhf create mode 100644 ports/riskofrain/riskofrain/lib/README rename ports/riskofrain/riskofrain/{lib => libs.armhf}/libcrypto.so.1.1 (100%) rename ports/riskofrain/riskofrain/{lib => libs.armhf}/libzip.so.5 (100%) create mode 100755 ports/riskofrain/riskofrain/tools/updatescript diff --git a/ports/riskofrain/Risk of Rain (2013).sh b/ports/riskofrain/Risk of Rain (2013).sh old mode 100644 new mode 100755 index 27208b10d4..15e6c9f304 --- a/ports/riskofrain/Risk of Rain (2013).sh +++ b/ports/riskofrain/Risk of Rain (2013).sh @@ -37,9 +37,16 @@ export PATCHER_GAME="$(basename "${0%.*}")" # This gets the current script filen export PATCHER_TIME="1 to 2 minutes" # Exports -export LD_LIBRARY_PATH="/usr/lib:/usr/lib32:/$GAMEDIR/lib:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH="/usr/lib:/usr/lib32:/$GAMEDIR/libs.armhf:$LD_LIBRARY_PATH" export PATH="$PATH:$GAMEDIR/tools" +# If previous installation (671b20f) +# remove patchlog.txt so that Patcher +# will update properly +[[ -f "$GAMEDIR/game.apk" ]] && rm "$GAMEDIR/patchlog.txt" \ +&& export PATCHER_FILE="$GAMEDIR/tools/updatescript" \ +&& export PATCHER_TIME="less than a minute" + # Check if patchlog.txt to skip patching if [ ! -f patchlog.txt ]; then if [ -f "$controlfolder/utils/patcher.txt" ]; then diff --git a/ports/riskofrain/riskofrain/gmloadernext.armhf b/ports/riskofrain/riskofrain/gmloadernext.armhf old mode 100644 new mode 100755 diff --git a/ports/riskofrain/riskofrain/lib/README b/ports/riskofrain/riskofrain/lib/README new file mode 100644 index 0000000000..0d623e7945 --- /dev/null +++ b/ports/riskofrain/riskofrain/lib/README @@ -0,0 +1,17 @@ +# What are those? + +Those are native Android libraries meant to be loaded into the guest environment, +and the come from a [prebuilt AOSP image provided by google](https://ci.android.com/builds/branches/aosp-main/grid). + +# What are these files for then? + +They provide a similar-to-android implementation to all of the supported libraries, +allowing us to make less guesswork, and provide more accurate renditions of a lot +of those functionalities, specially for libc++ where a lot of guesswork was done +in the past. + +OpenAL, OpenGL and libc.so are provided from the host (via thunking where needed) or +via reimplementations. + +You still need a suitable GameMaker Android title/runner. You can source those from +either [freeware Android APKs](https://itch.io) or finding a [suitable runner](https://gamemaker.io/account/runtimes) for hacking. \ No newline at end of file diff --git a/ports/riskofrain/riskofrain/lib/libcrypto.so.1.1 b/ports/riskofrain/riskofrain/libs.armhf/libcrypto.so.1.1 similarity index 100% rename from ports/riskofrain/riskofrain/lib/libcrypto.so.1.1 rename to ports/riskofrain/riskofrain/libs.armhf/libcrypto.so.1.1 diff --git a/ports/riskofrain/riskofrain/lib/libzip.so.5 b/ports/riskofrain/riskofrain/libs.armhf/libzip.so.5 similarity index 100% rename from ports/riskofrain/riskofrain/lib/libzip.so.5 rename to ports/riskofrain/riskofrain/libs.armhf/libzip.so.5 diff --git a/ports/riskofrain/riskofrain/tools/patchscript b/ports/riskofrain/riskofrain/tools/patchscript index f9a9a6b7b2..3c5738cb01 100755 --- a/ports/riskofrain/riskofrain/tools/patchscript +++ b/ports/riskofrain/riskofrain/tools/patchscript @@ -37,39 +37,6 @@ DATA_WIN_MD5="d32c0d93bfc23b242fe7fca90f1d07ef" # -------------------- BEGIN FUNCTIONS -------------------- -update_install_671b20f() -{ - # Update from previous install (git commit 671b20f) - files_to_move=( - "Prefs.ini" - "Save.ini" - "game.droid" - "options.ini" - ) - - for file in "${files_to_move[@]}"; do - echo "Moving $file" - mv "$file" "$GAMEDIR/gamedata/" - [[ ! $? -eq 0 ]] && echo "Cannot move $file" && return 1 # CRITICAL - done - - echo "Renaming game.apk" - mv "$GAMEDIR/game.apk" "$GAMEDIR/riskofrain.port" - [[ ! $? -eq 0 ]] && echo "Cannot rename game.apk" && return 1 # CRITICAL - - files_to_delete=( - "gmloadernext" - ) - - for file in "${files_to_delete[@]}"; do - echo "Deleting $file" - rm "$file" - done - - return 0 - -} - cleanup_files() { # Delete unnecessary files @@ -151,17 +118,9 @@ patch_game() # --------------------- END FUNCTIONS --------------------- -# If previous installation (671b20f) is detected update and exit -# (no need to install the game again) -if [[ -f "$GAMEDIR/game.apk" ]]; then - update_install_671b20f - [[ ! $? -eq 0 ]] && echo "Cannot update game" \ - && echo "Patching process failed!" && exit 1 \ - || echo "Game updated" && echo "Patching process done!" && exit 0 -fi - # Install the game patch_game && install_conf && pack_assets && cleanup_files [[ ! $? -eq 0 ]] && echo "Cannot install the game" \ -&& echo "Patching process failed!" && exit 1 \ -|| echo "Patching process done!" && exit 0 \ No newline at end of file +&& echo "Patching process failed!" && exit 1 + +echo "Patching process done!" && exit 0 \ No newline at end of file diff --git a/ports/riskofrain/riskofrain/tools/updatescript b/ports/riskofrain/riskofrain/tools/updatescript new file mode 100755 index 0000000000..4b287ab9b0 --- /dev/null +++ b/ports/riskofrain/riskofrain/tools/updatescript @@ -0,0 +1,76 @@ +#!/bin/bash + +# +# Risk of Rain update script +# Author: kotzebuedog +# Version: 1.0 +# Update 671b20f +# + +XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share} + +if [ -d "/opt/system/Tools/PortMaster/" ]; then + controlfolder="/opt/system/Tools/PortMaster" +elif [ -d "/opt/tools/PortMaster/" ]; then + controlfolder="/opt/tools/PortMaster" +elif [ -d "$XDG_DATA_HOME/PortMaster/" ]; then + controlfolder="$XDG_DATA_HOME/PortMaster" +else + controlfolder="/roms/ports/PortMaster" +fi + +source $controlfolder/control.txt + +# Set GAMEDIR to the current directory and set logfile +export GAMEDIR="$PWD" +LOGFILE="$GAMEDIR/patchlog.txt" + +# Redirect output and error to the log file +exec > >(tee -a "$LOGFILE") 2>&1 +echo "GAMEDIR is set to: $GAMEDIR" + +# -------------------- BEGIN FUNCTIONS -------------------- + +update_install_671b20f() +{ + # Update from previous install (git commit 671b20f) + files_to_move=( + "Prefs.ini" + "Save.ini" + "game.droid" + "options.ini" + ) + + for file in "${files_to_move[@]}"; do + echo "Moving $file" + mv "$file" "$GAMEDIR/gamedata/" + [[ ! $? -eq 0 ]] && echo "Cannot move $file" && return 1 # CRITICAL + done + + echo "Renaming game.apk" + mv "$GAMEDIR/game.apk" "$GAMEDIR/riskofrain.port" + [[ ! $? -eq 0 ]] && echo "Cannot rename game.apk" && return 1 # CRITICAL + + files_to_delete=( + "gmloadernext" + "lib/libcrypto.so.1.1" + "lib/libzip.so.5" + "lib/arm64-v8a" + ) + + for file in "${files_to_delete[@]}"; do + echo "Deleting $file" + rm -rf "$file" + done + + return 0 + +} + +# --------------------- END FUNCTIONS --------------------- + +update_install_671b20f +[[ ! $? -eq 0 ]] && echo "Cannot update game" \ +&& echo "Patching process failed!" && exit 1 + +echo "Game updated" && echo "Patching process done!" && exit 0