shithub: pokecrystal

Download patch

ref: 4d611738c86f9288aca055630493af09e346d817
parent: 14c8cf5b4817d1cb5446349bd04949186f73093c
parent: f185cc9b77caf956f772fc8775be0386b60318e2
author: Remy Oukaour <remy.oukaour@gmail.com>
date: Sun Jan 14 18:47:36 EST 2018

Merge branch 'sort-symfile' of https://github.com/yenatch/pokecrystal

--- a/Makefile
+++ b/Makefile
@@ -78,12 +78,12 @@
 pokecrystal11.gbc: $(crystal11_obj) pokecrystal.link
 	$(RGBLINK) -n pokecrystal11.sym -m pokecrystal11.map -l pokecrystal.link -o $@ $(crystal11_obj)
 	$(RGBFIX) -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -n 1 -p 0 -r 3 -t PM_CRYSTAL $@
-	sort pokecrystal11.sym -o pokecrystal11.sym
+	tools/sort_symfile.sh pokecrystal11.sym
 
 pokecrystal.gbc: $(crystal_obj) pokecrystal.link
 	$(RGBLINK) -n pokecrystal.sym -m pokecrystal.map -l pokecrystal.link -o $@ $(crystal_obj)
 	$(RGBFIX) -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
-	sort pokecrystal.sym -o pokecrystal.sym
+	tools/sort_symfile.sh pokecrystal.sym
 
 
 # For files that the compressor can't match, there will be a .lz file suffixed with the md5 hash of the correct uncompressed file.
--- /dev/null
+++ b/tools/sort_symfile.sh
@@ -1,0 +1,9 @@
+sed $1 \
+    -e "s/^..:[0-3]/0_ROM0@&/g" \
+    -e "s/^..:[4-7]/1_ROMX@&/g" \
+    -e "s/^..:[8-9]/2_VRAM@&/g" \
+    -e "s/^..:[A-B]/3_SRAM@&/g" \
+    -e "s/^00:[C-D]/4_WRAM0@&/g" \
+    -e "s/^..:[D-D]/5_WRAMX@&/g" \
+| sort -o $1
+sed -i $1 -e "s/^\w*@//g"