from struct import pack


def makePalMeta(color_table_ptr: int, colors_count: int, title_len: int):
	"""Generates a metadata record for a palette in a pal file.
	Since we don't have a serializer in KS, we use the manual one."""

	res = bytearray()
	res += b"\0\0\0"
	res += pack("<I", color_table_ptr)
	res += pack("<I", colors_count)
	res += b"\4"  # unkn11
	res += b"\0\0"  # unkn12
	res += pack(">H", title_len * 2)  # title is utf-16, it's size
	return res