From cdcf80630fcf4b405e735560d1a61cf573a9319e Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Fri, 16 Mar 2012 00:08:58 -0500 Subject: romvisualizer updates for main.asm, common.asm, pokered.asm hg-commit-id: cc4f5c666710 --- extras/analyze_incbins.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'extras/analyze_incbins.py') diff --git a/extras/analyze_incbins.py b/extras/analyze_incbins.py index b52f0e15..544cd55f 100644 --- a/extras/analyze_incbins.py +++ b/extras/analyze_incbins.py @@ -27,9 +27,23 @@ def offset_to_pointer(offset): return int(offset) % 0x4000 + 0x4000 def load_asm(filename="../main.asm"): - "loads the asm source code into memory" + """loads the asm source code into memory + this also detects if the revision of the repository + is using main.asm, common.asm or pokered.asm, which is + useful when generating images in romvisualizer.py""" global asm - asm = open(filename, "r").read().split("\n") + defaults = ["../main.asm", "../common.asm", "../pokered.asm"] + if filename in defaults: + if os.path.exists("../main.asm"): + asm = open("../main.asm", "r").read().split("\n") + elif os.path.exists("../common.asm"): + asm = open("../common.asm", "r").read().split("\n") + elif os.path.exists("../pokered.asm"): + asm = open("../pokered.asm", "r").read().split("\n") + else: + raise "this shouldn't happen" + else: + asm = open(filename, "r").read().split("\n") return asm def isolate_incbins(): -- cgit v1.3.1-sl0p