Skip to content

Commit

Permalink
Merge pull request #1111 from Fraxinus88/discroom
Browse files Browse the repository at this point in the history
New Port Disc Room
  • Loading branch information
Cebion authored Jan 2, 2025
2 parents 003e998 + 563192b commit 94d5b1b
Show file tree
Hide file tree
Showing 27 changed files with 843 additions and 0 deletions.
65 changes: 65 additions & 0 deletions ports/discroom/Disc Room.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

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
export PORT_32BIT="Y"

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

GAMEDIR="/$directory/ports/discroom"

# Exports
export LD_LIBRARY_PATH="/usr/lib32:$GAMEDIR/libs:$LD_LIBRARY_PATH"
export GMLOADER_DEPTH_DISABLE=0
export GMLOADER_SAVEDIR="$GAMEDIR/gamedata/"
export GMLOADER_PLATFORM="os_windows"
export TOOLDIR="$GAMEDIR/tools"
export PATH=$PATH:$TOOLDIR
export PATCHER_FILE="$GAMEDIR/patch/patchscript"
export PATCHER_GAME="Disc Room"
export PATCHER_TIME="3 to 5 minutes"
export PATCHDIR=$GAMEDIR

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

# Permissions
$ESUDO chmod +x "$GAMEDIR/gmloader"
$ESUDO chmod +x "$TOOLDIR/splash"

cd "$GAMEDIR"

# Run install if needed
if [ ! -f "$GAMEDIR/gamedata/game.droid" ]; then
if [ -f "$controlfolder/utils/patcher.txt" ]; then
source "$controlfolder/utils/patcher.txt"
$ESUDO kill -9 $(pidof gptokeyb)
else
pm_message "This port requires the latest version of PortMaster."
fi
else
pm_message "Patching process already completed. Skipping."
fi

if [ ! -f "$GAMEDIR/gamedata/config.ini" ]; then
mv "$GAMEDIR/config.ini.default" "$GAMEDIR/gamedata/config.ini"
fi

$GPTOKEYB "gmloader" &

pm_platform_helper "$GAMEDIR/gmloader"
./gmloader game.apk

pm_finish
18 changes: 18 additions & 0 deletions ports/discroom/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Notes

Special thanks to [Terri](http://terriv.games/), [Dose](https://www.doseone.xyz/), [Kitty](https://x.com/kittycalis), and [JW](https://www.jwaaaap.com/) for making this awesome game!

Source: https://store.steampowered.com/app/1229580/Disc_Room/

## Controls

| Button | Action |
|--|--|
|D-pad / L-stick|Movement|
|A|Confirm / Ability|
|B |Back|
|Start|Pause / Menu|
|LB|Menu Left / FFW|
|RB|Menu Right / FFW|


Binary file added ports/discroom/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Binary file added ports/discroom/discroom/game.apk
Binary file not shown.
Empty file.
Binary file added ports/discroom/discroom/gamedata/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ports/discroom/discroom/gmloader
Binary file not shown.
Binary file added ports/discroom/discroom/libc++_shared.so
Binary file not shown.
Binary file added ports/discroom/discroom/libs/libcrypto.so.1.1
Binary file not shown.
Binary file added ports/discroom/discroom/libs/libssl.so.1.1
Binary file not shown.
Binary file added ports/discroom/discroom/libs/libzip.so.4
Binary file not shown.
Binary file added ports/discroom/discroom/patch/discroomgog.xdelta
Binary file not shown.
Binary file not shown.
111 changes: 111 additions & 0 deletions ports/discroom/discroom/patch/patchscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/bin/bash

# Set the log file
LOGFILE="$PATCHDIR/patchlog.txt"

# Redirect output and error to the log file
> "$LOGFILE" && exec > >(tee "$LOGFILE") 2>&1

echo "PATCHDIR is set to: $PATCHDIR"

# Exports
export TOOLDIR="$PATCHDIR/tools"
export TMPDIR="$PATCHDIR/tmp"
export PATH=$PATH:TOOLDIR
export LD_LIBRARY_PATH="/usr/lib:$PATCHDIR/libs:$TOOLDIR/libs:$LD_LIBRARY_PATH"

# Permissions
chmod 777 "$TOOLDIR/gmKtool.py"
chmod 777 "$TOOLDIR/oggdec"
chmod 777 "$TOOLDIR/oggenc"
chmod 777 "$TOOLDIR/xdelta3"

cd "$PATCHDIR"

process_game() {
# Array of files and patterns to delete
files_to_delete=(
"./gamedata/*.exe"
"./gamedata/*.dll"
"./gamedata/*.ico"
"./gamedata/gog*"
"./gamedata/unins000*"
)

# Loop through patterns and delete matching files
for pattern in "${files_to_delete[@]}"; do
# Expand the pattern into matching files
matches=$(find ./gamedata/ -path "$pattern" -type f 2>/dev/null)

if [[ -z "$matches" ]]; then
echo "No files found for pattern: $pattern"
else
for file in $matches; do
rm "$file"
echo "Deleted $file"
done
fi
done

# If "gamedata/data.win" exists and matches the checksum of the GOG or Steam versions
if [ -f "./gamedata/data.win" ]; then
checksum=$(md5sum "./gamedata/data.win" | awk '{print $1}')

# Checksum for the GOG version
if [ "$checksum" = "2194950ef1e18110653065efcb940244" ]; then
$ESUDO tools/xdelta3 -d -s gamedata/data.win -f ./patch/discroomgog.xdelta gamedata/game.droid && \
rm gamedata/data.win
echo "GOG data.win has been patched"
# Checksum for the Steam version
elif [ "$checksum" = "eb904bb033d7674894384151bd33a5be" ]; then
$ESUDO tools/xdelta3 -d -s gamedata/data.win -f ./patch/discroomsteam.xdelta gamedata/game.droid && \
rm gamedata/data.win
echo "Steam data.win has been patched"
else
echo "Error: MD5 checksum of data.win does not match any expected version."
fi
else
echo "Error: Missing data.win in gamedata folder or game has been patched."
fi

# Compress audio
if [ -f "$PATCHDIR/compress.txt" ]; then
echo "Compressing audio. The process will take 5-10 minutes" > $CUR_TTY
mkdir -p "$TMPDIR"
./tools/gmKtool.py -vv -m 262144 -b 64 -d "$TMPDIR" "$PATCHDIR/gamedata/game.droid"

if [ $? -eq 0 ]; then
mv $TMPDIR/* "$PATCHDIR/gamedata"
rm "$PATCHDIR/compress.txt"
rmdir "$TMPDIR"
echo "Audio compression applied successfully." > $CUR_TTY
else
echo "Audio compression failed." > $CUR_TTY
rm -rf "$TMPDIR"
fi
fi

sleep 3

# Check for .ogg files and move to APK
if [ -n "$(ls ./gamedata/*.ogg 2>/dev/null)" ]; then
mkdir -p ./assets
mv ./gamedata/*.ogg ./assets/
echo "Moved .ogg files to ./assets/"

zip -r -0 ./game.apk ./assets/
echo "Zipped contents to ./game.apk"

rm -rf ./assets
echo "Deleted assets directory"
else
echo "No .ogg files found"
fi

#Delete "Place game files here" and echo patching complete
rm -f "./gamedata/place game files here"
echo "Patching is complete!"
}

# Call the function
process_game
Loading

0 comments on commit 94d5b1b

Please sign in to comment.