12#include "../safeguards.h"
15extern const std::array<uint8_t, 8>
_grf_cont_v2_sig = {
'G',
'R',
'F', 0x82, 0x0D, 0x0A, 0x1A, 0x0A};
23 size_t pos = file.
GetPos();
29 if (file.
ReadByte() != expected_sig_byte)
return 0;
36 file.
SeekTo(pos, SEEK_SET);
A file from which bytes, words and double words are read in (potentially) a random order.
size_t GetPos() const
Get position in the file.
void SeekTo(size_t pos, int mode)
Seek in the current file.
uint8_t ReadByte()
Read a byte from the file.
uint16_t ReadWord()
Read a word (16 bits) from the file (in low endian format).
RandomAccessFile with some extra information specific for sprite files.
SpriteFile(const std::string &filename, Subdirectory subdir, bool palette_remap)
Create the SpriteFile.
uint8_t container_version
Container format of the sprite file.
size_t content_begin
The begin of the content of the sprite file, i.e. after the container metadata.
Subdirectory
The different kinds of subdirectories OpenTTD uses.
static uint8_t GetGRFContainerVersion(SpriteFile &file)
Get the container version of the currently opened GRF file.
const std::array< uint8_t, 8 > _grf_cont_v2_sig
Signature of a container version 2 GRF.
Random Access File specialised for accessing sprites.