This repository has been archived by the owner on Sep 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pack_textures.bash
58 lines (47 loc) · 1.67 KB
/
pack_textures.bash
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
# **************************************************************************** #
# #
# :::::::: #
# pack_textures.bash :+: :+: #
# +:+ #
# By: jvisser <[email protected]> +#+ #
# +#+ #
# Created: 2020/03/05 14:32:06 by jvisser #+# #+# #
# Updated: 2020/03/06 15:51:23 by jvisser ######## odam.nl #
# #
# **************************************************************************** #
declare -a extensions=(
"tga"
"ui.yml"
"ttf"
"wav"
"mp3"
)
resources=
resources+=$(find resources/data/map/campaign -type f)
resources+=$'\n'
for ext in "${extensions[@]}"; do
resources+=$(find resources -type f -name "*.$ext")
resources+=$'\n'
done
IFS=$'\n' resources=( $resources )
dd if=/dev/zero bs=1 count=128 >> doom-nukem
for file in "${resources[@]}"; do
if [[ -z "$file" ]]; then
continue
fi
cat "$file" >> doom-nukem
if [[ $(uname -s) == "Darwin" ]]; then
size=$(stat -f%z "$file")
else
size=$(du -bs "$file" | column -t | cut -d' ' -f1)
fi
echo "$size"
echo -n "$size" >> doom-nukem
pad=$((24-${#size}))
echo $pad
dd if=/dev/zero bs=1 count=$pad >> doom-nukem
echo "$file"
echo -n "$file" >> doom-nukem
pad=$((128-${#file}))
dd if=/dev/zero bs=1 count=$pad >> doom-nukem
done