Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert texture renaming #63

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -2149,14 +2149,6 @@ void load_texture_by_name(ModelNodeProperty* propertyName, s32 romOffset, s32 si
break;
}

// try appending "tif" - this is a common issue with textures ported from Star Rod mods
char tifName[32];
strcpy(tifName, textureName);
strcat(tifName, "tif");
if (strcmp(tifName, header->name) == 0) {
break;
bates64 marked this conversation as resolved.
Show resolved Hide resolved
}

textureIdx++;
mainSize = rasterSize + paletteSize + sizeof(*header);
romOffset += mainSize;
Expand Down
5 changes: 0 additions & 5 deletions tools/build/mapfs/tex.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ def img_from_json(json_data, tex_name: str, asset_stack: Tuple[Path, ...]) -> Te

ret.img_name = json_data["name"]

if "ext" in json_data:
ret.raw_ext = json_data["ext"]
else:
ret.raw_ext = "tif"

# read data for main tile
main_data = json_data.get("main")
if main_data == None:
Expand Down
15 changes: 4 additions & 11 deletions tools/splat_ext/tex_archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,7 @@ def get_n64_pal(self, texbuf, fmt, depth):
# extract texture properties and rasters from buffer
def from_bytes(self, texbuf: TexBuffer):
# strip area prefix and original extension suffix
raw_name = decode_null_terminated_ascii(texbuf.get(32))
self.img_name = raw_name[4:-3]
self.raw_ext = raw_name[-3:]
self.img_name = decode_null_terminated_ascii(texbuf.get(32))

(
self.aux_width,
Expand Down Expand Up @@ -339,10 +337,6 @@ def get_json_entry(self):
out = {}
out["name"] = self.img_name

# only a single texture in 'tst_tex' has 'rgb', otherwise this is always 'tif'
if self.raw_ext != "tif":
out["ext"] = self.raw_ext

out["main"] = {
"format": get_format_name(self.main_fmt, self.main_depth),
"hwrap": wrap_modes.get(self.main_hwrap),
Expand Down Expand Up @@ -439,9 +433,8 @@ def pack_color(r, g, b, a):
def add_bytes(self, tex_name: str, bytes: bytearray):
pos = len(bytes)

# form raw name and write to header
raw_name = tex_name[:4] + self.img_name + self.raw_ext
name_bytes = raw_name.encode("ascii")
# write name to header
name_bytes = self.img_name.encode("ascii")
bytes += name_bytes

# pad name out to 32 bytes
Expand Down Expand Up @@ -491,7 +484,7 @@ def add_bytes(self, tex_name: str, bytes: bytearray):
bytes += self.aux_pal

size = len(bytes) - pos
assert size == self.expected_size(), f"{raw_name}: size mismatch: {size} != {self.expected_size()}"
assert size == self.expected_size(), f"{self.img_name}: size mismatch: {size} != {self.expected_size()}"

def expected_size(self) -> int:
"""
Expand Down
Loading