Skip to content

Commit

Permalink
Added compatibility for decomp-toolkit macros
Browse files Browse the repository at this point in the history
  • Loading branch information
dbalatoni13 committed May 28, 2024
1 parent 2e7ec29 commit dbebf75
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions m2c/asm_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,14 @@ def process_label(label: str, *, kind: LabelKind) -> None:
for w in args:
fval = try_parse(lambda: float(w))
asm_file.new_data_bytes(struct.pack(">d", fval))
elif directive in (".asci", ".asciz", ".ascii", ".asciiz"):
z = directive.endswith("z")
elif directive in (
".asci",
".asciz",
".ascii",
".asciiz",
".string",
):
z = directive.endswith("z") or directive == ".string"
asm_file.new_data_bytes(
parse_ascii_directive(line, z), is_string=True
)
Expand All @@ -548,6 +554,14 @@ def process_label(label: str, *, kind: LabelKind) -> None:
data = parse_incbin(args, options, warnings)
if data is not None:
asm_file.new_data_bytes(data)
elif directive == ".obj": # decomp-toolkit label format
parts = line.split()
if len(parts) >= 3:
try:
kind = LabelKind[parts[2].upper()]
process_label(parts[1].removesuffix(","), kind=kind)
except KeyError:
pass

elif ifdef_level == 0:
if directive == "jlabel":
Expand Down

0 comments on commit dbebf75

Please sign in to comment.