mirror of
https://github.com/pret/pokemon-reverse-engineering-tools.git
synced 2026-09-30 13:26:40 -05:00
Merge branch 'master' into battle-handling
This commit is contained in:
15
pokemontools/data/__init__.py
Normal file
15
pokemontools/data/__init__.py
Normal 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)
|
||||
2293
pokemontools/data/pokecrystal/wram.asm
Normal file
2293
pokemontools/data/pokecrystal/wram.asm
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user