-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakeHack.sh
69 lines (44 loc) · 1.45 KB
/
MakeHack.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
#!/bin/bash
# USAGE: ./MakeHack.sh [quick]
# If first argument is "quick", then this will not update text or tables
base_dir=$(dirname "$(readlink -f "$0")")
# defining buildfile config
source_rom="$base_dir/FE8_clean.gba"
main_event="$base_dir/ROM Buildfile.event"
target_rom="$base_dir/SkillsTest.gba"
target_ups="$base_dir/SkillsTest.ups" # unused, but kept for symmetry with MAKE HACK_full.cmd
# defining tools
c2ea_py="$base_dir/Tools/C2EA/c2ea.py"
textprocess_py="$base_dir/Tools/TextProcess/text-process-classic.py"
parsefile="$base_dir/Event Assembler/Tools/ParseFile"
# finding correct python version
if hash python3; then
python3="python3"
elif hash python 2> /dev/null && [[ $(python -c 'import sys; print(int(sys.version_info[0] > 2))') -eq 1 ]]; then
python3="python"
else
echo "MakeHack.sh requires python 3 to be installed!" 1>&2
exit 1
fi
# do the actual building
cd "$base_dir"
echo "Copying ROM"
cp -f "$source_rom" "$target_rom" || exit 2
if [[ $1 != quick ]]; then
# make hack full
# TABLES
echo "Processing tables"
cd "$base_dir/Tables"
echo | $python3 "$c2ea_py" \
"$source_rom"
# TEXT
echo "Processing text"
cd "$base_dir/Text"
echo | $python3 "$textprocess_py" \
"text_buildfile.txt" --parser-exe "$parsefile"
fi
echo "Assembling"
cd "$base_dir/Event Assembler"
mono ColorzCore.exe A FE8 "-output:$target_rom" "-input:$main_event"
# TODO: generate patch (would require a linux version of ups)
echo "Done!"