1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-05 15:34:41 +00:00

--cs-float hex

This commit is contained in:
Dragorn421 2024-02-27 14:41:29 +01:00
parent d64a2922ff
commit 85267dc348
No known key found for this signature in database
GPG key ID: 381AEBAF3D429335
24 changed files with 1700 additions and 1691 deletions

View file

@ -5,6 +5,12 @@ from overlayhelpers import filemap
import argparse, os, struct
import math
# mimics ZAPD's --cs-float argument
# value may be "hex", "float", "both"
cs_float_format = "hex"
"""
Enumerations
"""
@ -682,8 +688,14 @@ def format_arg(arg, words):
assert unsigned_value > 0
result = "0x" + pad(hex(unsigned_value - 1), pad_len).upper()
elif format_type == "f":
result = f"CS_FLOAT(0x{unsigned_value:X}, {get_float(value)}f)"
#result = f"{get_float(value)}f"
if cs_float_format == "hex":
result = f"0x{unsigned_value:08X}"
elif cs_float_format == "float":
result = f"{get_float(value)}f"
elif cs_float_format == "both":
result = f"CS_FLOAT(0x{unsigned_value:X}, {get_float(value)}f)"
else:
raise NotImplementedError("Unknown cs_float_format", cs_float_format)
else:
print("Something went wrong!") # TODO more debug info
os._exit(1)