VitaSmith / gust_tools

A set of utilities for dealing with Gust (Koei Tecmo) PC games files
Other
206 stars 23 forks source link

Extra Surface Data Format Research #49

Open yretenai opened 2 years ago

yretenai commented 2 years ago

NOT in the file header, this describes the format found in most games that specify extra data size 0xC (12) to 0x14 (16)

enum g1t_colorspace_t : uint8_t {
  G1T_COLORSPACE_LINEAR = 0,
  G1T_COLORSPACE_SRGB = 1
}

struct extra_data_t {
  uint32_t size; // 12, 16, or 20.
  float unk1; // assumption is depth, usually 0. some have it set to between 0.5 and 10.
  uint8_t unk2;
  uint8_t unk3;
  uint8_t unk4;
  g1t_colorspace_t colorspace; // bit flag?
  // if size >= 16
  int32_t ex_width; // if width is large enough to overflow bits in bit packing
  // if size >= 20
  int32_t ex_height; // if height is large enough to overflow bits in bit packing
};

the colorspace byte is used to determine if the surface is decoded in linear or sRGB colorspace.

VitaSmith commented 2 years ago

Here are my findings on this:

If we treat the data right after the depth as a 32-bit word in big-endian format (it always seems to be big endian), then we have: