mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-23 06:54:14 -04:00
b23a6f1539
* Improve match in EnFirefly_Draw * Vestigial fishing files, add enums * Improve scripts, add ColChkInfo one * Some minor actor cleanup (static etc) * C file for Fishing, remove some local vars from variables.h * Remove comma and format * Newline * Review suggestions * Fix colchkinfoinit, add damage_table * DMG macros, format existing DamageTables * Convert preset damage tables to new format * Minor tweak to colchkinfoinit output * Manually add Fishing data and Syokudai struct vars * Automatically import data * Fix to use #if 0 * Format * Name cylinders in obj_syokudai.h * correct some ichains * Fix top-of-file comments * Redo files to include externs * Fix Fishing * #if(0) -> #if 0 * Fix mysteriously wiped actors (I blame VSCode)
42 lines
1.3 KiB
Python
Executable File
42 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import struct
|
|
import argparse
|
|
from actor_symbols import resolve_symbol
|
|
|
|
def HexParse(s):
|
|
return int(s, 16)
|
|
|
|
|
|
def NameMass(info):
|
|
if info[-1] == 0xFE:
|
|
info[-1] = "MASS_HEAVY"
|
|
else:
|
|
if info[-1] == 0xFF:
|
|
info[-1] = "MASS_IMMOVABLE"
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description='Decompiles a ColChkInfoInit')
|
|
parser.add_argument('address', help='VRAM or VROM address of a ColChkInfoInit', type=HexParse)
|
|
parser.add_argument('type', help="Type: ColChkInfoInit or ColChkInfoInit2", choices=['ColChkInfoInit', 'ColChkInfoInit2'])
|
|
args = parser.parse_args()
|
|
|
|
file_path, file_offset = resolve_symbol(args.address)
|
|
|
|
with open(file_path, 'rb') as f:
|
|
filedata = f.read()
|
|
|
|
if args.type == "ColChkInfoInit":
|
|
info = list(struct.unpack(">Bx2hB", filedata[file_offset:file_offset+7]))
|
|
NameMass(info)
|
|
output="// sColChkInfoInit\nstatic CollisionCheckInfoInit D_{0:08X} = {{ ".format(args.address) + ", ".join(map(str,info)) + "};"
|
|
else:
|
|
info = list(struct.unpack(">Bx3hB", filedata[file_offset:file_offset+9]))
|
|
NameMass(info)
|
|
output="// sColChkInfoInit\nstatic CollisionCheckInfoInit2 D_{0:08X} = {{ ".format(args.address) + ", ".join(map(str,info)) + "};"
|
|
|
|
print(output)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|