-
Notifications
You must be signed in to change notification settings - Fork 2
/
assets.sh
114 lines (85 loc) · 2.82 KB
/
assets.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (c) 2021-2022, Antonio Niño Díaz
set -e
# Paths to tools
export SUPERFAMICONV=${PWD}/SuperFamiconv/bin/superfamiconv
export PNGS2STRIP=${PWD}/tools/build/pngs2strip/pngs2strip
export UMOD_PACKER=${PWD}/umod-player/build/packer/umod_packer
export BIN2C=${PWD}/tools/build/bin2c/bin2c
# Build tools
pushd tools
rm -rf build ; mkdir build ; cd build
cmake ..
make
popd
if [ ! -d "${SUPERFAMICONV}" ]; then
pushd SuperFamiconv
make -j`nproc`
popd
fi
if [ ! -d "${UMOD_PACKER}" ]; then
pushd umod-player
rm -rf build ; mkdir build ; cd build
cmake ..
make
popd
fi
# Prepare destination folder
OUT_DIR=built_assets
rm -rf ${OUT_DIR}
mkdir ${OUT_DIR}
# Convert maps
OUT_DIR_MAPS_MENUS=${OUT_DIR}/maps/menus
mkdir -p ${OUT_DIR_MAPS_MENUS}
bash maps/menus/convert.sh ${OUT_DIR_MAPS_MENUS}
OUT_DIR_MAPS_CITY=${OUT_DIR}/maps/city
mkdir -p ${OUT_DIR_MAPS_CITY}
bash maps/city/convert.sh ${OUT_DIR_MAPS_CITY}
OUT_DIR_MAPS_INTRO=${OUT_DIR}/maps/intro
mkdir -p ${OUT_DIR_MAPS_INTRO}
bash maps/intro/convert.sh ${OUT_DIR_MAPS_INTRO}
OUT_DIR_MAPS_STATUS_BAR=${OUT_DIR}/maps/status_bar
mkdir -p ${OUT_DIR_MAPS_STATUS_BAR}
bash maps/status_bar/convert.sh ${OUT_DIR_MAPS_STATUS_BAR}
# Convert sprite sheets
OUT_DIR_SPRITES=${OUT_DIR}/sprites
mkdir -p ${OUT_DIR_SPRITES}
bash sprites/convert.sh ${OUT_DIR_SPRITES}
OUT_DIR_SPRITES_BUILDING_MENU=${OUT_DIR}/sprites/building_menu
mkdir -p ${OUT_DIR_SPRITES_BUILDING_MENU}
bash sprites/building_menu/convert.sh ${OUT_DIR_SPRITES_BUILDING_MENU}
OUT_DIR_SPRITES_BUILDING_MENU_GBC=${OUT_DIR}/sprites/building_menu_gbc
mkdir -p ${OUT_DIR_SPRITES_BUILDING_MENU_GBC}
bash sprites/building_menu_gbc/convert.sh ${OUT_DIR_SPRITES_BUILDING_MENU_GBC}
OUT_DIR_SPRITES_GRAPHS_MENU=${OUT_DIR}/sprites/graphs_menu
mkdir -p ${OUT_DIR_SPRITES_GRAPHS_MENU}
bash sprites/graphs_menu/convert.sh ${OUT_DIR_SPRITES_GRAPHS_MENU}
OUT_DIR_SPRITES_GRAPHS_MENU_GBC=${OUT_DIR}/sprites/graphs_menu_gbc
mkdir -p ${OUT_DIR_SPRITES_GRAPHS_MENU_GBC}
bash sprites/graphs_menu_gbc/convert.sh ${OUT_DIR_SPRITES_GRAPHS_MENU_GBC}
OUT_DIR_SPRITES_MINIMAP_MENU=${OUT_DIR}/sprites/minimap_menu
mkdir -p ${OUT_DIR_SPRITES_MINIMAP_MENU}
bash sprites/minimap_menu/convert.sh ${OUT_DIR_SPRITES_MINIMAP_MENU}
OUT_DIR_SPRITES_MINIMAP_MENU_GBC=${OUT_DIR}/sprites/minimap_menu_gbc
mkdir -p ${OUT_DIR_SPRITES_MINIMAP_MENU_GBC}
bash sprites/minimap_menu_gbc/convert.sh ${OUT_DIR_SPRITES_MINIMAP_MENU_GBC}
# Convert music
mkdir ${OUT_DIR}/audio
${UMOD_PACKER} \
${OUT_DIR}/audio/umod_pack.bin \
${OUT_DIR}/audio/umod_pack_info.h \
audio/songs/*/*.mod \
audio/*.wav
# Convert binary files generated by other stages
for dir in $(find built_assets -type d)
do
for f in $(find $dir -maxdepth 1 -iname *.bin)
do
${BIN2C} $f "$dir"
done
done
# Done!
exit 0