aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorvulcandth <vulcandth@gmail.com>2023-08-26 10:14:57 -0500
committerGitHub <noreply@github.com>2023-08-26 10:14:57 -0500
commit508a46b2ceb9a20c27b64a022d3e9b8869e81fbd (patch)
treeb267fd95d0dc5e89a9943c74a4fffdd51564c6fa /tools
parenttext_2.asm: trivial missing whitespace (#425) (diff)
downloadpokeyellow-508a46b2ceb9a20c27b64a022d3e9b8869e81fbd.tar.gz
pokeyellow-508a46b2ceb9a20c27b64a022d3e9b8869e81fbd.tar.xz
pokeyellow-508a46b2ceb9a20c27b64a022d3e9b8869e81fbd.zip
Fix tools/free_space.awk for new rgbds (pret/pokecrystal#1049) (#416)
Co-authored-by: mid-kid <esteve.varela@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/free_space.awk18
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/free_space.awk b/tools/free_space.awk
index 0e157858..28785377 100755
--- a/tools/free_space.awk
+++ b/tools/free_space.awk
@@ -38,17 +38,25 @@ function register_bank(amount) {
printf "Bank %3d: %5d/16384 (%.2f%%)\n", bank_num, amount, amount * 100 / 16384
}
}
+function register_bank_str(str) {
+ if (str ~ /\$[0-9A-F]+/) {
+ register_bank(strtonum("0x" substr(str, 2)))
+ } else {
+ printf "Malformed number? \"%s\" does not start with '$'\n", str
+ }
+}
rom_bank && toupper($0) ~ /^[ \t]*EMPTY$/ {
# Empty bank
register_bank(16384)
}
rom_bank && toupper($0) ~ /^[ \t]*SLACK:[ \t]/ {
- if ($2 ~ /\$[0-9A-F]+/) {
- register_bank(strtonum("0x" substr($2, 2)))
- } else {
- printf "Malformed slack line? \"%s\" does not start with '$'\n", $2
- }
+ # Old (rgbds <=0.6.0) end-of-bank free space
+ register_bank_str($2)
+}
+rom_bank && toupper($0) ~ /^[ \t]*TOTAL EMPTY:[ \t]/ {
+ # New (rgbds >=0.6.1) total free space
+ register_bank_str($3)
}
END {