Merge branch 'master' into battle-handling

This commit is contained in:
Bryan Bishop
2013-11-13 19:02:23 -06:00
4 changed files with 2327 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
"""
Access to data files.
"""
# hide the os import
import os as _os
# path to where these files are located
path = _os.path.abspath(_os.path.dirname(__file__))
def join(filename, path=path):
"""
Construct the absolute path to the file.
"""
return _os.path.join(path, filename)

File diff suppressed because it is too large Load Diff

View File

@@ -1130,6 +1130,8 @@ class crystal(object):
if not wram:
self.inject_script_into_rom(asm=script, wram_address=address)
else:
# TODO: move this into a separate function. Maybe use a context
# manager to restore wram at the end.
mem = list(self.vba.memory)
backup_wram = mem[address : address + len(script)]
mem[address : address + len(script)] = script

View File

@@ -5,6 +5,10 @@ RGBDS BSS section and constant parsing.
import os
# TODO: parse these constants from constants.asm
NUM_OBJECTS = 0x10
OBJECT_LENGTH = 0x10
def make_wram_labels(wram_sections):
wram_labels = {}
for section in wram_sections:
@@ -108,6 +112,8 @@ class WRAMProcessor(object):
self.setup_hram_constants()
self.setup_gbhw_constants()
self.reformat_wram_labels()
def read_wram_sections(self):
"""
Opens the wram file and calls read_bss_sections.
@@ -162,3 +168,14 @@ class WRAMProcessor(object):
"""
self.gbhw_constants = self.read_gbhw_constants()
return self.gbhw_constants
def reformat_wram_labels(self):
"""
Flips the wram_labels dictionary the other way around to access
addresses by label.
"""
self.wram = {}
for (address, labels) in self.wram_labels.iteritems():
for label in labels:
self.wram[label] = address