-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·59 lines (46 loc) · 1.04 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
set -e
function build() {
BASE=$1
if [ ! -f "$BASE.gb" ]
then
echo "No such file '$BASE.gb'"
exit 1
fi
chmod a-w $BASE.gb
python3 ./leveldata.py $BASE.gb
mkdir -p outimg
if [ -d "outimg/$BASE" ]
then
rm -r "outimg/$BASE"
fi
echo "writing image data to outimg/$BASE"
mkdir -p "outimg/$BASE"
python3 ./levelimages.py "$BASE.gb" "outimg/$BASE"
BUILDNAME="$BASE.out.gb"
echo "incbin \"$BASE.gb\"" > incbase.asm
if command -v z80asm > /dev/null
then
z80asm -o $BUILDNAME --label=$BASE.out.lbl -i incbase.asm ./game.asm
diff "$BASE.gb" "$BUILDNAME"
else
echo "Install z80asm (ubuntu: apt install z80asm) to build the extracted data as a patch"
fi
}
if [ "$#" -eq 0 ]
then
for file in *.gb
do
if [[ "$file" != *.out.gb ]]
then
echo "extracting from $file"
build "${file%.*}"
fi
done
exit 0
fi
if [ -z "$1" ]
then
echo "Usage: $0 rom.gb"
exit 1
fi
build ${1%.*}