summaryrefslogtreecommitdiff
path: root/extras/analyze_incbins.py
diff options
context:
space:
mode:
Diffstat (limited to 'extras/analyze_incbins.py')
-rw-r--r--extras/analyze_incbins.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/extras/analyze_incbins.py b/extras/analyze_incbins.py
index 4bc82c63..4d0c3fce 100644
--- a/extras/analyze_incbins.py
+++ b/extras/analyze_incbins.py
@@ -34,6 +34,7 @@ def isolate_incbins():
incbin_lines = []
for line in asm:
if line == "": continue
+ if line.count(" ") == len(line): continue
#clean up whitespace at beginning of line
while line[0] == " ":
@@ -213,7 +214,7 @@ def reset_incbins():
isolate_incbins()
process_incbins()
-def apply_diff(diff):
+def apply_diff(diff, try_fixing=True):
print "... Applying diff."
#write the diff to a file
@@ -222,13 +223,19 @@ def apply_diff(diff):
fh.close()
#apply the patch
+ os.system("cp ../pokered.asm ../pokered1.asm")
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)
+ try:
+ 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")
+ return False
if __name__ == "__main__":
#load map headers