summaryrefslogtreecommitdiff
path: root/redtools/map_block_dumper.py
diff options
context:
space:
mode:
Diffstat (limited to 'redtools/map_block_dumper.py')
-rw-r--r--redtools/map_block_dumper.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/redtools/map_block_dumper.py b/redtools/map_block_dumper.py
index 1ffa1e6..add52d2 100644
--- a/redtools/map_block_dumper.py
+++ b/redtools/map_block_dumper.py
@@ -1,11 +1,13 @@
+from __future__ import print_function
+from __future__ import absolute_import
#author: Bryan Bishop <kanzure@gmail.com>
#date: 2012-01-03
#purpose: extract .blk files from baserom.gbc
#note: use python2.7 because of subprocess in analyze_incbins
-import extract_maps #rom, assert_rom, load_rom, calculate_pointer, load_map_pointers, read_all_map_headers, map_headers
-from pretty_map_headers import map_name_cleaner
-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
+from . import extract_maps #rom, assert_rom, load_rom, calculate_pointer, load_map_pointers, read_all_map_headers, map_headers
+from .pretty_map_headers import map_name_cleaner
+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
+from . import analyze_incbins
import os, sys
import subprocess
spacing = " "
@@ -32,7 +34,7 @@ def extract_map_block_data(map_id, savefile=False):
full_filepath = "maps/" + filename + ".blk"
if savefile:
- print "Saving ../maps/" + filename + ".blk for map id=" + str(map_id)
+ print("Saving ../maps/" + filename + ".blk for map id=" + str(map_id))
fh = open("../maps/" + filename + ".blk", "w")
fh.write(blocksdata)
fh.close()
@@ -61,12 +63,12 @@ def insert_map_block_label(map_id):
x = int(map["x"], 16)
size = x*y
- print "map name: " + map["name"]
- print "map address: " + map["map_pointer"]
+ print("map name: " + map["name"])
+ print("map address: " + map["map_pointer"])
line_number = find_incbin_to_replace_for(address)
if line_number == None:
- print "skipping map id=" + str(map_id) + " probably because it was already done."
+ print("skipping map id=" + str(map_id) + " probably because it was already done.")
used_map_pointers.append(map["map_pointer"])
return
@@ -90,8 +92,8 @@ def insert_map_block_label(map_id):
newlines = newlines.replace("$x", "$")
diff = generate_diff_insert(line_number, newlines)
- print diff
- print "... Applying diff."
+ print(diff)
+ print("... Applying diff.")
#write the diff to a file
fh = open("temp.patch", "w")
@@ -141,14 +143,14 @@ def insert_all_labels():
#check if this label is already in there
cleaned_name, label_text, filename, full_filepath = make_labels(mapmap["name"])
if label_text in "\n".join(line for line in analyze_incbins.asm):
- print "skipping (found label text in asm already)"
+ print("skipping (found label text in asm already)")
used_map_pointers.append(mapmap["map_pointer"])
continue #skip this one
isolate_incbins()
process_incbins()
- print "XYZ|" + mapmap["name"]
+ print("XYZ|" + mapmap["name"])
insert_map_block_label(map)
used_map_pointers.append(mapmap["map_pointer"])