Jazz2::AssetPacker::BigEndianWriter class

Builds a big-endian binary file in memory.

libdragon's formats are big-endian, like the console, and they are written the way libdragon's own tools write them: fields whose values are only known later are reserved and filled in afterwards, which is why this is a buffer rather than a stream. Offsets are relative to the beginning of the buffer.

Public functions

auto GetPosition() const -> std::size_t
void Write8(std::uint8_t value)
void Write16(std::uint16_t value)
void Write32(std::uint32_t value)
void Write64(std::uint64_t value)
void WriteFloat32(float value)
void Write(const void* data, std::size_t size)
void WriteZeros(std::size_t size)
void WriteLeb128(std::uint64_t value)
Unsigned LEB128, as libdragon's asset headers store their sizes.
void Align(std::size_t alignment)
Pads with zeros to the next multiple of alignment.
auto Reserve16() -> std::size_t
Writes a zero to fill in later, returning where it is.
auto Reserve32() -> std::size_t
void Patch16(std::size_t position, std::uint16_t value)
void Patch32(std::size_t position, std::uint32_t value)

Public variables

SmallVector<std::uint8_t, 0> Data