From e84a5b2062ff5e9b010447e3a3c78dd67a653166 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sun, 1 Sep 2013 02:27:44 -0500 Subject: make extras/ a submodule Use pokemontools v1.3.0 and use the same preprocessor as the pokecrystal project. --- extras | 1 + extras/insert_object_data.py | 82 -------------------------------------------- 2 files changed, 1 insertion(+), 82 deletions(-) create mode 160000 extras delete mode 100644 extras/insert_object_data.py (limited to 'extras/insert_object_data.py') diff --git a/extras b/extras new file mode 160000 index 00000000..795cd58a --- /dev/null +++ b/extras @@ -0,0 +1 @@ +Subproject commit 795cd58a70c80082003e40127241cfaefa0fae8b diff --git a/extras/insert_object_data.py b/extras/insert_object_data.py deleted file mode 100644 index e779c10b..00000000 --- a/extras/insert_object_data.py +++ /dev/null @@ -1,82 +0,0 @@ -#author: Bryan Bishop -#date: 2012-01-05 -#insert object data into pokered.asm -import extract_maps -from pretty_map_headers import map_name_cleaner, object_data_pretty_printer, make_object_label_name, make_text_label, map_constants -from analyze_incbins import asm, offset_to_pointer, find_incbin_to_replace_for, split_incbin_line_into_three, generate_diff_insert, load_asm, isolate_incbins, process_incbins -import analyze_incbins -import os, sys -import subprocess -spacing = " " - -def insert_object(map_id): - map = extract_maps.map_headers[map_id] - object = map["object_data"] - size = extract_maps.compute_object_data_size(object) - address = int(map["object_data_pointer"], 16) - - line_number = find_incbin_to_replace_for(address) - if line_number == None: - print "skipping object data for map " + str(map["id"]) + " at " + map["object_data_pointer"] + " for " + str(size) + " bytes." - return - - newlines = split_incbin_line_into_three(line_number, address, size) - object_asm = object_data_pretty_printer(map_id) - - newlines = newlines.split("\n") - if len(newlines) == 2: index = 0 #replace the 1st line with new content - elif len(newlines) == 3: index = 1 #replace the 2nd line with new content - - newlines[index] = object_asm - - if len(newlines) == 3 and newlines[2][-2:] == "$0": - #get rid of the last incbin line if it is only including 0 bytes - del newlines[2] - #note that this has to be done after adding in the new asm - newlines = "\n".join(line for line in newlines) - - diff = generate_diff_insert(line_number, newlines) - print diff - - print "... Applying diff." - - #write the diff to a file - fh = open("temp.patch", "w") - fh.write(diff) - fh.close() - - #apply the patch - os.system("patch ../pokered.asm temp.patch") - - #remove the patch - os.system("rm temp.patch") - - #confirm it's working - subprocess.check_call("cd ../; make clean; LC_CTYPE=UTF-8 make", shell=True) - -def insert_all_objects(): - for map_id in extract_maps.map_headers.keys(): - if map_id not in extract_maps.bad_maps: - insert_object(map_id) - - analyze_incbins.asm = None - analyze_incbins.incbin_lines = [] - analyze_incbins.processed_incbins = {} - load_asm() - isolate_incbins() - process_incbins() - -if __name__ == "__main__": - #load map headers and object data - extract_maps.load_rom() - extract_maps.load_map_pointers() - extract_maps.read_all_map_headers() - - #load incbins - load_asm() - isolate_incbins() - process_incbins() - - #insert_object(1) - insert_all_objects() - -- cgit v1.2.3 From 423c9ef70b49c2786b9f708b32364800cda45e79 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sun, 1 Sep 2013 16:26:26 -0500 Subject: bump submodule to get a gbz80disasm fix --- extras | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extras/insert_object_data.py') diff --git a/extras b/extras index 795cd58a..7aa016fb 160000 --- a/extras +++ b/extras @@ -1 +1 @@ -Subproject commit 795cd58a70c80082003e40127241cfaefa0fae8b +Subproject commit 7aa016fb528bcc8dcb30c6a887957851623eccc0 -- cgit v1.2.3