36 lines
965 B
C++
36 lines
965 B
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace gc {
|
|
|
|
struct MtxTexture {
|
|
uint32_t offset = 0;
|
|
uint32_t size = 0;
|
|
uint32_t width = 0;
|
|
uint32_t height = 0;
|
|
uint32_t bitsPerPixel = 0;
|
|
uint32_t fourCC = 0;
|
|
};
|
|
|
|
struct MtxArchive {
|
|
std::vector<MtxTexture> textures;
|
|
};
|
|
|
|
bool ParseMtxArchive(const std::vector<uint8_t>& bytes,
|
|
MtxArchive* archive,
|
|
std::string* error = nullptr);
|
|
|
|
// MTX stores a normal DDS surface with its four-byte magic replaced by an
|
|
// internal field. This returns the exact embedded surface with "DDS " put
|
|
// back, suitable for the existing DDS loader or external inspection tools.
|
|
bool ExtractMtxTextureDds(const std::vector<uint8_t>& bytes,
|
|
const MtxTexture& texture,
|
|
std::vector<uint8_t>* dds,
|
|
std::string* error = nullptr);
|
|
|
|
} // namespace gc
|