This commit is contained in:
Kyan 2025-10-02 13:30:32 +02:00 committed by Kyan Wanschers
parent 8712807dec
commit 4b8db8e2ab
8 changed files with 98 additions and 61 deletions

9
.config example Normal file
View file

@ -0,0 +1,9 @@
# VERSION
VERSION=""
# NETWORKING
NET_KEYCHIP_ID=""
NET_HOSTNAME=""
# PORT BINDINGS
PORT_CONSOLE_LEFT=""
PORT_CONSOLE_RIGHT=""
PORT_AIME_READER=""

1
.gitignore vendored
View file

@ -1 +1,2 @@
images/*
.config

View file

@ -7,6 +7,7 @@ fi
profile="$1"
source .config
source ./profiles/$profile/metadata
dir="/tmp/wacca/$profile"
PATCHES_DIR="./patches"
@ -22,26 +23,21 @@ for script in $(ls -1v 2>/dev/null); do
echo -e "\033[0;34m=== Applying: $script ===\033[0m"
# Use a temporary file to capture exit status and output
temp_file=$(mktemp)
# Create a named pipe for real-time output
pipe=$(mktemp -u)
mkfifo "$pipe"
# Source the script and capture both stdout and stderr
if (source "$script") > "$temp_file" 2>&1; then
# Script succeeded - output with script name prefix
while IFS= read -r line; do
# Execute the script with real-time output
if (source "$script" 2>&1 | while IFS= read -r line; do
echo "[$script] $line"
done < "$temp_file"
done); then
echo -e "\033[0;32m=== Successfully applied: $script ======\033[0m"
else
exit_code=$?
# Script failed - output with script name prefix and error message
while IFS= read -r line; do
echo "[$script] $line"
done < "$temp_file"
echo -e "\033[0;31m=== Failed: $script (exit code: $exit_code) ===\033[0m"
fi
rm -f "$temp_file"
# Clean up the pipe
rm -f "$pipe"
echo
done

View file

@ -1,2 +0,0 @@
sed -i '/^\[\/Script\/Mercury.MercuryNetworkSettings\]/,/^OfflineMode=false/ s/^OfflineMode=false/OfflineMode=true/' $dir/game/WindowsNoEditor/Mercury/Config/DefaultHardware.ini

View file

@ -9,3 +9,14 @@ sed -i '/^\[vfs\]/,/^\[/ {
/^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

12
patches/11-networking.sh Normal file
View 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

View file

@ -1,3 +1,10 @@
WINEPREFIX=$dir/prefix umu-run reg add "HKEY_LOCAL_MACHINE\\Software\\Wine\\Ports" /f /v COM1 /t REG_SZ /d "/dev/tnt0" #aime reader
WINEPREFIX=$dir/prefix umu-run reg add "HKEY_LOCAL_MACHINE\\Software\\Wine\\Ports" /f /v COM3 /t REG_SZ /d "/dev/tnt2" #Console touch left
WINEPREFIX=$dir/prefix umu-run reg add "HKEY_LOCAL_MACHINE\\Software\\Wine\\Ports" /f /v COM4 /t REG_SZ /d "/dev/tnt4" #Console touch right
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

View file

@ -1,6 +1,7 @@
#!/bin/bash
selectversion() {
versions=()
count=0
for profile_dir in profiles/*/; do
@ -25,18 +26,20 @@ for profile_dir in profiles/*/; do
count=$[count+1]
versions2+=("$version" "$vhd")
done < images/lookup/phase1_$profile.csv
echo "${versions2[@]}"
exec 3>&1;
sel=$(dialog --menu "Select an item:" 20 60 10 "${versions2[@]}" 2>&1 1>&3)
echo $sel
sed -i "s/VERSION=.*/VERSION=\"$sel\"/" .config
fi
done
# profile="$1"
# versions=()
# count=0
# while IFS=, read -r vhd version identifier backingversion parent_identifier parent_filename
# do
# count=$[count+1]
# versions+=("$count" "$version")
# done < images/lookup/phase1_$1.csv
# dialog --menu "Select an item:" 20 60 10 "${versions[@]}"
}
setserver() {
source .config
exec 3>&1;
hostname=$(dialog --inputbox "Modify server hostname" 10 30 "${NET_HOSTNAME:-hostname.tld}" 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
}
setserver
# selectversion