-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch.sh
executable file
·87 lines (68 loc) · 1.94 KB
/
patch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
CONTENTROOT=Content
RESTORE=Patches/Restore/Content
apply() {
if [ -d "$RESTORE" ]; then
echo "Error: need to restore before patching again"
return
fi
mkdir -p "$RESTORE"
find Patches/Content -type f -name "*.patch" | while read patch; do
local patchfile=${patch#Patches/Content/}
local file=${patchfile%.patch}
if [[ $patchfile == *disabled* ]]; then
echo "Skipping patchfile $file"
continue
fi
echo "$patchfile | $file"
mkdir -p "$RESTORE/$(dirname "$file")"
cp "$CONTENTROOT/$file" "$RESTORE/$file"
patch -p1 -i "$patch" "$CONTENTROOT/$file"
done
find Patches/Content -type f -not -name "*.patch" | while read file; do
local file=${file#Patches/Content/}
if [[ $file == *disabled* ]]; then
echo "Skipping $file"
continue
fi
if [[ $file == *FMOD* ]] && [ -z "$STRIPFMOD" ]; then
echo "FMOD: Skipping $file"
continue
fi
echo "$file"
mkdir -p "$RESTORE/$(dirname "$file")"
cp "$CONTENTROOT/$file" "$RESTORE/$file"
cp "Patches/Content/$file" "$CONTENTROOT/$file"
done
}
restore() {
if [ ! -d "$RESTORE" ]; then
echo "Error: no restore found"
return
fi
cp -r "$RESTORE"/* "$CONTENTROOT"
rm -rf "$RESTORE"
}
extract() {
# ilspycmd: 9.0.0.7625
# ICSharpCode.Decompiler: 9.0.0.7625
ilspycmd $1 -p -o Decompiled
}
genpatches() {
decompdir=../decomp/Celeste/
find "$decompdir" -type f -name "*.cs" | while read file; do
echo $file
local file=${file#$decompdir}
local patchfile=Patches/Code/Celeste/$file.patch
mkdir -p "$(dirname $patchfile)"
diff=$(diff -u ../decomp/Celeste/$file celeste/Celeste/$file)
if [ -n "$diff" ]; then
echo -n "$diff" > $patchfile
fi
done
}
genzip() {
zip -r celeste.patched.zip celeste/Celeste/*
python3 helpers/xor.py celeste.patched.zip ~/.config/itch/apps/celeste/Content/Dialog/english.txt > celeste.patched.zip.xor
rm celeste.patched.zip
}
$@