Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 47 additions & 98 deletions ports/savingprincess/Saving Princess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,129 +13,78 @@ else
fi

source $controlfolder/control.txt
source $controlfolder/device_info.txt
export PORT_32BIT="Y"

get_controls
[ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt"
get_controls

$ESUDO chmod 666 /dev/tty0

# Variables
GAMEDIR="/$directory/ports/savingprincess"
GMLOADER_JSON="$GAMEDIR/gmloader.json"
TOOLDIR="$GAMEDIR/tools"

export LD_LIBRARY_PATH="/usr/lib32:$GAMEDIR/libs:$LD_LIBRARY_PATH"
export GMLOADER_DEPTH_DISABLE=1
export GMLOADER_SAVEDIR="$GAMEDIR/gamedata/"
export GMLOADER_PLATFORM="os_windows"

# We log the execution of the script into log.txt
# CD and set permissions
cd $GAMEDIR
> "$GAMEDIR/log.txt" && exec > >(tee "$GAMEDIR/log.txt") 2>&1

# Permissions
$ESUDO chmod 666 /dev/uinput
$ESUDO chmod +x "$GAMEDIR/gmloader"
# Exports
export LD_LIBRARY_PATH="/usr/lib:$GAMEDIR/lib:$LD_LIBRARY_PATH"
export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig"

cd $GAMEDIR

#Patch Game
# Ensure executable permissions
$ESUDO chmod +x "$GAMEDIR/gmloadernext.aarch64"
$ESUDO chmod +x "$GAMEDIR/tools/splash"

if [ -f "$GAMEDIR/gamedata/Saving Princess.exe" ]; then
# Calculate the MD5 checksum of Saving Princess.exe
actual_checksum=$(md5sum "$GAMEDIR/gamedata/Saving Princess.exe" | awk '{print $1}')
# Create saves directory
mkdir -p "$GAMEDIR/saves"

# Check if the file exists and the checksum matches
if [ "$actual_checksum" = "35a111d0149fae1f04b7b3fea42c5319" ]; then
# Change directory to the specified directory
cd "$GAMEDIR" || exit
# Prepare game files and patch game
XDELTA_FILE=""

# Use 7zip to extract the .exe file to the destination directory
"$GAMEDIR/tools/7zzs" x "$GAMEDIR/gamedata/Saving Princess.exe" -o"$GAMEDIR/gamedata" & pid=$!
# Extract full game
if [ -f "$GAMEDIR/assets/Saving Princess.exe" ]; then
actual_checksum=$(md5sum "$GAMEDIR/assets/Saving Princess.exe" | awk '{print $1}')

# Wait for the extraction process to complete
if [ "$actual_checksum" = "35a111d0149fae1f04b7b3fea42c5319" ]; then
"$controlfolder/7zzs.${DEVICE_ARCH}" x "$GAMEDIR/assets/Saving Princess.exe" -o"$GAMEDIR/assets" & pid=$!
wait $pid

# Check if Saving Princess v0_8.exe file exists
if [ -f "$GAMEDIR/gamedata/Saving Princess v0_8.exe" ]; then
# Delete the redundant .exe files
rm -f "$GAMEDIR/gamedata/Saving Princess v0_8.exe"
rm -f "$GAMEDIR/gamedata/Saving Princess.exe"
rm -f "$GAMEDIR/gamedata/D3DX9_43.dll"
fi
XDELTA_FILE="$TOOLDIR/fullgame.xdelta"
else
echo "Error: MD5 checksum of Saving Princess.exe does not match the expected checksum."
pm_message "Error: MD5 checksum of Saving Princess.exe does not match the expected checksum."
fi
else
echo "Saving Princess.exe not detected in /gamedata"
fi

if [ -f "$GAMEDIR/gamedata/Saving Princess - DEMO - Windows.exe" ]; then
# Calculate the MD5 checksum of Saving Princess - DEMO - Windows.exe
actual_checksum_demo=$(md5sum "$GAMEDIR/gamedata/Saving Princess - DEMO - Windows.exe" | awk '{print $1}')
# Extract demo
if [ -f "$GAMEDIR/assets/Saving Princess - DEMO - Windows.exe" ]; then
actual_checksum_demo=$(md5sum "$GAMEDIR/assets/Saving Princess - DEMO - Windows.exe" | awk '{print $1}')

# Check if the file exists and the checksum matches
if [ "$actual_checksum_demo" = "26f6e1a57b1ed89a7554ced8bd58f2bb" ]; then
# Change directory to the specified directory
cd "$GAMEDIR" || exit

# Use 7zip to extract the .exe file to the destination directory
"$GAMEDIR/tools/7zzs" x "$GAMEDIR/gamedata/Saving Princess - DEMO - Windows.exe" -o"$GAMEDIR/gamedata" & pid=$!

# Wait for the extraction process to complete
"$controlfolder/7zzs.${DEVICE_ARCH}" x "$GAMEDIR/assets/Saving Princess - DEMO - Windows.exe" -o"$GAMEDIR/assets" & pid=$!
wait $pid

# Check if Saving Princess - DEMO.exe file exists
if [ -f "$GAMEDIR/gamedata/Saving Princess - DEMO.exe" ]; then
# Delete the redundant .exe files
rm -f "$GAMEDIR/gamedata/Saving Princess - DEMO.exe"
rm -f "$GAMEDIR/gamedata/Saving Princess - DEMO - Windows.exe"
rm -f "$GAMEDIR/gamedata/D3DX9_43.dll"
fi
XDELTA_FILE="$TOOLDIR/demo.xdelta"
else
echo "Error: MD5 checksum of Saving Princess - DEMO - Windows.exe does not match the expected checksum."
exit 1
pm_message "Error: MD5 checksum of Saving Princess - DEMO - Windows.exe does not match the expected checksum."
fi
else
echo "Saving Princess - DEMO - Windows.exe not detected in /gamedata"
fi

# Check for file existence before trying to manipulate them:
[ -f "./gamedata/data.win" ] && mv gamedata/data.win gamedata/game.droid

# Check if there are any .ogg or .mp3 files in the ./gamedata directory
if [ -n "$(ls ./gamedata/*.ogg 2>/dev/null)" ]; then
# Create the ./assets directory if it doesn't exist
mkdir -p ./assets

# Move all .ogg files from ./gamedata to ./assets
mv ./gamedata/*.ogg ./assets/ 2>/dev/null
echo "Moved .ogg files from ./gamedata to ./assets/"

# Zip the contents of ./savingprincess.apk including the new audio files
zip -r -0 ./savingprincess.apk ./assets/
echo "Zipped contents to ./savingprincess.apk"

# Remove the assets directory
rm -Rf ./assets/
# Patch data.win and package game files
if [ -f "$GAMEDIR/assets/data.win" ]; then
# Apply the appropriate xdelta patch
$controlfolder/xdelta3 -d -s "$GAMEDIR/assets/data.win" "$XDELTA_FILE" "$GAMEDIR/assets/game.droid"
# Delete all redundant files
rm -f assets/*.{exe,dll,win,gitkeep}
# Zip all game files into game.port
zip -r -0 ./game.port ./assets/
rm -rf ./assets/
fi

# Splash Screen
if [ -f "$GAMEDIR/gamedata/splash.png" ]; then
# Calculate the MD5 checksum of gamedata/splash.png
splash_checksum=$(md5sum "$GAMEDIR/gamedata/splash.png" | awk '{print $1}')

# Check if the checksum does not match the expected value
if [ "$splash_checksum" != "53aa45e0edcdabcb8a8c50fd3a58970e" ]; then
# Copy the new splash.png from the main directory to gamedata
cp "$GAMEDIR/splash.png" "$GAMEDIR/gamedata/splash.png"
fi
# Display loading splash
if [ ! -d ./assets ]; then
$ESUDO "$GAMEDIR/tools/splash" "$GAMEDIR/splash.png" 4000 &
fi

$GPTOKEYB "gmloader" &

$ESUDO chmod +x "$GAMEDIR/gmloader"

./gmloader savingprincess.apk
# Assign configs and load the game
$GPTOKEYB "gmloadernext.aarch64" -c "savingprincess.gptk" &
pm_platform_helper "$GAMEDIR/gmloadernext.aarch64"
./gmloadernext.aarch64 -c "$GMLOADER_JSON"

$ESUDO kill -9 $(pidof gptokeyb)
$ESUDO systemctl restart oga_events &
printf "\033c" > /dev/tty0
# Cleanup
pm_finish
8 changes: 4 additions & 4 deletions ports/savingprincess/port.json
Copy link
Copy Markdown
Collaborator

@tabreturn tabreturn May 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are inst/Inst_md meant to be identical? Like, usually one would leave the _md entries as null (unless these had additional formatting)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okies have removed!

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
],
"desc": "You are Portia Crane, Asset Recovery Specialist.\nAll you know about your mission is:\n\"IF THEY GET PRINCESS, THE WAR IS LOST.\nIT'S UP TO YOU.\"\nExplore a space station crawling with rogue machines and even rival bounty hunters with the same objective as you - but with far, far different intentions!\nExpand your arsenal as you collect upgrades to your trusty arm cannon and armor!\nTest your might against several bosses - including a FREAKING SPACE NINJA!\nCan you SAVE PRINCESS?",
"desc_md": null,
"inst": "Head to https://brainos.itch.io/savingprincess.\nPurchase the game and download Saving Princess.exe and place it into ports/\nWorks with Saving Princess - DEMO - Windows.exe too!",
"inst_md": "Head to https://brainos.itch.io/savingprincess.\nPurchase the game and download Saving Princess.exe and place it into ports/\nWorks with Saving Princess - DEMO - Windows.exe too.",
"inst": "Head to https://brainos.itch.io/savingprincess. \nPurchase the game and download Saving Princess.exe and place it into ports/savingprincess/assets. \nWorks with Saving Princess - DEMO - Windows.exe too!",
"inst_md": null,
"genres": [
"adventure"
],
Expand All @@ -24,7 +24,7 @@
"runtime": null,
"reqs": [],
"arch": [
"armhf"
"aarch64"
]
}
}
}
144 changes: 0 additions & 144 deletions ports/savingprincess/savingprincess/LICENSE.7zzs.txt

This file was deleted.

Binary file added ports/savingprincess/savingprincess/game.port
Binary file not shown.
Binary file removed ports/savingprincess/savingprincess/gmloader
Binary file not shown.
12 changes: 12 additions & 0 deletions ports/savingprincess/savingprincess/gmloader.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"save_dir" : "saves",
"apk_path" : "game.port",
"show_cursor" : false,
"disable_controller" : false,
"disable_depth" : true,
"disable_extensions" : true,
"disable_rumble" : false,
"disable_texhack" : false,
"rumble_scale" : 4.0,
"force_platform" : "os_windows"
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading