8 #include <fmt/format.h>
19 bool COF::read(
const StreamPtr& streamPtr)
21 if (streamPtr && streamPtr->good()) {
22 static_assert(std::is_trivially_copyable<Header>(),
23 "COF::Header must be trivially copyable");
24 static_assert(
sizeof(Header) == 4 + 6 *
sizeof(uint32_t),
25 "COF::Header struct needs to be packed");
26 streamPtr->read(&header,
sizeof(header));
27 if (streamPtr->fail() || header.
version != 20)
return false;
29 static_assert(std::is_trivially_copyable<Layer>(),
"COF::Layer must be trivially copyable");
30 static_assert(
sizeof(Layer) == 9 *
sizeof(uint8_t),
"COF::Layer struct needs to be packed");
31 layers.resize(header.
layers);
32 streamPtr->read(layers.data(), header.
layers *
sizeof(Layer));
33 for (
const Layer& layer : layers)
36 assert(layer.weaponClass[3] ==
'\0');
39 keyframes.resize(header.
frames);
40 streamPtr->read(keyframes.data(), header.
frames);
43 layersOrder.resize(layersOrderSize);
44 streamPtr->read(layersOrder.data(), layersOrderSize);
46 return streamPtr->good();
#define WS_UNUSED(x)
Mark a variable as unused to shut warnings when it is unused on purpose.
static constexpr uint8_t componentsNumber