shithub: pokered

Download patch

ref: f01ad092a54893344157ad6d275febaa7d8d124c
parent: 5f7bb0da7269ba8b89c42f22d635f8e403976fbf
author: Bryan Bishop <kanzure@gmail.com>
date: Mon Jan 16 20:33:46 EST 2012

TX_RAM for text engine command $1 in pretty_text

hg-commit-id: e4f95976fef8


--- a/constants.asm
+++ b/constants.asm
@@ -79,6 +79,14 @@
 	db BANK(\1)
 	ENDM
 
+; text engine command $1
+TX_RAM: MACRO
+; prints text to screen
+; \1: RAM address to read from
+    db $1
+    dw \1
+    ENDM
+
 ; wram locations
 W_AICOUNT EQU $CCDF ; number of times remaining that AI action can occur
 
--- a/extras/analyze_texts.py
+++ b/extras/analyze_texts.py
@@ -385,7 +385,7 @@
 
 def text_pretty_printer_at(start_address, label="SomeLabel"):
     commands = parse_text_script(start_address, None, None)
-    needs_to_begin_with_0 = False
+    needs_to_begin_with_0 = True #how should this be determined?
     
     wanted_command = None
     if needs_to_begin_with_0:
@@ -403,11 +403,28 @@
 
     first_line = True
     for this_command in commands.keys():
-        if not "lines" in commands[this_command].keys(): continue
+        if not "lines" in commands[this_command].keys():
+            command = commands[this_command]
+            if command["type"] == 0x1:
+                if first_line:
+                    output = "\n"
+                    output += label + ": ; " + hex(start_address) + "\n"
+                    first_line = False
+                p1 = command["pointer"][0]
+                p2 = command["pointer"][1]
+
+                #remember to account for big endian -> little endian
+                output += spacing + "TX_RAM $" + hex(p2)[2:] + hex(p1)[2:] + "\n"
+
+                byte_count += 3
+            
+            #everything else is for $0s, really
+            continue
         lines = commands[this_command]["lines"]
     
         #add the ending byte to the last line- always seems $57
-        lines[len(lines.keys())-1].append(commands[1]["type"])
+        #this should already be in there, but it's not because of a bug in the text parser
+        lines[len(lines.keys())-1].append(commands[len(commands.keys())-1]["type"])
     
         if first_line:
             output  = "\n"