Misc fixes (#2860)

* Misc matches

* Remove more old dol2asm stuff

* Remove dCcS::SetMass-related fakematches

No longer necessary with the PCH for some reason.

* Use attention types enum in more places

* Remove more dol2asm stuff

* Clean up matDL_dis.py
This commit is contained in:
LagoLunatic
2025-11-25 11:32:34 -05:00
committed by GitHub
parent b46885816c
commit 1420aa0d0d
156 changed files with 209 additions and 594 deletions
+7 -18
View File
@@ -4,6 +4,7 @@ from argparse import ArgumentParser
import struct
import os
from enum import Enum
from binary_funcs import read_u16, read_u8
class GXBPRegs(Enum):
@@ -311,27 +312,14 @@ class GXCPRegs(Enum):
GX_CP_REG_ARRAYSTRIDE = 0xB0
def read_u8(binary_file):
chunk = binary_file.read(1)
if len(chunk) < 1:
return None
return struct.unpack(">B", chunk)[0]
def read_u16(binary_file):
chunk = binary_file.read(2)
if len(chunk) < 1:
return None
return struct.unpack(">H", chunk)[0]
def convert_binary_to_matDL_c_source(src_path, dest_path, symbol_name, scope):
# Load data
macro_name = os.path.splitext(os.path.basename(src_path))[0]
with open(src_path, "rb") as binary_file, open(dest_path, "w") as c_file:
c_file.write("#ifndef LOAD_BP_REG\n")
c_file.write("#define U32_AS_U8(v) ((u8)((v) >> 24)), ((u8)((v) >> 16)), ((u8)((v) >> 8)), ((u8)((v) >> 0))\n")
c_file.write("#define U24_AS_U8(v) (((v) >> 16) & 0xff), (((v) >> 8)& 0xff), (((v) >> 0) & 0xff)\n")
c_file.write("#define U16_AS_U8(v) ((u8)((v) >> 8)), ((u8)((v) >> 0))\n")
c_file.write("#define U32_AS_U8(v) (((v) >> 24) & 0xFF), (((v) >> 16) & 0xFF), (((v) >> 8) & 0xFF), (((v) >> 0) & 0xFF)\n")
c_file.write("#define U24_AS_U8(v) (((v) >> 16) & 0xFF), (((v) >> 8) & 0xFF), (((v) >> 0) & 0xFF)\n")
c_file.write("#define U16_AS_U8(v) (((v) >> 8) & 0xFF), (((v) >> 0) & 0xFF)\n")
c_file.write("#define IMAGE_ADDR(addr) (u32)(addr) >> 5\n")
c_file.write("#define LOAD_BP_REG(reg, value) GX_CMD_LOAD_BP_REG, reg, U24_AS_U8(value)\n")
c_file.write("#define LOAD_XF_REG(reg, num_args, ...) GX_CMD_LOAD_XF_REG, U16_AS_U8(num_args-1), U16_AS_U8(reg), __VA_ARGS__\n")
@@ -351,8 +339,9 @@ def convert_binary_to_matDL_c_source(src_path, dest_path, symbol_name, scope):
write_macro_line(f"{var_def_prefix}u8 {symbol_name}[] ALIGN_DECL(32) = {{")
while True:
command_type = read_u8(binary_file)
if command_type is None:
try:
command_type = read_u8(binary_file)
except EOFError:
break
line_elements = []