1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 06:24:30 +00:00

Decompile the remaining Oceff actors + Add ichaindis.py (#125)

* Decompile the remaining Oceff actors + Add ichaindis.py

- z_oceff_spot.c: OK
- z_oceff_storm.c : 1 non-matching left
- Add ichaindis.py

* Rename SetActionFunc to SetupAction + Add Actor descriptions

* Minor fixes in PR #125
This commit is contained in:
Random 2020-05-10 19:09:26 +02:00 committed by GitHub
parent 40836f5d82
commit 3e5ed389b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 662 additions and 1125 deletions

52
tools/ichaindis.py Normal file
View file

@ -0,0 +1,52 @@
#!/usr/bin/python3
import os
import sys
import struct
import argparse
ICHAIN_MACROS = [
'ICHAIN_U8',
'ICHAIN_S8',
'ICHAIN_U16',
'ICHAIN_S16',
'ICHAIN_U32',
'ICHAIN_S32',
'ICHAIN_F32',
'ICHAIN_F32_DIV1000',
'ICHAIN_VEC3F',
'ICHAIN_VEC3F_DIV1000',
'ICHAIN_VEC3S',
]
def main():
parser = argparse.ArgumentParser(description='Decompiles an InitChain')
parser.add_argument('filename', help='ROM file path')
parser.add_argument('offset', help='ROM offset to an InitChain')
args = parser.parse_args()
romOff = int(args.offset, 16)
try:
with open(args.filename, 'rb') as f:
romData = f.read()
except IOError:
print('failed to read file' + args.filename)
sys.exit(1)
print ('static InitChainEntry initChain[] = {')
while True:
entry = struct.unpack('>I', romData[romOff:romOff+4])[0]
romOff += 4
cont = entry >> 31
t = (entry >> 27) & 0xF
offset = ((entry) >> 16) & 0x7FF
value = (entry) & 0xFFFF
print(' {0}(unk_{1:X}, {2}, {3}),'.format(ICHAIN_MACROS[t], offset, value, ('ICHAIN_CONTINUE' if cont == 1 else 'ICHAIN_STOP')))
if cont == 0:
break
print ('};')
if __name__ == "__main__":
main()