shithub: pokecrystal

Download patch

ref: a4f10572bab9b09237f7e1ab95f066bd82eb5063
parent: 5ba4aec8d55b37c1321244d8b141739f1dd8e965
author: Bryan Bishop <[email protected]>
date: Sat Mar 10 22:01:33 EST 2012

add pksv command names to crystal.py

--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -405,8 +405,8 @@
 def command_debug_information(command_byte=None, map_group=None, map_id=None, address=None, info=None, long_info=None):
     info1 = "parsing command byte " + hex(command_byte) + " for map " + \
           str(map_group) + "." + str(map_id) + " at " + hex(address)
-    info1 += "\tinfo: " + str(info)
-    info1 += "\tlong_info: " + long_info
+    info1 += "    info: " + str(info)
+    #info1 += "    long_info: " + long_info
     return info1
 
 def parse_text_engine_script_at(address):
@@ -419,6 +419,199 @@
     commands = {}
     return commands
 
+pksv_gs = {
+    0x00: "2call",
+    0x01: "3call",
+    0x03: "2jump",
+    0x04: "3jump",
+    0x06: "if equal",
+    0x07: "if not equal",
+    0x08: "if false",
+    0x09: "if true",
+    0x0A: "if less than",
+    0x0B: "if greater than",
+    0x0C: "jumpstd",
+    0x0E: "3callasm",
+    0x0F: "special",
+    0x12: "domaptrigger",
+    0x14: "dotrigger",
+    0x15: "writebyte",
+    0x19: "copybytetovar",
+    0x1C: "checkcode",
+    0x1E: "writecode",
+    0x1F: "giveitem",
+    0x20: "takeitem",
+    0x21: "checkitem",
+    0x22: "givemoney",
+    0x23: "takemoney",
+    0x24: "checkmonkey",
+    0x25: "givecoins",
+    0x26: "takecoins",
+    0x27: "checkcoins",
+    0x2B: "checktime",
+    0x2C: "checkpoke",
+    0x2D: "givepoke",
+    0x2E: "giveegg",
+    0x31: "checkbit1",
+    0x32: "clearbit1",
+    0x33: "setbit1",
+    0x34: "checkbit2",
+    0x35: "clearbit2",
+    0x36: "setbit2",
+    0x37: "wildoff",
+    0x38: "wildon",
+    0x3A: "warpmod",
+    0x3B: "blackoutmod",
+    0x3C: "warp",
+    0x44: "stringtotext",
+    0x46: "pocketisfull",
+    0x47: "loadfont",
+    0x49: "loadmovesprites",
+    0x4B: "3writetext",
+    0x4C: "2writetext",
+    0x4E: "yesorno",
+    0x51: "jumptextfaceplayer",
+    0x52: "jumptext",
+    0x53: "closetext",
+    0x54: "keeptextopen",
+    0x55: "pokepic",
+    0x5C: "loadpokedata",
+    0x5D: "loadtrainer",
+    0x5E: "startbattle",
+    0x5F: "returnafterbattle",
+    0x60: "catchtutorial",
+    0x63: "winlosstext",
+    0x65: "talkaftercancel",
+    0x68: "applymovement",
+    0x6A: "faceplayer",
+    0x6B: "faceperson",
+    0x6D: "disappear",
+    0x6E: "appear",
+    0x6F: "follow",
+    0x70: "stopfollow",
+    0x71: "moveperson",
+    0x74: "showemote",
+    0x75: "spriteface",
+    0x76: "follownotexact",
+    0x77: "earthquake",
+    0x79: "changeblock",
+    0x7A: "reloadmap",
+    0x80: "musicfadeout",
+    0x83: "cry",
+    0x84: "playsound",
+    0x85: "waitbutton",
+    0x8A: "pause",
+    0x8C: "priorityjump",
+    0x8F: "return",
+    0x90: "end",
+    0x91: "reloadandreturn",
+    0x92: "resetfuncs",
+    0x93: "pokemart",
+    0x94: "elevator",
+    0x95: "trade",
+    0x9A: "fruittree",
+    0x9D: "verbosegiveitem",
+    0xA0: "credits",
+    0xA1: "warpfacing",
+}
+
+#see http://www.pokecommunity.com/showpost.php?p=4347261
+pksv_crystal = {
+    0x00: "2call",
+    0x01: "3call",
+    0x03: "2jump",
+    0x04: "3jump",
+    0x06: "if equal",
+    0x07: "if not equal",
+    0x08: "if false",
+    0x09: "if true",
+    0x0A: "if less than",
+    0x0B: "if greater than",
+    0x0C: "jumpstd",
+    0x0E: "3callasm",
+    0x0F: "special",
+    0x12: "domaptrigger",
+    0x14: "dotrigger",
+    0x15: "writebyte",
+    0x19: "copybytetovar",
+    0x1C: "checkcode",
+    0x1E: "writecode",
+    0x1F: "giveitem",
+    0x20: "takeitem",
+    0x21: "checkitem",
+    0x22: "givemoney",
+    0x23: "takemoney",
+    0x24: "checkmonkey",
+    0x25: "givecoins",
+    0x26: "takecoins",
+    0x27: "checkcoins",
+    0x2B: "checktime",
+    0x2C: "checkpoke",
+    0x2D: "givepoke",
+    0x2E: "giveegg",
+    0x31: "checkbit1",
+    0x32: "clearbit1",
+    0x33: "setbit1",
+    0x34: "checkbit2",
+    0x35: "clearbit2",
+    0x36: "setbit2",
+    0x37: "wildoff",
+    0x38: "wildon",
+    0x3A: "warpmod",
+    0x3B: "blackoutmod",
+    0x3C: "warp",
+    0x44: "stringtotext",
+    0x46: "pocketisfull",
+    0x47: "loadfont",
+    0x49: "loadmovesprites",
+    0x4B: "3writetext",
+    0x4C: "2writetext",
+    0x4E: "yesorno",
+    0x51: "jumptextfaceplayer",
+    0x53: "jumptext",
+    0x54: "closetext",
+    0x55: "keeptextopen",
+    0x56: "pokepic",
+    0x5D: "loadpokedata",
+    0x5E: "loadtrainer",
+    0x5F: "startbattle",
+    0x60: "returnafterbattle",
+    0x61: "catchtutorial",
+    0x64: "winlosstext",
+    0x66: "talkaftercancel",
+    0x69: "applymovement",
+    0x6B: "faceplayer",
+    0x6C: "faceperson",
+    0x6E: "disappear",
+    0x6F: "appear",
+    0x70: "follow",
+    0x71: "stopfollow",
+    0x72: "moveperson",
+    0x75: "showemote",
+    0x76: "spriteface",
+    0x77: "follownotexact",
+    0x78: "earthquake",
+    0x7A: "changeblock",
+    0x7B: "reloadmap",
+    0x81: "musicfadeout",
+    0x84: "cry",
+    0x85: "playsound",
+    0x86: "waitbutton",
+    0x8B: "pause",
+    0x8D: "priorityjump",
+    0x90: "return",
+    0x91: "end",
+    0x92: "reloadandreturn",
+    0x93: "resetfuncs",
+    0x94: "pokemart",
+    0x95: "elevator",
+    0x96: "trade",
+    0x9B: "fruittree",
+    0x9E: "verbosegiveitem",
+    0xA2: "credits",
+    0xA3: "warpfacing",
+}
+
 def parse_script_engine_script_at(address, map_group=None, map_id=None):
     """parses a script-engine script"""
     global rom
@@ -438,6 +631,7 @@
         start_address = offset
 
         if   command_byte == 0x00: #Pointer code [2b+ret]
+            pksv_name = "2call"
             info = "pointer code"
             long_info = """
             2byte pointer points to script; when pointed script ends --> return to old script
@@ -449,6 +643,7 @@
             command["pointer"] = calculate_pointer_from_bytes_at(start_address+1)
             #XXX should we also parse this target script?
         elif command_byte == 0x01: #Pointer code [3b+ret]
+            pksv_name = "3call"
             info = "pointer code"
             long_info = """
             3byte pointer points to script; when pointed script ends --> return to old script