3 #include <fmt/format.h>
9 int main(
int argc,
char* argv[])
13 if (!palette.decode(argv[2])) {
14 fmt::print(
"Couldn't read the palette file\n");
18 if (dc6.
initDecoder(std::make_unique<FileStream>(argv[1]))) {
20 for (
auto& frameHeader : dc6.getFrameHeaders())
22 fmt::print(
"\nframe index {}\n", frameIndex);
23 fmt::print(
"flip {}\n", frameHeader.flip);
24 fmt::print(
"width {}\n", frameHeader.width);
25 fmt::print(
"height {}\n", frameHeader.height);
26 fmt::print(
"offsetX {}\n", frameHeader.offsetX);
27 fmt::print(
"offsetY {}\n", frameHeader.offsetY);
28 fmt::print(
"allocatedSize {}\n", frameHeader.allocSize);
29 fmt::print(
"nextBlock {}\n", frameHeader.nextBlock);
30 fmt::print(
"length {}\n", frameHeader.length);
32 dc6.exportToPPM(argv[3], palette);
38 fmt::print(
"Usage : DC6extract file.dc6 palette.dat output\n");
39 fmt::print(
"This tool will extract all frames of dc6 file to output[direction][frame].ppm\n");
bool initDecoder(StreamPtr &&streamPtr)
Start decoding the stream and preparing data.
Decoder for the DC6 image format.
Wrapper around POSIX file io, same as ifstream but without iostream formatting.
Helper to load a Diablo 2 palette (.pal/.dat format)