summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-11-22 21:56:24 -0600
committerBryan Bishop <kanzure@gmail.com>2013-11-22 21:56:24 -0600
commit6292c574f6ed7757d6c43f6b1772fc41f687ccad (patch)
treee88f9287410e245cebc70ff91c88871622149421
parenta38a86806b6a72402d07482f7c259c8a4e522762 (diff)
parse wram labels in crystal.py
-rw-r--r--pokemontools/crystal.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/pokemontools/crystal.py b/pokemontools/crystal.py
index 61142a4..e15d777 100644
--- a/pokemontools/crystal.py
+++ b/pokemontools/crystal.py
@@ -70,6 +70,11 @@ OldTextScript = old_text_script
import configuration
conf = configuration.Config()
+data_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data/pokecrystal/")
+conf.wram = os.path.join(data_path, "wram.asm")
+conf.gbhw = os.path.join(data_path, "gbhw.asm")
+conf.hram = os.path.join(data_path, "hram.asm")
+
from map_names import map_names
# ---- script_parse_table explanation ----
@@ -6709,6 +6714,14 @@ def write_all_labels(all_labels, filename="labels.json"):
fh.close()
return True
+def setup_wram_labels(config=conf):
+ """
+ Get all wram labels and store it on the module.
+ """
+ wramproc = wram.WRAMProcessor(config=config)
+ wramproc.initialize()
+ wram.wram_labels = wramproc.wram_labels
+
def get_ram_label(address):
"""
returns a label assigned to a particular ram address
@@ -6968,6 +6981,9 @@ def parse_rom(rom=None):
# read the rom and figure out the offsets for maps
rom = direct_load_rom()
+ # make wram.wram_labels available
+ setup_wram_labels()
+
# figure out the map offsets
map_group_offsets = load_map_group_offsets(map_group_pointer_table=map_group_pointer_table, map_group_count=map_group_count, rom=rom)