-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·87 lines (71 loc) · 2.23 KB
/
build.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
BASE=base
SRC=patch
OUT=out
builds=("us" "jp")
vcancel_cfgs=("vcancel" "no-vcancel")
inertia_cfgs=("none" "light" "heavy")
export="cv3-controls"
set -e
which asm6f > /dev/null
if [ $? != 0 ]
then
echo "asm6f is not on the PATH. asm6f with patching directives is required: https://github.com/freem/asm6f/pull/30"
exit 1
fi
if [ -d "$export" ]
then
rm -r $export
fi
mkdir $export
cp pkg_readme.md $export/README.md
for build in "${builds[@]}"; do
if [ ! -f $BASE-$build.nes ]; then
echo "no base: $BASE-$build.nes"
continue
fi
echo "INCNES \"$BASE-$build.nes\"" > inc-base.asm
mkdir $export/$build
mkdir $export/$build/inertia
for vcancel in "${vcancel_cfgs[@]}"; do
for inertia in "${inertia_cfgs[@]}"; do
defines=""
suffix="$build"
subpath="$build"
if [ "$vcancel" == "vcancel" ]; then
suffix="$suffix-$vcancel"
defines="$defines -dVCANCEL"
fi
if [ "$inertia" == "none" ]; then
defines="$defines -dINERTIA_64"
true
elif [ "$inertia" == "light" ]; then
defines="$defines -dINERTIA_0"
suffix="$suffix-light"
subpath="$subpath/inertia"
elif [ "$inertia" == "heavy" ]; then
defines="$defines -dINERTIA_32"
suffix="$suffix-heavy"
subpath="$subpath/inertia"
fi
echo "building $suffix"
set -x
asm6f -c -n -i "-dUSEBASE" "-dBUILD_${build^^}" $defines "$SRC-$build.asm" "$OUT-$suffix.nes"
set +x
if [ $? != 0 ]
then
echo "error building."
exit
fi
cp "$OUT-$suffix.ips" "$export/$subpath/$export-$suffix.ips"
if command -v ipsnect >/dev/null 2>&1; then
ipsnect "$OUT-$suffix.ips" > "$OUT-$suffix.map"
fi
done
done
done
echo "============================================"
echo "Assembling export."
if [ -f cv3-controls.zip ]; then
rm cv3-controls.zip
fi
zip -r cv3-controls.zip $export/*