diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-08-27 11:18:30 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-08-27 11:18:30 -0500 |
commit | ddc4a929058ff103cac5743ca39bb8e4b520ee90 (patch) | |
tree | 9d986f9685c4c898e80aab898d199f5b72f9977b /extras/pointers.py | |
parent | c61b3d42ad4e88b32e9c321b7fcc559ec0220e64 (diff) | |
parent | 94f5f61265b9654925b66dca7c3256668435eeea (diff) |
Merge pull request #161 from kanzure/remove-extras
This merges branch 'remove-extras' into master. The extras/ path is now
replaced by a git submodule that is independently version controlled and
separate from the pokecrystal project.
The git submodule is a reference to v1.1.0 of this repository:
https://github.com/kanzure/pokemon-reverse-engineering-tools
It's also available as a generic python module now:
https://pypi.python.org/pypi/pokemontools
https://github.com/kanzure/pokecrystal/pull/161
Diffstat (limited to 'extras/pointers.py')
m--------- | extras | 0 | ||||
-rw-r--r-- | extras/pointers.py | 25 |
2 files changed, 0 insertions, 25 deletions
diff --git a/extras b/extras new file mode 160000 +Subproject 016f0206b5029fc83a6200be29b0f980c76dfd9 diff --git a/extras/pointers.py b/extras/pointers.py deleted file mode 100644 index 8fe3df31b..000000000 --- a/extras/pointers.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Various functions related to pointer and address math. Mostly to avoid -depedency loops. -""" - -def calculate_bank(address): - """you are too lazy to divide on your own?""" - if type(address) == str: - address = int(address, 16) - #if 0x4000 <= address <= 0x7FFF: - # raise Exception, "bank 1 does not exist" - return int(address) / 0x4000 - -def calculate_pointer(short_pointer, bank=None): - """calculates the full address given a 4-byte pointer and bank byte""" - short_pointer = int(short_pointer) - if 0x4000 <= short_pointer <= 0x7fff: - short_pointer -= 0x4000 - bank = int(bank) - else: - bank = 0 - pointer = short_pointer + (bank * 0x4000) - return pointer - |