From 15615650e1a1efa79e581d98562d981150d7d57a Mon Sep 17 00:00:00 2001 From: Jennifer Taylor Date: Sun, 30 Jul 2023 19:51:05 +0000 Subject: [PATCH] Add new decoder for AFP image mode 0x01 discovered in MGA files. --- bemani/format/afp/container.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bemani/format/afp/container.py b/bemani/format/afp/container.py index 33e2087..29cfc52 100644 --- a/bemani/format/afp/container.py +++ b/bemani/format/afp/container.py @@ -532,7 +532,17 @@ class TXP2File(TrackedCoverage, VerboseOutput): # determined endianness of the file. But, this could also be broken per-game, so # I'm not entirely sure this is fully possible to do generically. - if fmt == 0x0B: + if fmt == 0x01: + # As far as I can tell, this is 8 bit grayscale. Decoding as such results in + # images that are recognizeable and look correct. + img = Image.frombytes( + "L", + (width, height), + raw_data[64:], + "raw", + "L", + ) + elif fmt == 0x0B: # 16-bit 565 color RGB format. Game references D3D9 texture format 23 (R5G6B5). newdata = [] for i in range(width * height):