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:
parent
d64a2922ff
commit
85267dc348
24 changed files with 1700 additions and 1691 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue