Skip to content

Commit

Permalink
Merge branch 'main' into shape-c
Browse files Browse the repository at this point in the history
  • Loading branch information
bates64 authored Jan 21, 2024
2 parents 482b26e + f1edb83 commit 21a9108
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 712 deletions.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ rabbitizer
n64img
python-githooks
crunch64>=0.2.0
splat64>=0.21.0
splat64>=0.21.5
requests
3 changes: 0 additions & 3 deletions src/os/nusys/nugfxfuncset.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include "common.h"
#include "nu/nusys.h"

NUGfxFunc nuGfxFunc = NULL;
NUGfxPreNMIFunc nuGfxPreNMIFunc = NULL;

void nuGfxFuncSet(NUGfxFunc func) {
OSIntMask intMask;

Expand Down
3 changes: 3 additions & 0 deletions src/os/nusys/nugfxthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

void gfxThread(void*);

NUGfxFunc nuGfxFunc = NULL;
NUGfxPreNMIFunc nuGfxPreNMIFunc = NULL;

extern char GfxStack[NU_GFX_STACK_SIZE];
extern OSThread D_800B1B90;
extern OSMesg nuGfxMesgBuf[NU_GFX_MESGS];
Expand Down
10 changes: 4 additions & 6 deletions tools/build/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,9 @@ def build(
if isinstance(seg, splat.segtypes.n64.header.N64SegHeader):
build(entry.object_path, entry.src_paths, "as")
elif isinstance(seg, splat.segtypes.common.asm.CommonSegAsm) or (
isinstance(seg, splat.segtypes.common.data.CommonSegData) and not seg.type[0] == "."
isinstance(seg, splat.segtypes.common.data.CommonSegData)
and not seg.type[0] == "."
or isinstance(seg, splat.segtypes.common.textbin.CommonSegTextbin)
):
build(entry.object_path, entry.src_paths, "as")
elif seg.type in ["pm_effect_loads", "pm_effect_shims"]:
Expand Down Expand Up @@ -782,11 +784,7 @@ def build(
type="data",
define=True,
)
elif (
isinstance(seg, splat.segtypes.common.bin.CommonSegBin)
or isinstance(seg, splat.segtypes.common.textbin.CommonSegTextbin)
or isinstance(seg, splat.segtypes.common.rodatabin.CommonSegRodatabin)
):
elif isinstance(seg, splat.segtypes.common.bin.CommonSegBin):
build(entry.object_path, entry.src_paths, "bin")
elif isinstance(seg, splat.segtypes.n64.yay0.N64SegYay0):
compressed_path = entry.object_path.with_suffix("") # remove .o
Expand Down
15 changes: 3 additions & 12 deletions tools/build/sprite/sprites.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
MAX_COMPONENTS_XML,
NPC_SPRITE_MEDADATA_XML_FILENAME,
PALETTE_GROUPS_XML,
HAS_BACK_XML,
PALETTE_XML,
PLAYER_SPRITE_MEDADATA_XML_FILENAME,
SPECIAL_RASTER,
Expand Down Expand Up @@ -141,13 +142,12 @@ def player_raster_from_xml(xml: ET.Element, back: bool = False) -> PlayerRaster:


def player_xml_to_bytes(xml: ET.Element, asset_stack: Tuple[Path, ...]) -> List[bytes]:
has_back = False

out_bytes = b""
back_out_bytes = b""

max_components = int(xml.attrib[MAX_COMPONENTS_XML])
num_variations = int(xml.attrib[PALETTE_GROUPS_XML])
has_back = xml.attrib[HAS_BACK_XML] == "true"

# Animations
animations: List[List[AnimComponent]] = []
Expand Down Expand Up @@ -253,8 +253,6 @@ def player_xml_to_bytes(xml: ET.Element, asset_stack: Tuple[Path, ...]) -> List[
raster_bytes_back: bytes = b""
raster_offset = 0
for raster_xml in xml[1]:
if "back" in raster_xml.attrib:
has_back = True
r = player_raster_from_xml(raster_xml, back=False)
raster_bytes += struct.pack(">IBBBB", raster_offset, r.width, r.height, r.palette_idx, 0xFF)

Expand Down Expand Up @@ -343,13 +341,6 @@ def player_xml_to_bytes(xml: ET.Element, asset_stack: Tuple[Path, ...]) -> List[
return ret


def xml_has_back(xml: ET.Element) -> bool:
for raster_xml in xml[1]:
if "back" in raster_xml.attrib:
return True
return False


def write_player_sprite_header(
sprite_order: List[str],
out_file: Path,
Expand All @@ -365,7 +356,7 @@ def write_player_sprite_header(

for sprite_name in sprite_order:
sprite_xml = PLAYER_XML_CACHE[sprite_name]
has_back = xml_has_back(sprite_xml)
has_back = sprite_xml.attrib[HAS_BACK_XML] == "true"

player_sprites[f"SPR_{sprite_name}"] = sprite_id
player_rasters[sprite_name] = {}
Expand Down
2 changes: 2 additions & 0 deletions tools/splat_ext/pm_sprites.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@

MAX_COMPONENTS_XML = "maxComponents"
PALETTE_GROUPS_XML = "paletteGroups"
HAS_BACK_XML = "hasBack"
PALETTE_XML = "palette"
BACK_PALETTE_XML = "backPalette"

Expand Down Expand Up @@ -397,6 +398,7 @@ def get_sprite_name_from_offset(offset: int, offsets: List[int], names: List[str
{
MAX_COMPONENTS_XML: str(cur_sprite.max_components),
PALETTE_GROUPS_XML: str(cur_sprite.num_variations),
HAS_BACK_XML: str(has_back).lower(),
},
)

Expand Down
Loading

0 comments on commit 21a9108

Please sign in to comment.