2022-09-05 04:24:50 -04:00
|
|
|
//
|
|
|
|
// EuropaTools
|
|
|
|
//
|
2025-01-07 14:17:50 -05:00
|
|
|
// (C) 2021-2025 modeco80 <lily.modeco80@protonmail.ch>
|
2022-09-05 04:24:50 -04:00
|
|
|
//
|
2025-01-07 18:02:27 -05:00
|
|
|
// SPDX-License-Identifier: MIT
|
2022-09-05 04:24:50 -04:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef EUROPA_STRUCTS_YATF_H
|
|
|
|
#define EUROPA_STRUCTS_YATF_H
|
|
|
|
|
2022-09-21 03:59:16 -04:00
|
|
|
#include <europa/structs/ImHexAdapter.hpp>
|
|
|
|
#include <europa/util/FourCC.hpp>
|
2022-09-05 04:24:50 -04:00
|
|
|
#include <type_traits>
|
|
|
|
|
|
|
|
namespace europa::structs {
|
|
|
|
|
|
|
|
struct [[gnu::packed]] YatfHeader {
|
2025-01-16 01:12:53 -05:00
|
|
|
enum class TextureFormat : u8 {
|
2025-01-16 20:56:42 -05:00
|
|
|
// V1 formats.
|
2025-01-16 16:24:12 -05:00
|
|
|
kTextureFormatV1_8Bpp = 0,
|
|
|
|
kTextureFormatV1_24Bpp = 2,
|
|
|
|
kTextureFormatV1_32Bpp = 3,
|
|
|
|
|
|
|
|
// V2/jsf uses these
|
|
|
|
kTextureFormatV2_8Bpp = 1,
|
|
|
|
kTextureFormatV2_24Bpp = 3,
|
|
|
|
kTextureFormatV2_32Bpp = 4,
|
|
|
|
kTextureFormatV2_4Bpp = 5
|
2025-01-16 01:12:53 -05:00
|
|
|
};
|
2022-09-05 04:24:50 -04:00
|
|
|
|
2025-01-16 16:24:12 -05:00
|
|
|
// For some reason Jedi Starfighter YATFs use a different fourcc. ???
|
|
|
|
constexpr static auto ValidMagicSF = util::FourCC<"YATF", std::endian::big>();
|
|
|
|
constexpr static auto ValidMagicJSF = util::FourCC<"YATF", std::endian::little>();
|
2022-09-05 04:24:50 -04:00
|
|
|
|
|
|
|
u32 magic;
|
|
|
|
|
2025-01-16 20:56:42 -05:00
|
|
|
u16 version; // 0x1 for starfighter, 0x2 for new jsf files
|
2025-01-16 01:12:53 -05:00
|
|
|
|
|
|
|
TextureFormat format;
|
|
|
|
|
2025-01-16 20:56:42 -05:00
|
|
|
u8 unkThing2; // flags? some palbpp? V2 seems to end up usually matching
|
2022-09-05 04:24:50 -04:00
|
|
|
|
|
|
|
// Always zeroed.
|
|
|
|
u32 zero;
|
|
|
|
|
|
|
|
u32 height;
|
|
|
|
u32 width;
|
|
|
|
|
|
|
|
[[nodiscard]] constexpr bool IsValid() const {
|
2025-01-16 16:24:12 -05:00
|
|
|
return magic == ValidMagicSF || magic == ValidMagicJSF;
|
2022-09-05 04:24:50 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-09-05 20:59:46 -04:00
|
|
|
} // namespace europa::structs
|
2022-09-05 04:24:50 -04:00
|
|
|
|
|
|
|
#endif // EUROPA_STRUCTS_YATF_H
|