55 lines
2.3 KiB
Bash
Executable file
55 lines
2.3 KiB
Bash
Executable file
#!/bin/bash
|
|
# SAUCE: https://github.com/Raymonf/whack/blob/master/MercuryPatcher/index.html
|
|
set -e
|
|
|
|
disable_lockout=${BINPATCH_DISABLE_LOCKOUT:-false}
|
|
force_engine_locale=${BINPATCH_FORCE_ENGINE_LOCALE:-false}
|
|
allow_chn_region=${BINPATCH_ALLOW_CHN_REGION:-false}
|
|
force_hidden_luin_title=${BINPATCH_FORCE_HIDDEN_LUIN_TITLE:-false}
|
|
|
|
file=$dir/game/WindowsNoEditor/Mercury/Binaries/Win64/Mercury-Win64-Shipping.exe
|
|
|
|
patch () {
|
|
local offbytes=$1
|
|
local onbytes=$2
|
|
local len=${#offbytes}
|
|
local result=$(((len / 2)))
|
|
local offset=$3
|
|
local enable=$4
|
|
local description=$5
|
|
|
|
local byte_value=$(dd if="$file" bs=1 count=$result skip=$offset 2>/dev/null | hexdump -v -e '/1 "%02X"')
|
|
if [ "$byte_value" = "$offbytes" ]; then
|
|
echo -n "[$description] Patch disabled"
|
|
if [ "$enable" = true ]; then
|
|
echo "$onbytes" | sed 's/\([0-9A-F]\{2\}\)/\\x\1/g' | xargs -0 printf | dd of="$file" bs=1 count=$result seek=$offset conv=notrunc 2>/dev/null
|
|
echo -e " -> \u001b[1menabled\u001b[22m"
|
|
else
|
|
echo ""
|
|
fi
|
|
elif [ "$byte_value" = "$onbytes" ]; then
|
|
echo -n "[$description] Patch enabled"
|
|
if [ "$enable" = false ]; then
|
|
echo "$offbytes" | sed 's/\([0-9A-F]\{2\}\)/\\x\1/g' | xargs -0 printf | dd of="$file" bs=1 count=$result seek=$offset conv=notrunc 2>/dev/null
|
|
echo -e " -> \u001b[1mdisabled\u001b[22m"
|
|
else
|
|
echo ""
|
|
fi
|
|
else
|
|
echo "Patch not applicable - byte is 0x$byte_value (expected 0x$offbytes or 0x$onbytes)"
|
|
fi
|
|
}
|
|
|
|
if [ "$VERSION" = "3.07.01" ]; then
|
|
patch E82B5AE4FF4533C0418D5004488BCBE80CACEDFF84C07512BA06 909090909090909090909090909090909090909090909090BA00 5175664 $disable_lockout "Fully disable lockout 0"
|
|
patch BA02 BA00 5175718 $disable_lockout "Fully disable lockout 1"
|
|
patch 488D552048 E979FFFFFF 5175794 $disable_lockout "Fully disable lockout 2"
|
|
|
|
patch 7407 9090 5603668 $force_engine_locale "Force Engine locale (ignore router country language)"
|
|
|
|
patch 75 EB 32682167 $allow_chn_region "Allow using CHN region (don't change to HKG)"
|
|
|
|
patch 74 EB 5181434 $force_hidden_luin_title "Force enable Hidden Luin title screen"
|
|
else
|
|
echo "Binary patches not applicable to $VERSION, skipping..."
|
|
fi
|