forked from Decompollaborate/zelda64_compare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto_disasm.sh
executable file
·83 lines (67 loc) · 1.88 KB
/
auto_disasm.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
#! /usr/bin/env bash
FILES="boot code"
print_usage () {
echo "USAGE: $1 GAME [VERSION]+"
echo "Extracts all currently supported files in the passed GAME for all versions, or any VERSIONs passed."
}
disassemble_file () {
echo -e "\nDisassembling ${file} in ${version}:"
make GAME=$1 VERSION=$2 "$1/$2/asm/text/$3/.disasm"
}
if [[ "$#" -eq 0 ]]; then
print_usage $0
exit 1
fi
GAME_OPTIONS="oot mm"
GAME=$1
if [[ "${GAME_OPTIONS}" != *"${GAME}"* ]]; then
echo "Error: GAME argument not found, must be one of 'oot' or 'mm' "
exit 1
fi
if [[ "$#" -ge 2 ]]; then
GAME_VERSIONS=$(tr '\n' ' ' <"${GAME}/versions_${GAME}.txt")
for version in "${@:2}"
do
echo ""
echo "$version"
if [[ ! "${GAME_VERSIONS}" =~ "${version}" ]]; then
echo "Error: VERSION not found, must be one of:"
echo "$GAME_VERSIONS"
continue
fi
for file in ${FILES}
do
disassemble_file "${GAME}" "${version}" "${file}"
done
if [[ "${GAME}" != "oot" ]]; then
continue
fi
N64_VERSIONS=$(tr '\n' ' ' <"${GAME}/n64_versions.txt")
for file in n64dd
do
if [[ "${N64_VERSIONS}" =~ "${version}" ]]; then
disassemble_file "${GAME}" "${version}" "${file}"
fi
done
done
exit 0
fi
for file in ${FILES}
do
echo -e "\n Disassembling ${file} in each version"
while read version
do
disassemble_file "${GAME}" "${version}" "${file}"
done < "${GAME}/versions_${GAME}.txt"
done
if [[ ${GAME} == "oot" ]]; then
for file in n64dd
do
echo -e "\n Disassembling ${file} in each n64 version"
while read version
do
disassemble_file "${GAME}" "${version}" "${file}"
done < "oot/n64_versions.txt"
done
fi
echo -e "\nAll files disassembled"