mirror of
https://github.com/pret/pokered.git
synced 2024-10-23 23:18:23 +00:00
update analyze_incbins for common.asm
hg-commit-id: ea7bf352f66c
This commit is contained in:
parent
a8ef3c70db
commit
4b0f1982bf
1 changed files with 7 additions and 7 deletions
|
@ -26,7 +26,7 @@ def offset_to_pointer(offset):
|
||||||
if type(offset) == str: offset = int(offset, base)
|
if type(offset) == str: offset = int(offset, base)
|
||||||
return int(offset) % 0x4000 + 0x4000
|
return int(offset) % 0x4000 + 0x4000
|
||||||
|
|
||||||
def load_asm(filename="../pokered.asm"):
|
def load_asm(filename="../common.asm"):
|
||||||
"loads the asm source code into memory"
|
"loads the asm source code into memory"
|
||||||
global asm
|
global asm
|
||||||
asm = open(filename, "r").read().split("\n")
|
asm = open(filename, "r").read().split("\n")
|
||||||
|
@ -83,7 +83,7 @@ def process_incbins():
|
||||||
|
|
||||||
def find_incbin_to_replace_for(address):
|
def find_incbin_to_replace_for(address):
|
||||||
"""returns a line number for which incbin to edit
|
"""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)
|
if type(address) == str: address = int(address, 16)
|
||||||
|
|
||||||
for incbin_key in processed_incbins.keys():
|
for incbin_key in processed_incbins.keys():
|
||||||
|
@ -152,7 +152,7 @@ def generate_diff_insert(line_number, newline):
|
||||||
newfile_fh.close()
|
newfile_fh.close()
|
||||||
|
|
||||||
try:
|
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:
|
except AttributeError, exc:
|
||||||
raise exc
|
raise exc
|
||||||
except Exception, exc:
|
except Exception, exc:
|
||||||
|
@ -192,7 +192,7 @@ def insert_map_header_asm(map_id):
|
||||||
fh.close()
|
fh.close()
|
||||||
|
|
||||||
#apply the patch
|
#apply the patch
|
||||||
os.system("patch ../pokered.asm temp.patch")
|
os.system("patch ../common.asm temp.patch")
|
||||||
|
|
||||||
#remove the patch
|
#remove the patch
|
||||||
os.system("rm temp.patch")
|
os.system("rm temp.patch")
|
||||||
|
@ -227,8 +227,8 @@ def apply_diff(diff, try_fixing=True):
|
||||||
fh.close()
|
fh.close()
|
||||||
|
|
||||||
#apply the patch
|
#apply the patch
|
||||||
os.system("cp ../pokered.asm ../pokered1.asm")
|
os.system("cp ../common.asm ../common1.asm")
|
||||||
os.system("patch ../pokered.asm temp.patch")
|
os.system("patch ../common.asm temp.patch")
|
||||||
|
|
||||||
#remove the patch
|
#remove the patch
|
||||||
os.system("rm temp.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)
|
subprocess.check_call("cd ../; make clean; LC_CTYPE=UTF-8 make", shell=True)
|
||||||
except Exception, exc:
|
except Exception, exc:
|
||||||
if try_fixing:
|
if try_fixing:
|
||||||
os.system("mv ../pokered1.asm ../pokered.asm")
|
os.system("mv ../common1.asm ../common.asm")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue