matching and linking new dataobjects

This commit is contained in:
roeming
2025-07-20 15:17:45 -04:00
parent 999b887f34
commit ffafd06561
39 changed files with 1974 additions and 10 deletions
+9 -6
View File
@@ -3,6 +3,9 @@ from gfxdis import convert_binary_to_gfx
from dataclasses import dataclass
import struct
ASSET_ALIGN = "ATTRIBUTE_ALIGN(32)"
NO_ALIGN = ""
@dataclass
class struct_ref:
@@ -347,23 +350,23 @@ def convert_source_to_gfx_c_source(src_file, dest_path):
continue
if type == "Vtx":
data = f'#include "assets/{obj_name}.inc"'
converted_types[obj_name] = (type, data, "")
converted_types[obj_name] = (type, data, NO_ALIGN)
elif type == "Gfx":
data = convert_binary_to_gfx(
*lookup_bins_and_symbols(lines, obj_name))
converted_types[obj_name] = (type, data, "")
converted_types[obj_name] = (type, data, NO_ALIGN)
elif type == "PAL":
data = f'#include "assets/{obj_name}.inc"'
converted_types[obj_name] = ("u16", data, "")
converted_types[obj_name] = ("u16", data, ASSET_ALIGN)
elif type == "TEX":
data = f'#include "assets/{obj_name}.inc"'
converted_types[obj_name] = ("u8", data, "")
converted_types[obj_name] = ("u8", data, ASSET_ALIGN)
elif type in lookup_table:
res: struct_parse_result = lookup_table[type](
*lookup_bins_and_symbols2(lines, obj_name))
data = res.formatted_str
converted_types[obj_name] = (type, data, "")
converted_types[obj_name] = (type, data, NO_ALIGN)
if len(res.referenced_objects) > 0:
found_types = [(ref.symbol_name, ref.symbol_type)
for ref in res.referenced_objects] + found_types
@@ -371,7 +374,7 @@ def convert_source_to_gfx_c_source(src_file, dest_path):
out = header + "\n\n"
for obj in all_objs:
this_type, out_data, align = converted_types.get(
obj, ("u8", f'#include "assets/{obj}.inc"', ""))
obj, ("u8", f'#include "assets/{obj}.inc"', NO_ALIGN))
out += f"{this_type} {obj}[] {align}= {{ \n{out_data}\n}};\n\n"
# print(out)
with open(dest_path, "w") as f:
+6 -1
View File
@@ -324,6 +324,8 @@ G_CYC_FILL = (3 << G_MDSFT_CYCLETYPE)
G_PM_1PRIMITIVE = (1 << G_MDSFT_PIPELINE)
G_PM_NPRIMITIVE = (0 << G_MDSFT_PIPELINE)
G_TLUT_DOLPHIN = 2
def GBL_c1(m1a, m1b, m2a, m2b): return (m1a) << 30 | (
m1b) << 26 | (m2a) << 22 | (m2b) << 18
@@ -1573,7 +1575,10 @@ def gfx_gsDPLoadSync(data):
def gfx_gsDPLoadTLUTCmd(data):
return gf_call("gsDPLoadTLUTCmd", data, B2A(24, 3, DL, strarg_tile), B2A(14, 10, DL))
if extract_data_upper(data, 22, 2) == G_TLUT_DOLPHIN:
return gf_call("gsDPLoadTLUT_Dolphin", data, B2A(16, 4, DU), B2A(0, 14, DU), B2A(14, 2, DU), GFX_SYMBOL)
else:
return gf_call("gsDPLoadTLUTCmd", data, B2A(24, 3, DL, strarg_tile), B2A(14, 10, DL))
def gfx_SetCombineLERP(data):