mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-08-22 05:49:04 -04:00
match some big files
This commit is contained in:
@@ -251,9 +251,24 @@ def lookup_bins_and_symbols(lines: list[str], name: str):
|
||||
elif ".rel" in line:
|
||||
out_bin.extend(b'\0\0\0\0')
|
||||
out_symbols.append(f"&{line.split(".rel ")[1].split(",")[0]}[0]")
|
||||
elif ".byte" in line:
|
||||
data = line.split(".byte ")[1]
|
||||
out_bin.extend(int(data, 16).to_bytes(1, 'big'))
|
||||
|
||||
return out_bin, out_symbols
|
||||
|
||||
|
||||
def lookup_static(lines: list[str], name: str):
|
||||
lookfor = f".obj {name}"
|
||||
for line in lines:
|
||||
if line.startswith(lookfor):
|
||||
if line.startswith(lookfor + ", local"):
|
||||
return "static "
|
||||
else:
|
||||
return ""
|
||||
return ""
|
||||
|
||||
|
||||
def lookup_bins_and_symbols2(lines: list[str], name: str):
|
||||
out_bin = bytearray()
|
||||
out_symbols = {}
|
||||
@@ -278,7 +293,17 @@ def lookup_bins_and_symbols2(lines: list[str], name: str):
|
||||
elif ".2byte" in line:
|
||||
data = line.split(".2byte ")[1]
|
||||
out_bin.extend(int(data, 16).to_bytes(2, 'big'))
|
||||
offset_count += 4
|
||||
offset_count += 2
|
||||
elif ".byte" in line:
|
||||
data = line.split(".byte ")[1]
|
||||
if ", " in data:
|
||||
for d in data.split(", "):
|
||||
out_bin.extend(int(d, 16).to_bytes(1, 'big'))
|
||||
offset_count += 1
|
||||
else:
|
||||
out_bin.extend(int(data, 16).to_bytes(1, 'big'))
|
||||
offset_count += 1
|
||||
|
||||
elif ".rel" in line:
|
||||
out_bin.extend(b'\0\0\0\0')
|
||||
data = f"&{line.split(".rel ")[1].split(",")[0]}[xxx]"
|
||||
@@ -310,6 +335,8 @@ def convert_source_to_gfx_c_source(src_file, dest_path):
|
||||
found_types.append((this_obj, "Vtx"))
|
||||
elif "_model" in this_obj:
|
||||
found_types.append((this_obj, "Gfx"))
|
||||
elif "_tex_index" in this_obj:
|
||||
found_types.append((this_obj, "u8"))
|
||||
elif this_obj.endswith("evw_anime"):
|
||||
found_types.append((this_obj, "EVW_ANIME_DATA"))
|
||||
elif this_obj.endswith("_pal"):
|
||||
@@ -375,7 +402,8 @@ def convert_source_to_gfx_c_source(src_file, dest_path):
|
||||
for obj in all_objs:
|
||||
this_type, out_data, align = converted_types.get(
|
||||
obj, ("u8", f'#include "assets/{obj}.inc"', NO_ALIGN))
|
||||
out += f"{this_type} {obj}[] {align}= {{ \n{out_data}\n}};\n\n"
|
||||
static_typing = lookup_static(lines, obj)
|
||||
out += f"{static_typing}{this_type} {obj}[] {align}= {{ \n{out_data}\n}};\n\n"
|
||||
# print(out)
|
||||
with open(dest_path, "w") as f:
|
||||
f.write(out)
|
||||
|
||||
@@ -36,7 +36,7 @@ def strarg_animesegment(v):
|
||||
anime_3_txt: "anime_3_txt",
|
||||
anime_4_txt: "anime_4_txt",
|
||||
anime_5_txt: "anime_5_txt",
|
||||
anime_6_txt: "anime_6_txt"
|
||||
anime_6_txt: "anime_6_mdl"
|
||||
}.get(v, str(v))
|
||||
|
||||
|
||||
@@ -53,7 +53,10 @@ def symbol_lookup(addr):
|
||||
else:
|
||||
seg = f"{strarg_animesegment(addr & 0xff000000)}"
|
||||
if (addr & 0x00ffffff):
|
||||
seg += f" + 0x{addr & 0x00ffffff:X}"
|
||||
if seg == "anime_6_mdl":
|
||||
seg = f"&anime_6_mdl[{(addr & 0x00ffffff) // 0x40}]"
|
||||
else:
|
||||
seg += f" + 0x{addr & 0x00ffffff:X}"
|
||||
return seg
|
||||
|
||||
|
||||
@@ -1649,6 +1652,14 @@ def gfx_gsSp1Triangle(data):
|
||||
)
|
||||
|
||||
|
||||
def gfx_gsDPSetEnvColor(data):
|
||||
return gf_call("gsDPSetEnvColor", data,
|
||||
B2A(24, 8, DL),
|
||||
B2A(16, 8, DL),
|
||||
B2A(8, 8, DL),
|
||||
B2A(0, 8, DL))
|
||||
|
||||
|
||||
def gfx_gsDPSetTile_Dolphin(data):
|
||||
return gf_call("gsDPSetTile_Dolphin", data, B2A(20, 4, DU, strarg_dolphintile), B2A(16, 3, DU), B2A(12, 4, DU), B2A(10, 2, DU, strarg_texwrap), B2A(8, 2, DU, strarg_texwrap), B2A(4, 4, DU), B2A(4, 4, DU))
|
||||
|
||||
@@ -1783,6 +1794,7 @@ GFX_LOOKUP = {
|
||||
G_LOADBLOCK: gfx_gsDPLoadBlock,
|
||||
G_SETTILESIZE: gfx_gsDPSetTileSize,
|
||||
G_TRI1: gfx_gsSp1Triangle,
|
||||
G_SETENVCOLOR: gfx_gsDPSetEnvColor
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user