update analyze_incbins for common.asm

hg-commit-id: ea7bf352f66c
This commit is contained in:
Bryan Bishop 2012-01-15 16:34:32 -06:00
parent a8ef3c70db
commit 4b0f1982bf

View file

@ -26,7 +26,7 @@ def offset_to_pointer(offset):
if type(offset) == str: offset = int(offset, base)
return int(offset) % 0x4000 + 0x4000
def load_asm(filename="../pokered.asm"):
def load_asm(filename="../common.asm"):
"loads the asm source code into memory"
global asm
asm = open(filename, "r").read().split("\n")
@ -83,7 +83,7 @@ def process_incbins():
def find_incbin_to_replace_for(address):
"""returns a line number for which incbin to edit
if you were to insert bytes into pokered.asm"""
if you were to insert bytes into common.asm"""
if type(address) == str: address = int(address, 16)
for incbin_key in processed_incbins.keys():
@ -152,7 +152,7 @@ def generate_diff_insert(line_number, newline):
newfile_fh.close()
try:
diffcontent = subprocess.check_output("diff -u ../pokered.asm " + newfile_filename, shell=True)
diffcontent = subprocess.check_output("diff -u ../common.asm " + newfile_filename, shell=True)
except AttributeError, exc:
raise exc
except Exception, exc:
@ -192,7 +192,7 @@ def insert_map_header_asm(map_id):
fh.close()
#apply the patch
os.system("patch ../pokered.asm temp.patch")
os.system("patch ../common.asm temp.patch")
#remove the patch
os.system("rm temp.patch")
@ -227,8 +227,8 @@ def apply_diff(diff, try_fixing=True):
fh.close()
#apply the patch
os.system("cp ../pokered.asm ../pokered1.asm")
os.system("patch ../pokered.asm temp.patch")
os.system("cp ../common.asm ../common1.asm")
os.system("patch ../common.asm temp.patch")
#remove the patch
os.system("rm temp.patch")
@ -238,7 +238,7 @@ def apply_diff(diff, try_fixing=True):
subprocess.check_call("cd ../; make clean; LC_CTYPE=UTF-8 make", shell=True)
except Exception, exc:
if try_fixing:
os.system("mv ../pokered1.asm ../pokered.asm")
os.system("mv ../common1.asm ../common.asm")
return False
if __name__ == "__main__":