yay
This commit is contained in:
parent
85685dfd4c
commit
9cd067b670
9 changed files with 70 additions and 101 deletions
|
|
@ -1,4 +1,5 @@
|
|||
WORKDIR="/tmp/wacca"
|
||||
MOUNT_AS_ROOT=true
|
||||
# VERSION
|
||||
VERSION=""
|
||||
# NETWORKING
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ for script in $(ls -1v 2>/dev/null); do
|
|||
echo "[$script] $line"
|
||||
done); then
|
||||
echo -e "\033[0;32m=== Successfully applied: $script ======\033[0m"
|
||||
echo "$script" >> $dir/patches
|
||||
else
|
||||
exit_code=$?
|
||||
echo -e "\033[0;31m=== Failed: $script (exit code: $exit_code) ===\033[0m"
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
IFS='_' read -r game version timestamp internalid subversion <<< "SDFE_2.50.00_20210129180947_1_2.00.00"
|
||||
echo $component
|
||||
mkdir imagestore/binding/$game/
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
#!/bin/bash
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 <profile>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
profile="$1"
|
||||
while IFS=, read -r version backingversion url
|
||||
do
|
||||
vhd=$(basename "$url" | sed -E "s/.app/.vhd/")
|
||||
if [ -f "images/vhd/$vhd" ]; then
|
||||
input=$(vhdiinfo images/vhd/$vhd)
|
||||
|
||||
identifier=$(echo "$input" | grep -i "Identifier" | head -1 | awk '{print $NF}')
|
||||
parent_identifier=$(echo "$input" | grep -i "Parent identifier" | awk '{print $NF}')
|
||||
parent_filename=$(echo "$input" | grep -i "Parent filename" | awk -F': ' '{print $2}')
|
||||
|
||||
echo $vhd,$version,$identifier,$backingversion,$parent_identifier,$parent_filename >> images/lookup/phase1_$1.csv
|
||||
else
|
||||
echo "images/vhd/$vhd not found"
|
||||
fi
|
||||
done < profiles/$profile/apps.csv
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
#!/bin/bash
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 <profile>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
profile="$1"
|
||||
wget https://gitea.tendokyu.moe/TeamTofuShop/segatools/releases/download/latest/segatools.zip -O /tmp/segatools.zip
|
||||
unzip -p /tmp/segatools.zip mercury.zip | bsdtar -xf- -C /tmp/wacca/$profile/game/bin
|
||||
mkdir -p /tmp/wacca/$profile/segatools/{amfs,appdata,option}
|
||||
source profiles/$profile/metadata
|
||||
wget $icf -O /tmp/wacca/$profile/segatools/amfs/ICF1
|
||||
|
||||
# [vfs]
|
||||
# ; Insert the path to the game AMFS directory here (contains ICF1 and ICF2)
|
||||
# amfs=..\\..\\segatools\amfs
|
||||
# ; Insert the path to the game Option directory here (unused in Mercury)
|
||||
# option=..\\..\\segatools\option
|
||||
# ; Create an empty directory somewhere and insert the path here.
|
||||
# ; This directory may be shared between multiple SEGA games.
|
||||
# ; NOTE: This has nothing to do with Windows %APPDATA%.
|
||||
# appdata=..\\..\\segatools\appdata
|
||||
79
genbind.sh
79
genbind.sh
|
|
@ -44,7 +44,7 @@ get_required_app () {
|
|||
extract_apps () {
|
||||
mkdir -p imagestore/vhd
|
||||
for url in ${apps//,/ }; do
|
||||
file=$(basename "$url")
|
||||
local file=$(basename "$url")
|
||||
local vhd=$(basename "$url" | sed -E "s/.app/.vhd/")
|
||||
if [ -f imagestore/app/$file ]; then
|
||||
echo "Found $file"
|
||||
|
|
@ -81,43 +81,84 @@ patchbin () {
|
|||
IFS='_' read gameid version date vhdpos parentversion <<< "${file%.app}"
|
||||
if [[ "$vhdpos" != "0" ]]; then
|
||||
local vhd=$(basename "$url" | sed -E "s/.app/.vhd/")
|
||||
input=$(vhdiinfo imagestore/vhd/$vhd)
|
||||
local input=$(vhdiinfo imagestore/vhd/$vhd)
|
||||
|
||||
identifier=$(echo "$input" | grep -i "Identifier" | head -1 | awk '{print $NF}')
|
||||
parent_identifier=$(echo "$input" | grep -i "Parent identifier" | awk '{print $NF}')
|
||||
parent_filename=$(echo "$input" | grep -i "Parent filename" | awk -F': ' '{print $2}')
|
||||
local identifier=$(echo "$input" | grep -i "Identifier" | head -1 | awk '{print $NF}')
|
||||
local parent_identifier=$(echo "$input" | grep -i "Parent identifier" | awk '{print $NF}')
|
||||
local parent_filename=$(echo "$input" | grep -i "Parent filename" | awk -F': ' '{print $2}')
|
||||
echo "Checking $vhd parent"
|
||||
if [[ ! "$parent_filename" =~ ^\\SDFE ]]; then
|
||||
if [[ ! "$parent_filename" =~ ^SDFE ]]; then
|
||||
echo "$vhd Parent filename incorrect"
|
||||
new_parent_filename=$(grep "^$parentversion" imagestore/index.csv | cut -d',' -f2 | xargs basename | sed -E "s/.app/.vhd/")
|
||||
new_parent_filename="\\$new_parent_filename"
|
||||
local new_parent_filename=$(grep "^$parentversion" imagestore/index.csv | cut -d',' -f2 | xargs basename | sed -E "s/.app/.vhd/")
|
||||
local len=${#new_parent_filename}
|
||||
result=$(((len * 2)))
|
||||
local result=$(((len * 2)))
|
||||
echo "Writing parent filename $new_parent_filename to $vhd"
|
||||
echo $new_parent_filename | iconv -f UTF-8 -t UTF-16BE | dd of=imagestore/vhd/$vhd seek=576 bs=1 conv=notrunc
|
||||
echo $new_parent_filename | iconv -f UTF-8 -t UTF-16BE | dd of=imagestore/vhd/$vhd seek=4096 bs=1 conv=notrunc
|
||||
echo -n $new_parent_filename | iconv -f UTF-8 -t UTF-16BE | dd of=imagestore/vhd/$vhd seek=576 bs=1 conv=notrunc
|
||||
echo -n $new_parent_filename | iconv -f UTF-8 -t UTF-16BE | dd of=imagestore/vhd/$vhd seek=4096 bs=1 conv=notrunc
|
||||
if [ $result -lt 80 ]; then
|
||||
remainder=$((80 - result))
|
||||
local remainder=$((80 - result))
|
||||
dd if=/dev/zero of=imagestore/vhd/$vhd seek=$((576 + result)) bs=1 count=$remainder conv=notrunc
|
||||
dd if=/dev/zero of=imagestore/vhd/$vhd seek=$((4096 + result)) bs=1 count=$remainder conv=notrunc
|
||||
fi # echo $parent_filename
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
mount () {
|
||||
vhdpath=$(grep "^$version" imagestore/index.csv | cut -d',' -f2 | xargs basename | sed -E "s/.app/.vhd/")
|
||||
|
||||
if [ "$MOUNT_AS_ROOT" = false ]; then
|
||||
sudo=""
|
||||
else
|
||||
sudo="sudo"
|
||||
fi
|
||||
local vhdpath=$(grep "^$version" imagestore/index.csv | cut -d',' -f2 | xargs basename | sed -E "s/.app/.vhd/")
|
||||
mkdir -p $workdir/$version/{dev,lower,upper,game,work}
|
||||
vhdimount imagestore/vhd/$vhdpath $workdir/$version/dev
|
||||
# sudo mount -t ntfs -o offset=$((2048*512)),uid=$(id -u),gid=$(id -g) $(sudo find /tmp/wacca/$profile/dev -maxdepth 1 -type f | sort -V | tail -1) /tmp/wacca/$profile/lower
|
||||
# sudo mount overlay -t overlay -o lowerdir=/tmp/wacca/$profile/lower,upperdir=/tmp/wacca/$profile/upper,workdir=/tmp/wacca/$profile/work /tmp/wacca/$profile/game
|
||||
$sudo vhdimount imagestore/vhd/$vhdpath $workdir/$version/dev
|
||||
$sudo mount -t ntfs -o offset=$((2048*512)),uid=$(id -u),gid=$(id -g) $($sudo find $workdir/$version/dev -maxdepth 1 -type f | sort -V | tail -1) $workdir/$version/$profile/lower
|
||||
$sudo mount overlay -t overlay -o lowerdir=$workdir/$version/lower,upperdir=$workdir/$version/upper,workdir=$workdir/$version/work $workdir/$version/game
|
||||
}
|
||||
|
||||
apply_patches () {
|
||||
# Temp shit
|
||||
icf="https://archive.org/download/WACCA/EXP/3.00.00%20USB/SDFE_ACA.icf"
|
||||
|
||||
dir=$workdir/$version
|
||||
|
||||
cd ./patches
|
||||
for script in $(ls -1v 2>/dev/null); do
|
||||
grep -qxF "$script" "$dir/patches";
|
||||
[ -f "$script" ] && [ -r "$script" ] || continue
|
||||
if ! grep -qxF "$script" "$dir/patches"; then
|
||||
|
||||
echo -e "\033[0;34m=== Applying: $script ===\033[0m"
|
||||
|
||||
# Create a named pipe for real-time output
|
||||
local pipe=$(mktemp -u)
|
||||
mkfifo "$pipe"
|
||||
|
||||
# Execute the script with real-time output
|
||||
if (source "$script" 2>&1 | while IFS= read -r line; do
|
||||
echo "[$script] $line"
|
||||
done); then
|
||||
echo -e "\033[0;32m=== Successfully applied: $script ===\033[0m"
|
||||
echo "$script" >> $dir/patches
|
||||
else
|
||||
exit_code=$?
|
||||
echo -e "\033[0;31m=== Failed: $script (exit code: $exit_code) ===\033[0m"
|
||||
fi
|
||||
else
|
||||
echo -e "\033[0;33m=== Skipping: $script ===\033[0m"
|
||||
fi
|
||||
# Clean up the pipe
|
||||
rm -f "$pipe"
|
||||
echo
|
||||
done
|
||||
}
|
||||
|
||||
check_prereqs
|
||||
get_required_app
|
||||
extract_apps
|
||||
patchbin
|
||||
mount
|
||||
# mount
|
||||
apply_patches
|
||||
# patchbin "images/vhd/SDFE_2.53.00_20210607052915_3_2.52.00.vhd.old"
|
||||
6
unmount.sh
Executable file
6
unmount.sh
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
source .config
|
||||
|
||||
sudo umount /tmp/wacca/$profile/game
|
||||
sudo umount /tmp/wacca/$profile/lower
|
||||
sudo fusermount -u /tmp/wacca/$profile/dev
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
#!/bin/bash
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 <profile>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
profile="$1"
|
||||
while IFS=, read -r version backingversion url
|
||||
do
|
||||
vhd=$(basename "$url" | sed -E "s/.app/.vhd/")
|
||||
if [ -f "images/vhd/$vhd" ]; then
|
||||
input=$(vhdiinfo images/vhd/$vhd)
|
||||
|
||||
identifier=$(echo "$input" | grep -i "Identifier" | head -1 | awk '{print $NF}')
|
||||
parent_identifier=$(echo "$input" | grep -i "Parent identifier" | awk '{print $NF}')
|
||||
parent_filename=$(echo "$input" | grep -i "Parent filename" | awk -F': ' '{print $2}')
|
||||
if [ -n "$(printf "%s" "$parent_filename" | tr -d '\000-\177')" ]; then
|
||||
echo "Parent filename contains non-ASCII characters"
|
||||
str=$(strings -e l images/vhd/$vhd | head -n 1)
|
||||
be=$(echo -n $str | iconv -f UTF-8 -t UTF-16BE | xxd -p -c1 | tr -d '\n ' | sed 's/../\\x&/g')
|
||||
le=$(echo -n $str | iconv -f UTF-8 -t UTF-16LE | xxd -p -c1 | tr -d '\n ' | sed 's/../\\x&/g')
|
||||
mv images/vhd/$vhd images/vhd/$vhd.old
|
||||
bbe -e "s/$le/$be/" images/vhd/$vhd.old | pv -s $(stat --printf="%s" images/vhd/$vhd.old) > images/vhd/$vhd
|
||||
|
||||
echo $parent_filename
|
||||
|
||||
else
|
||||
echo "Parent filename contains only ASCII characters"
|
||||
fi
|
||||
else
|
||||
echo "images/vhd/$vhd not found"
|
||||
fi
|
||||
|
||||
done < profiles/$profile/apps.csv
|
||||
|
|
@ -36,7 +36,8 @@ selectversion() {
|
|||
setserver() {
|
||||
source .config
|
||||
exec 3>&1;
|
||||
hostname=$(dialog --inputbox "Modify server hostname" 10 30 "${NET_HOSTNAME:-hostname.tld}" 2>&1 1>&3)
|
||||
|
||||
hostname=$(dialog --title "Network" --inputbox "Server Hostname" 10 30 "${NET_HOSTNAME:-}" 2>&1 1>&3)
|
||||
keychip=$(dialog --inputbox "Modify keychip id" 10 30 "${NET_KEYCHIP_ID:-A$(printf "%02d" $((RANDOM % 100)))$(shuf -e E X | head -n1)-$(shuf -e 01 20 | head -n1)$(shuf -e A B C D U | head -n1)$(tr -dc 0-9 </dev/urandom | head -c 8)}" 2>&1 1>&3)
|
||||
sed -i "s/NET_HOSTNAME=.*/NET_HOSTNAME=\"$hostname\"/" .config
|
||||
sed -i "s/NET_KEYCHIP_ID=.*/NET_KEYCHIP_ID=\"$keychip\"/" .config
|
||||
|
|
|
|||
Loading…
Reference in a new issue