67 if (((ctx.
width % 64) != 0) || ((ctx.
height % 64) != 0))
72 e.
add(
"Failed reading CDPTH file");
83 return load(*stream, width, height);
97 ctx.
cells.reserve(4096);
101 for (
size_t i = 0; i < 4096; i++) {
108 ctx.
cells.push_back(0);
112 const size_t pos = ctx.
cdpth->
pos();
117 if (ctx.
cells.back()->size() != 8192)
123 if (ctx.
cells.empty())
127 e.
add(
"Failed reading CDPTH file");
143 const uint32 cellWidth = 64;
144 const uint32 cellHeight = 64;
148 for (
size_t i = 0; i < ctx.
cells.size(); i++) {
153 const uint32 xC = i % cellsX;
154 const uint32 yC = i / cellsX;
157 const uint32 imagePos = yC * cellHeight * ctx.
width + xC * cellWidth;
159 for (
uint32 y = 0; y < cellHeight; y++) {
160 for (
uint32 x = 0; x < cellWidth; x++) {
static void readCells(ReadContext &ctx)
static const uint16 * load(Common::SeekableReadStream &cdpth, uint32 width, uint32 height)
Read a CDPTH out of this stream.
uint16 readUint16LE()
Read an unsigned 16-bit word stored in little endian (LSB first) order from the stream and return it...
void add(const char *s,...) GCC_PRINTF(2
static void decompress(Common::ReadStream &small, Common::WriteStream &out)
virtual size_t seek(ptrdiff_t offset, Origin whence=kOriginBegin)=0
Sets the stream position indicator for the stream.
void reset(PointerType o=0)
Resets the pointer with the new value.
PointerType release()
Returns the plain pointer value and releases ScopedPtr.
Common::SeekableReadStream * cdpth
Common::PtrVector< Common::SeekableReadStream > Cells
static void checkConsistency(ReadContext &ctx)
Exception that provides a stack of explanations.
A simple scoped smart pointer template.
Basic exceptions to throw.
Common::ScopedArray< uint16 > depth
Utility templates and functions.
A vector storing pointer to objects, with automatic deletion.
Basic reading stream interfaces.
virtual size_t pos() const =0
Obtains the current value of the stream position indicator of the stream.
static void loadCDPTH(ReadContext &ctx)
Compressed DePTH, found in Sonic, holding image depth values.
PointerType get() const
Returns the plain pointer value.
Decompressing "small" files, Nintendo DS LZSS (types 0x00 and 0x10), found in Sonic.
SeekableSubReadStream provides access to a SeekableReadStream restricted to the range [begin...
ReadContext(Common::SeekableReadStream &c, uint32 w, uint32 h)
Interface for a seekable & readable data stream.
static void createDepth(ReadContext &ctx)