1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-10 08:50:23 +00:00

Force skybox split palettes to always contain 128 colors (#2535)

* Force skybox split palettes to always contain 128 colors, padding with 0 if necessary

* Review
This commit is contained in:
Tharo 2025-05-25 20:50:34 +01:00 committed by GitHub
parent 385cf23064
commit faf2003d37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 3 deletions

View file

@ -245,6 +245,13 @@ class N64Palette(Structure):
_object_refcount.add_ref(pal)
return deref(pal)
def resize(self, new_count : int) -> Optional["N64Palette"]:
if new_count > 256:
raise ValueError("The largest possible palette size is 256")
pal = ln64texconv.n64texconv_palette_resize(byref(self), new_count)
_object_refcount.add_ref(pal)
return deref(pal)
@staticmethod
def from_png(path : str, fmt : int) -> Optional["N64Palette"]:
if fmt not in (G_IM_FMT_RGBA, G_IM_FMT_IA):
@ -306,6 +313,10 @@ ln64texconv.n64texconv_palette_copy.restype = POINTER(N64Palette)
ln64texconv.n64texconv_palette_reformat.argtypes = [POINTER(N64Palette), c_int]
ln64texconv.n64texconv_palette_reformat.restype = POINTER(N64Palette)
# struct n64_palette *n64texconv_palette_resize(struct n64_palette *pal, size_t new_count);
ln64texconv.n64texconv_palette_resize.argtypes = [POINTER(N64Palette), c_size_t]
ln64texconv.n64texconv_palette_resize.restype = POINTER(N64Palette)
# struct n64_palette *n64texconv_palette_from_png(const char *path, int fmt);
ln64texconv.n64texconv_palette_from_png.argtypes = [c_char_p, c_int]
ln64texconv.n64texconv_palette_from_png.restype = POINTER(N64Palette)