mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-10 19:20:13 +00:00
Merge pull request #18 from Roman971/regconvert-script
Add script to generate REG macros from GameInfo offsets
This commit is contained in:
commit
1d79f4b93d
2 changed files with 23 additions and 7 deletions
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
OBJDUMP="${MIPS_BINUTILS_PREFIX}objdump -D -bbinary -mmips -EB"
|
||||
OPTIONS="--start-address=$(($1)) --stop-address=$(($1 + $2))"
|
||||
$OBJDUMP $OPTIONS baserom.z64 > baserom.dump
|
||||
$OBJDUMP $OPTIONS zelda_ocarina_mq_dbg.z64 > zelda_ocarina_mq_dbg.dump
|
||||
diff baserom.dump zelda_ocarina_mq_dbg.dump | colordiff
|
23
tools/regconvert.py
Normal file
23
tools/regconvert.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
|
||||
GROUP_SIZE = 0x60
|
||||
DATA_OFFSET = 0x14
|
||||
|
||||
REGISTER_NAMES = " SOPQMYDUIZCNKXcsiWAVHGmnBdkb"
|
||||
|
||||
def get_reg_macro(offset):
|
||||
reg = (offset - DATA_OFFSET) // 2
|
||||
group = reg // GROUP_SIZE
|
||||
reg_in_group = reg % GROUP_SIZE
|
||||
return "%cREG(%d)\n" % (REGISTER_NAMES[group], reg_in_group)
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Converts a GameInfo offset to a REG macro.")
|
||||
parser.add_argument("offset", help="offset to GameInfo in hexadecimal")
|
||||
args = parser.parse_args()
|
||||
print(get_reg_macro(int(args.offset, 16)))
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in a new issue