Compare commits
3 commits
8297c6f8bc
...
1ac7e27638
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ac7e27638 | |||
| a743aa3851 | |||
| 9e30653e5b |
19 changed files with 224 additions and 43 deletions
9
.config example
Normal file
9
.config example
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# VERSION
|
||||||
|
VERSION=""
|
||||||
|
# NETWORKING
|
||||||
|
NET_KEYCHIP_ID=""
|
||||||
|
NET_HOSTNAME=""
|
||||||
|
# PORT BINDINGS
|
||||||
|
PORT_CONSOLE_LEFT=""
|
||||||
|
PORT_CONSOLE_RIGHT=""
|
||||||
|
PORT_AIME_READER=""
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
||||||
images/*
|
images/*
|
||||||
|
.config
|
||||||
43
applypatches.sh
Executable file
43
applypatches.sh
Executable file
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "Usage: $0 <profile>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
profile="$1"
|
||||||
|
|
||||||
|
source .config
|
||||||
|
source ./profiles/$profile/metadata
|
||||||
|
dir="/tmp/wacca/$profile"
|
||||||
|
PATCHES_DIR="./patches"
|
||||||
|
|
||||||
|
[ ! -d "$PATCHES_DIR" ] && { echo "Error: $PATCHES_DIR not found"; exit 1; }
|
||||||
|
|
||||||
|
# Change to patches directory and process files in numerical order
|
||||||
|
cd "$PATCHES_DIR" || exit 1
|
||||||
|
|
||||||
|
# Use ls with version sort to handle numbers correctly (1,2,3,10,50,etc.)
|
||||||
|
for script in $(ls -1v 2>/dev/null); do
|
||||||
|
[ -f "$script" ] && [ -r "$script" ] || continue
|
||||||
|
|
||||||
|
echo -e "\033[0;34m=== Applying: $script ===\033[0m"
|
||||||
|
|
||||||
|
# Create a named pipe for real-time output
|
||||||
|
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"
|
||||||
|
else
|
||||||
|
exit_code=$?
|
||||||
|
echo -e "\033[0;31m=== Failed: $script (exit code: $exit_code) ===\033[0m"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean up the pipe
|
||||||
|
rm -f "$pipe"
|
||||||
|
echo
|
||||||
|
done
|
||||||
22
downloadsegatools.sh
Executable file
22
downloadsegatools.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/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
|
||||||
|
|
@ -18,7 +18,8 @@ do
|
||||||
else
|
else
|
||||||
echo "Decrypting $file"
|
echo "Decrypting $file"
|
||||||
fsdecrypt images/app/$file
|
fsdecrypt images/app/$file
|
||||||
mv images/app/*.vhd images/vhd
|
mkdir -p images/vhd
|
||||||
|
mv images/app/*.vhd images/vhd/
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ ! -f images/vhd/$vhd ]; then
|
if [ ! -f images/vhd/$vhd ]; then
|
||||||
|
|
@ -27,7 +28,8 @@ do
|
||||||
|
|
||||||
echo "Decrypting $file"
|
echo "Decrypting $file"
|
||||||
fsdecrypt images/app/$file
|
fsdecrypt images/app/$file
|
||||||
|
mkdir -p images/vhd
|
||||||
mv images/app/*.vhd images/vhd
|
mv images/app/*.vhd images/vhd
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < profiles/$profile/apps.csv
|
done < profiles/$profile/apps.csv
|
||||||
|
|
|
||||||
4
generatetree.sh
Normal file → Executable file
4
generatetree.sh
Normal file → Executable file
|
|
@ -5,6 +5,8 @@ if [ $# -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
profile="$1"
|
profile="$1"
|
||||||
|
rm -r images/tree/$profile
|
||||||
|
mkdir -p images/tree/$profile
|
||||||
while IFS=, read -r vhd version identifier backingversion parent_identifier parent_filename
|
while IFS=, read -r vhd version identifier backingversion parent_identifier parent_filename
|
||||||
do
|
do
|
||||||
match=0
|
match=0
|
||||||
|
|
@ -22,4 +24,4 @@ do
|
||||||
echo "End of chain $vhd"
|
echo "End of chain $vhd"
|
||||||
ln -s $(pwd)/images/vhd/$vhd images/tree/$profile/"game.vhd"
|
ln -s $(pwd)/images/vhd/$vhd images/tree/$profile/"game.vhd"
|
||||||
fi
|
fi
|
||||||
done < images/lookup/phase1_$1.csv
|
done < images/lookup/phase1_$1.csv
|
||||||
|
|
|
||||||
8
launch.sh
Executable file
8
launch.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "Usage: $0 <profile>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
profile="$1"
|
||||||
|
|
||||||
|
WINEPREFIX=/tmp/wacca/$profile/prefix umu-run /tmp/wacca/$profile/game/bin/launch.bat
|
||||||
15
mountprofile.sh
Executable file
15
mountprofile.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "Usage: $0 <profile>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
profile="$1"
|
||||||
|
|
||||||
|
mkdir -p /tmp/wacca/$profile/{dev,lower,upper,game,work}
|
||||||
|
mkdir -p /tmp/wacca/$profile/lower
|
||||||
|
mkdir -p /tmp/wacca/$profile/upper
|
||||||
|
mkdir -p /tmp/wacca/$profile/game
|
||||||
|
sudo vhdimount images/tree/$profile/game.vhd /tmp/wacca/$profile/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
|
||||||
22
patches/10-segatools.sh
Executable file
22
patches/10-segatools.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
||||||
|
if [ -z ${dir+x} ]; then echo "\$dir not set, skipping."; exit 22; else
|
||||||
|
wget https://gitea.tendokyu.moe/TeamTofuShop/segatools/releases/download/latest/segatools.zip -O /tmp/segatools.zip
|
||||||
|
mkdir -p $dir/segatools/{amfs,appdata,option}
|
||||||
|
unzip -p /tmp/segatools.zip mercury.zip | bsdtar -xf- -C $dir/game/bin
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i '/^\[vfs\]/,/^\[/ {
|
||||||
|
/^amfs=/c\amfs=..\\\\..\\\\segatools\\\\amfs
|
||||||
|
/^option=/c\option=..\\\\..\\\\segatools\\\\option
|
||||||
|
/^appdata=/c\appdata=..\\\\..\\\\segatools\\\\appdata
|
||||||
|
}' $dir/game/bin/segatools.ini
|
||||||
|
|
||||||
|
if [ -z ${PORT_AIME_READER+x} ]; then echo "\$Card reader binding not set, skipping."; else
|
||||||
|
echo "Card reader binding set, disabling card reader assembly emulation"
|
||||||
|
sed -i '/^\[aime\]/,/^enable=1/ s/^enable=1/enable=0/' $dir/game/bin/segatools.ini
|
||||||
|
fi
|
||||||
|
if [ -z ${PORT_CONSOLE_LEFT+x} ]; then echo "\$Left console binding not set, skipping."; else
|
||||||
|
if [ -z ${PORT_CONSOLE_RIGHT+x} ]; then echo "\$Right console binding not set, skipping."; else
|
||||||
|
echo "Console binding set, disabling mercuryio touch hooks"
|
||||||
|
sed -i '/^\[touch\]/,/^enable=1/ s/^enable=1/enable=0/' $dir/game/bin/segatools.ini
|
||||||
|
fi
|
||||||
|
fi
|
||||||
5
patches/11-icf.sh
Normal file
5
patches/11-icf.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
if [ -z ${dir+x} ]; then echo "\$dir not set, skipping."; exit 22; else
|
||||||
|
if [ -z ${icf+x} ]; then echo "ICF url not set, skipping."; else
|
||||||
|
wget $icf -O $dir/segatools/amfs/ICF1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
12
patches/11-networking.sh
Normal file
12
patches/11-networking.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
if [ -z ${NET_HOSTNAME+x} ]; then
|
||||||
|
echo "Server hostname not set, skipping.";
|
||||||
|
sed -i '/^\[\/Script\/Mercury.MercuryNetworkSettings\]/,/^OfflineMode=false/ s/^OfflineMode=false/OfflineMode=true/' $dir/game/WindowsNoEditor/Mercury/Config/DefaultHardware.ini
|
||||||
|
else
|
||||||
|
if [ -z ${NET_KEYCHIP_ID+x} ]; then
|
||||||
|
echo "Keychip id not set, skipping.";
|
||||||
|
sed -i '/^\[\/Script\/Mercury.MercuryNetworkSettings\]/,/^OfflineMode=false/ s/^OfflineMode=false/OfflineMode=true/' $dir/game/WindowsNoEditor/Mercury/Config/DefaultHardware.ini
|
||||||
|
else
|
||||||
|
sed -i "/^\[dns\]/,/^default=127.0.0.1/ s/^default=127.0.0.1/default=$NET_HOSTNAME/" $dir/game/bin/segatools.ini
|
||||||
|
sed -i "/^\[keychip\]/,/^id=A69E-01A88888888/ s/^id=A69E-01A88888888/id=$NET_KEYCHIP_ID/" $dir/game/bin/segatools.ini
|
||||||
|
fi
|
||||||
|
fi
|
||||||
3
patches/15-ledstub.sh
Executable file
3
patches/15-ledstub.sh
Executable file
|
|
@ -0,0 +1,3 @@
|
||||||
|
sed -i '/^\[elisabeth\]/,/^enable=1/ s/^enable=1/enable=0/' $dir/game/bin/segatools.ini
|
||||||
|
cp ../wacca_led.dll $dir/game/WindowsNoEditor/Mercury/Plugins/ElizabethPlugin/Source/LEDDevice/Source/Runtime/Public/Externals/USBIntLED.DLL
|
||||||
|
rm $dir/game/WindowsNoEditor/Mercury/Plugins/ElizabethPlugin/Source/LEDDevice/Source/Runtime/Public/Externals/USBIntLED_.DLL
|
||||||
5
patches/15-openssl.sh
Normal file
5
patches/15-openssl.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
if [ -z ${dir+x} ]; then echo "\$dir not set, skipping."; exit 22; else
|
||||||
|
if grep -q "set OPENSSL_ia32cap=:~0x20000000" $dir/game/bin/launch.bat; then echo "Patch already present in file, skipping."; else
|
||||||
|
sed -i '/@echo off/Ia set OPENSSL_ia32cap=:~0x20000000' $dir/game/bin/launch.bat
|
||||||
|
fi
|
||||||
|
fi
|
||||||
5
patches/15-wacca1-fixname.sh
Normal file
5
patches/15-wacca1-fixname.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
if [[ "$version" == "1.00" || "$version" == "1.50" ]]; then
|
||||||
|
sed -i 's/Mercury-Win64-Shipping.exe/Mercury.exe/g' $dir/game/bin/launch.bat
|
||||||
|
else
|
||||||
|
echo "Patch not applicable to specified version, skipping."
|
||||||
|
fi
|
||||||
10
patches/5-pfx.sh
Executable file
10
patches/5-pfx.sh
Executable file
|
|
@ -0,0 +1,10 @@
|
||||||
|
if [ -z ${PORT_CONSOLE_LEFT+x} ]; then echo "Left console binding not set, skipping."; else
|
||||||
|
WINEPREFIX=$dir/prefix umu-run reg add "HKEY_LOCAL_MACHINE\\Software\\Wine\\Ports" /f /v COM3 /t REG_SZ /d "$PORT_CONSOLE_LEFT" #Console touch left
|
||||||
|
fi
|
||||||
|
if [ -z ${PORT_CONSOLE_RIGHT+x} ]; then echo "Right console binding not set, skipping."; else
|
||||||
|
WINEPREFIX=$dir/prefix umu-run reg add "HKEY_LOCAL_MACHINE\\Software\\Wine\\Ports" /f /v COM4 /t REG_SZ /d "$PORT_CONSOLE_RIGHT" #Console touch right
|
||||||
|
fi
|
||||||
|
if [ -z ${PORT_AIME_READER+x} ]; then echo "Card reader binding not set, skipping."; else
|
||||||
|
WINEPREFIX=$dir/prefix umu-run reg add "HKEY_LOCAL_MACHINE\\Software\\Wine\\Ports" /f /v COM1 /t REG_SZ /d "$PORT_AIME_READER" #aime reader
|
||||||
|
fi
|
||||||
|
|
||||||
3
patches/50-disablenetenv.sh
Executable file
3
patches/50-disablenetenv.sh
Executable file
|
|
@ -0,0 +1,3 @@
|
||||||
|
cp -r $dir/game/bin/segatools.ini $dir/game/bin/segatools-netenv.ini
|
||||||
|
sed -i '/^\[netenv\]/,/^enable=1/ s/^enable=1/enable=0/' $dir/game/bin/segatools-netenv.ini
|
||||||
|
sed -i '/inject -d -k mercuryhook.dll ..\/WindowsNoEditor\/Mercury\/Binaries\/Win64/i set SEGATOOLS_CONFIG_PATH=./segatools-netenv.ini' $dir/game/bin/launch.bat
|
||||||
11
unmountprofile.sh
Executable file
11
unmountprofile.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "Usage: $0 <profile>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
profile="$1"
|
||||||
|
|
||||||
|
sudo umount /tmp/wacca/$profile/game
|
||||||
|
sudo umount /tmp/wacca/$profile/lower
|
||||||
|
sudo fusermount -u /tmp/wacca/$profile/dev
|
||||||
81
versionselect.sh
Normal file → Executable file
81
versionselect.sh
Normal file → Executable file
|
|
@ -1,42 +1,45 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
versions=()
|
selectversion() {
|
||||||
count=0
|
versions=()
|
||||||
for profile_dir in profiles/*/; do
|
count=0
|
||||||
# Remove the trailing slash to get clean directory name
|
for profile_dir in profiles/*/; do
|
||||||
count=$[count+1]
|
# Remove the trailing slash to get clean directory name
|
||||||
echo $profile_dir
|
count=$[count+1]
|
||||||
source $profile_dir/metadata
|
echo $profile_dir
|
||||||
echo $prettyname
|
source $profile_dir/metadata
|
||||||
versions+=("$version" "$prettyname")
|
echo $prettyname
|
||||||
done
|
versions+=("$version" "$prettyname")
|
||||||
exec 3>&1;
|
done
|
||||||
sel=$(dialog --menu "Select major version" 20 60 10 "${versions[@]}" 2>&1 1>&3)
|
exec 3>&1;
|
||||||
for profile_dir in profiles/*/; do
|
sel=$(dialog --menu "Select major version" 20 60 10 "${versions[@]}" 2>&1 1>&3)
|
||||||
source $profile_dir/metadata
|
for profile_dir in profiles/*/; do
|
||||||
if [[ "$sel" == "$version" ]]; then
|
source $profile_dir/metadata
|
||||||
profile=$(basename $profile_dir)
|
if [[ "$sel" == "$version" ]]; then
|
||||||
versions2=()
|
profile=$(basename $profile_dir)
|
||||||
count=0
|
versions2=()
|
||||||
while IFS=, read -r vhd version identifier backingversion parent_identifier parent_filename
|
count=0
|
||||||
do
|
while IFS=, read -r vhd version identifier backingversion parent_identifier parent_filename
|
||||||
echo $vhd
|
do
|
||||||
count=$[count+1]
|
echo $vhd
|
||||||
versions2+=("$version" "$vhd")
|
count=$[count+1]
|
||||||
done < images/lookup/phase1_$profile.csv
|
versions2+=("$version" "$vhd")
|
||||||
echo "${versions2[@]}"
|
done < images/lookup/phase1_$profile.csv
|
||||||
exec 3>&1;
|
exec 3>&1;
|
||||||
sel=$(dialog --menu "Select an item:" 20 60 10 "${versions2[@]}" 2>&1 1>&3)
|
sel=$(dialog --menu "Select an item:" 20 60 10 "${versions2[@]}" 2>&1 1>&3)
|
||||||
echo $sel
|
sed -i "s/VERSION=.*/VERSION=\"$sel\"/" .config
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# profile="$1"
|
}
|
||||||
# versions=()
|
|
||||||
# count=0
|
setserver() {
|
||||||
# while IFS=, read -r vhd version identifier backingversion parent_identifier parent_filename
|
source .config
|
||||||
# do
|
exec 3>&1;
|
||||||
# count=$[count+1]
|
hostname=$(dialog --inputbox "Modify server hostname" 10 30 "${NET_HOSTNAME:-hostname.tld}" 2>&1 1>&3)
|
||||||
# versions+=("$count" "$version")
|
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)
|
||||||
# done < images/lookup/phase1_$1.csv
|
sed -i "s/NET_HOSTNAME=.*/NET_HOSTNAME=\"$hostname\"/" .config
|
||||||
# dialog --menu "Select an item:" 20 60 10 "${versions[@]}"
|
sed -i "s/NET_KEYCHIP_ID=.*/NET_KEYCHIP_ID=\"$keychip\"/" .config
|
||||||
|
}
|
||||||
|
setserver
|
||||||
|
# selectversion
|
||||||
BIN
wacca_led.dll
Normal file
BIN
wacca_led.dll
Normal file
Binary file not shown.
Loading…
Reference in a new issue