Skip to content

Instantly share code, notes, and snippets.

@zsennenga
Created December 23, 2018 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsennenga/15cbcf890744aa0002a96671df6519f4 to your computer and use it in GitHub Desktop.
Save zsennenga/15cbcf890744aa0002a96671df6519f4 to your computer and use it in GitHub Desktop.
Struct(
"signature" / Const(b"MT\xbe\xef"),
"unknown_const_256" / Const(256, Int16ul) * "Probably part of the signature",
"width" / Int16ul,
"minimum_bytes_per_row" / Int16ul * "Likely used to aid resizing",
"height" / Int16ul * "Seems to be decreased by 1 when using the standard builder. Bug?",
"color_count" / Const(16, Int16ul),
"palette_and_image_size" / Int16ul * "This seems to be unused - and it bugs out with larger images. You can easily exceed a short, even with the default generator",
"sky_palette_index" / Int16ul * "This is the palette index referring to what the sky was",
"unknowns_16" / Struct(
"unknown_3" / Int16ul * "This doesn't seem to be used, and doesn't always vary between mtns",
"unknown_4" / Int16ul * "This doesn't seem to be used, and doesn't always vary between mtns",
"unknown_5" / Int16ul * "This doesn't seem to be used, and doesn't always vary between mtns",
),
"palette" / Array(
16,
Struct(
"R" / Int8ul,
"G" / Int8ul,
"B" / Int8ul,
)
) * "Identical to a standard bitmap palette, except for the order of the pixels",
"pixels" / Array(
this.width,
FocusedSeq(
"items",
"count" / Rebuild(Int16ul, len_(this.items)),
"items" / Bitwise(
Aligned(
8,
Array(
this .count,
Nibble
)
)
),
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment