diff --git a/bemani/utils/afputils.py b/bemani/utils/afputils.py index d41b09d..b9c25df 100644 --- a/bemani/utils/afputils.py +++ b/bemani/utils/afputils.py @@ -261,13 +261,30 @@ def extract( if endian == ">" and magic != b"TXDT": raise Exception("Unexpected texture format!") - if fmt == 0x0E: + if fmt == 0x0B: + # 16-bit 565 color RGB format. + newdata = [] + for i in range(width * height): + pixel = struct.unpack( + f"{endian}H", + raw_data[(64 + (i * 2)):(66 + (i * 2))], + )[0] + red = ((pixel >> 0) & 0x1F) << 3 + green = ((pixel >> 5) & 0x3F) << 2 + blue = ((pixel >> 11) & 0x1F) << 3 + newdata.append( + struct.pack("> 0) & 0xF) << 4 + green = ((pixel >> 4) & 0xF) << 4 + red = ((pixel >> 8) & 0xF) << 4 + alpha = ((pixel >> 12) & 0xF) << 4 + newdata.append( + struct.pack("