From 2e9caa75d77d368ead271268406a24a1052b9d85 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sat, 3 Aug 2013 13:44:03 -0500 Subject: Move extras/ into a git submodule. --- extras | 1 + extras/disassemble_map_scripts.py | 151 -------------------------------------- 2 files changed, 1 insertion(+), 151 deletions(-) create mode 160000 extras delete mode 100644 extras/disassemble_map_scripts.py (limited to 'extras/disassemble_map_scripts.py') diff --git a/extras b/extras new file mode 160000 index 000000000..13dfbba8d --- /dev/null +++ b/extras @@ -0,0 +1 @@ +Subproject commit 13dfbba8d21b843cc3bb871ed06088ca72cde8c3 diff --git a/extras/disassemble_map_scripts.py b/extras/disassemble_map_scripts.py deleted file mode 100644 index 21df56924..000000000 --- a/extras/disassemble_map_scripts.py +++ /dev/null @@ -1,151 +0,0 @@ -# -*- encoding: utf-8 -*- -""" -Dump out asm for scripting things in bank $25. This script will modify main.asm -and insert all scripting commands. -""" - -import crystal -from gbz80disasm import output_bank_opcodes - -rom = crystal.load_rom() -roml = [ord(x) for x in rom] - -script_command_table_address = 0x96cb1 -script_command_count = 170 - -# a list of addresses for each script command -command_pointers = [crystal.calculate_pointer_from_bytes_at(script_command_table_address + (id * 2), bank=0x25) for id in range(0, 170)] - -# a list of hex addresses for each script command in bank $25 -command_pointers_hex = ["$%.2x" % (x % 0x4000 + 0x4000) for x in command_pointers] - -commands = {} - -# force data into a more usable form -for command in crystal.command_classes: - name = "Script_" + command.macro_name - id = command.id - params = {} - - for (id2, param_type) in command.param_types.items(): - param = { - "name": param_type["name"], - "type": param_type["class"].__name__, - } - params[id2] = param - - if id <= 0xa9: - commands[id] = { - "name": name, - "params": params, - "address": command_pointers[id], - } - -avoid = [ - 0x974b0, - 0x974be, - 0x9754b, - 0x97556, - 0x97562, - 0x9756e, - 0x97540, - - 0x96f8e, # verbosegiveitem2 -] - -class DisassembledScriptCommand(): - """ - Just a temporary object to store information about a script command's asm. - This is used by some of the infrastructure in crystal.py to automatically - insert asm into main.asm, rather than having someone do it manually. - """ - dependencies = None - - def __init__(self, label=None, id=None, address=None, params=None): - self.id = id - self.label = crystal.Label(name=label, address=address, object=self) - self.address = address - self.params = params - - max_byte_count = 0x4000 - - # Some of these scripts need to be truncated before insertion, because - # output_bank_opcodes doesn't know anything about stopping if some of - # the local labels are not resolved yet. - - # Script_if_equal - if address == 0x97540: - max_byte_count = 86 - - # disassemble and laso get the last address - (asm, last_address, last_hl_address, last_a_address, used_3d97) = output_bank_opcodes(address, max_byte_count=max_byte_count, stop_at=command_pointers, include_last_address=False) - - # remove indentation - asm = asm.replace("\n\t", "\n") - if asm[0] == "\t": - asm = asm[1:] - - # remove the last two newlines - while asm[-1] == "\n": - asm = asm[:-1] - - self.asm = asm - self.last_address = last_address - - # make sure this gets dumped into main.asm - #if crystal.script_parse_table[self.address] == None and crystal.script_parse_table[self.last_address] == None: - crystal.script_parse_table[self.address : self.last_address] = self - #else: - # print ".. hm, something is already at " + hex(self.address) + " for " + self.label.name - - def to_asm(self): - #output += self.label + ": ; " + hex(self.address) + "\n" - output = "; script command " + hex(self.id) + "\n" - if len(self.params) > 0: - output += "; parameters:\n" - for (id2, param) in self.params.items(): - output += "; " + param["name"] + " (" + param["type"] + ")\n" - output += "\n" - output += self.asm - return output - - def get_dependencies(*args, **kwargs): - return [] - -# make instances of DisassembledScriptCommand -for (id, command) in commands.items(): - name = command["name"] - params = command["params"] - address = command["address"] - - script_asm = DisassembledScriptCommand(label=name, id=id, address=address, params=params) - #print script_asm.to_asm() - #print crystal.to_asm(script_asm, use_asm_rules=True) - -class ScriptCommandTable(): - address = script_command_table_address - last_address = script_command_table_address + (2 * 170) - dependencies = None - - def __init__(self): - self.label = crystal.Label(name="ScriptCommandTable", address=self.address, object=self) - - # make sure this gets dumped into main.asm - crystal.script_parse_table[self.address : self.last_address] = self - - def get_dependencies(*args, **kwargs): - return [] - - def to_asm(self): - output = "" - for (id, command) in commands.items(): - output += "dw " + command["name"] + "; " + hex(command["address"]) + "\n" - if output[-1] == "\n": - output = output[:-1] - return output -script_command_table = ScriptCommandTable() -#print crystal.to_asm(script_command_table, use_asm_rules=True) - -# automatic asm insertion -asm = crystal.Asm() -asm.insert_and_dump(limit=500) -- cgit v1.2.3 From a5f1029d1cefb93ddbaad3261d27eefa3b17929f Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sat, 3 Aug 2013 16:17:25 -0500 Subject: update extras submodule to latest master branch --- extras | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extras/disassemble_map_scripts.py') diff --git a/extras b/extras index 13dfbba8d..a14c36ead 160000 --- a/extras +++ b/extras @@ -1 +1 @@ -Subproject commit 13dfbba8d21b843cc3bb871ed06088ca72cde8c3 +Subproject commit a14c36eadb75ea3d6fbc4cb3f382d7c9785d9fe9 -- cgit v1.2.3 From 2b7b3b6dc2bf8052de8747b353205963b6aa22f4 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sat, 3 Aug 2013 16:22:08 -0500 Subject: update extras submodule on the "organizing" branch The eggified version of all of the python stuff will probably not work immediately. --- extras | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extras/disassemble_map_scripts.py') diff --git a/extras b/extras index a14c36ead..a76acbadd 160000 --- a/extras +++ b/extras @@ -1 +1 @@ -Subproject commit a14c36eadb75ea3d6fbc4cb3f382d7c9785d9fe9 +Subproject commit a76acbadd2571c0d73b0797b2b68e205ab882b64 -- cgit v1.2.3 From 4619cf13def369c9612621c4689bad364b14bee3 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sat, 3 Aug 2013 16:54:28 -0500 Subject: reset extras submodule to branch master The eggify branch was a success, so the submodule's upstream changes have been merged in. --- extras | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extras/disassemble_map_scripts.py') diff --git a/extras b/extras index a76acbadd..0403a4a90 160000 --- a/extras +++ b/extras @@ -1 +1 @@ -Subproject commit a76acbadd2571c0d73b0797b2b68e205ab882b64 +Subproject commit 0403a4a90d473cc0a4bf5c53677c0a84406bc4ad -- cgit v1.2.3 From 268a2d28fdbacf48ea5e9d0cbac37ac4deee7082 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sat, 3 Aug 2013 20:13:37 -0500 Subject: probably fix the pngs target for make Update the submodule to a version where gfx.py is able to handle the current paths. Make some other fixes to Makefile to call gfx.py correctly. --- extras | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extras/disassemble_map_scripts.py') diff --git a/extras b/extras index 0403a4a90..3011f9243 160000 --- a/extras +++ b/extras @@ -1 +1 @@ -Subproject commit 0403a4a90d473cc0a4bf5c53677c0a84406bc4ad +Subproject commit 3011f9243cbe4b0de7ab2392941385c705697909 -- cgit v1.2.3 From 94f5f61265b9654925b66dca7c3256668435eeea Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Tue, 27 Aug 2013 11:15:19 -0500 Subject: bump extras submodule to v1.1.0 The extras submodule is provided by pokemon-reverse-engineering-tools v1.1.0 at commit 016f0206b5029fc83a6200be29b0f980c76dfd90. --- extras | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extras/disassemble_map_scripts.py') diff --git a/extras b/extras index 3011f9243..016f0206b 160000 --- a/extras +++ b/extras @@ -1 +1 @@ -Subproject commit 3011f9243cbe4b0de7ab2392941385c705697909 +Subproject commit 016f0206b5029fc83a6200be29b0f980c76dfd90 -- cgit v1.2.3