xoreos
0.0.5
|
#include <nsbtxfile.h>
Classes | |
struct | Palette |
struct | ReadContext |
struct | Texture |
Public Member Functions | |
NSBTXFile (Common::SeekableReadStream *nsbtx) | |
Take over this stream and read an NSBTX file out of it. More... | |
~NSBTXFile () | |
const ResourceList & | getResources () const |
Return the list of resources. More... | |
uint32 | getResourceSize (uint32 index) const |
Return the size of a resource. More... | |
Common::SeekableReadStream * | getResource (uint32 index, bool tryNoCopy=false) const |
Return a stream of the resource's contents. More... | |
Public Member Functions inherited from Aurora::Archive | |
Archive () | |
virtual | ~Archive () |
virtual Common::HashAlgo | getNameHashAlgo () const |
Return with which algorithm the name is hashed. More... | |
uint32 | findResource (uint64 hash) const |
Return the index of the resource matching the hash, or 0xFFFFFFFF if not found. More... | |
uint32 | findResource (const Common::UString &name, FileType type) const |
Return the index of the resource matching the name and type, or 0xFFFFFFFF if not found. More... | |
Private Types | |
enum | Format { kFormatNoTexture = 0, kFormatA3I5 = 1, kFormat2bpp = 2, kFormat4bpp = 3, kFormat8bpp = 4, kFormat4x4Compressed = 5, kFormatA5I3 = 6, kFormat16bpp = 7 } |
enum | Transform { kTransformNone = 0, kTransformTexCoord = 1, kTransformNormal = 2, kTransformVertex = 3 } |
typedef std::vector< Texture > | Textures |
typedef std::vector< Palette > | Palettes |
Private Member Functions | |
void | load (Common::SeekableSubReadStreamEndian &nsbtx) |
void | readHeader (Common::SeekableSubReadStreamEndian &nsbtx) |
void | readFileHeader (Common::SeekableSubReadStreamEndian &nsbtx) |
void | readInfoHeader (Common::SeekableSubReadStreamEndian &nsbtx) |
void | readTextures (Common::SeekableSubReadStreamEndian &nsbtx) |
void | readPalettes (Common::SeekableSubReadStreamEndian &nsbtx) |
void | createResourceList () |
const Palette * | findPalette (const Texture &texture) const |
void | getPalette (ReadContext &ctx) const |
Static Private Member Functions | |
static uint32 | getITEXSize (const Texture &texture) |
static void | writeITEXHeader (const ReadContext &ctx) |
static void | writePixel (const ReadContext &ctx, byte r, byte g, byte b, byte a) |
static void | getTexture (const ReadContext &ctx) |
static void | getTexture2bpp (const ReadContext &ctx) |
static void | getTexture4bpp (const ReadContext &ctx) |
static void | getTexture8bpp (const ReadContext &ctx) |
static void | getTexture16bpp (const ReadContext &ctx) |
static void | getTextureA3I5 (const ReadContext &ctx) |
static void | getTextureA5I3 (const ReadContext &ctx) |
Private Attributes | |
Common::ScopedPtr< Common::SeekableSubReadStreamEndian > | _nsbtx |
The name of the NSBTX file. More... | |
ResourceList | _resources |
External list of resource names and types. More... | |
uint32 | _textureOffset |
uint32 | _textureInfoOffset |
uint32 | _paletteInfoOffset |
uint32 | _textureDataOffset |
uint32 | _paletteDataOffset |
Textures | _textures |
Palettes | _palettes |
Additional Inherited Members | |
Public Types inherited from Aurora::Archive | |
typedef std::list< Resource > | ResourceList |
Static Protected Member Functions inherited from Aurora::NitroFile | |
static Common::SeekableSubReadStreamEndian * | open (Common::SeekableReadStream &stream) |
Treat this stream as a Nitro file and return an endian'd stream according to its BOM. More... | |
static Common::SeekableSubReadStreamEndian * | open (Common::SeekableReadStream *stream) |
Treat this stream as a Nitro file, take it over and return an endian'd stream according to its BOM. More... | |
Definition at line 45 of file nsbtxfile.h.
|
private |
Definition at line 115 of file nsbtxfile.h.
|
private |
Definition at line 114 of file nsbtxfile.h.
|
private |
Definition at line 61 of file nsbtxfile.h.
|
private |
Definition at line 72 of file nsbtxfile.h.
Aurora::NSBTXFile::NSBTXFile | ( | Common::SeekableReadStream * | nsbtx | ) |
Take over this stream and read an NSBTX file out of it.
Definition at line 84 of file nsbtxfile.cpp.
References _nsbtx, load(), Aurora::NitroFile::open(), and Common::ScopedPtrBase< T, Deallocator >::reset().
Aurora::NSBTXFile::~NSBTXFile | ( | ) |
Definition at line 92 of file nsbtxfile.cpp.
|
private |
Definition at line 509 of file nsbtxfile.cpp.
References _resources, _textures, and Aurora::kFileTypeXEOSITEX.
Referenced by load().
|
private |
Definition at line 248 of file nsbtxfile.cpp.
References _palettes, and Aurora::NSBTXFile::Texture::name.
Referenced by getPalette().
Definition at line 99 of file nsbtxfile.cpp.
References Aurora::NSBTXFile::Texture::height, kXEOSITEXHeaderSize, kXEOSITEXMipMapHeaderSize, and Aurora::NSBTXFile::Texture::width.
Referenced by getResource(), and getResourceSize().
|
private |
Definition at line 264 of file nsbtxfile.cpp.
References Common::UString::c_str(), findPalette(), Aurora::NSBTXFile::Texture::format, Aurora::NSBTXFile::Texture::name, Aurora::NSBTXFile::ReadContext::nsbtx, Aurora::NSBTXFile::Palette::offset, Aurora::NSBTXFile::ReadContext::palette, Common::SeekableSubReadStream::pos(), Common::SeekableSubReadStreamEndian::readUint16(), Common::ScopedPtrBase< T, Deallocator >::reset(), Common::SeekableSubReadStream::seek(), Common::SeekableSubReadStream::size(), and Aurora::NSBTXFile::ReadContext::texture.
Referenced by getResource().
|
virtual |
Return a stream of the resource's contents.
Implements Aurora::Archive.
Definition at line 327 of file nsbtxfile.cpp.
References _nsbtx, _textures, Common::MemoryWriteStreamDynamic::getData(), getITEXSize(), getPalette(), getTexture(), Common::MemoryWriteStreamDynamic::setDisposable(), Common::MemoryWriteStreamDynamic::size(), and writeITEXHeader().
|
virtual |
Return the list of resources.
Implements Aurora::Archive.
Definition at line 95 of file nsbtxfile.cpp.
References _resources.
Return the size of a resource.
Reimplemented from Aurora::Archive.
Definition at line 103 of file nsbtxfile.cpp.
References _textures, and getITEXSize().
|
staticprivate |
Definition at line 293 of file nsbtxfile.cpp.
References Aurora::NSBTXFile::Texture::format, getTexture16bpp(), getTexture2bpp(), getTexture4bpp(), getTexture8bpp(), getTextureA3I5(), getTextureA5I3(), kFormat16bpp, kFormat2bpp, kFormat4bpp, kFormat8bpp, kFormatA3I5, kFormatA5I3, Aurora::NSBTXFile::ReadContext::nsbtx, Aurora::NSBTXFile::Texture::offset, Common::SeekableSubReadStream::seek(), and Aurora::NSBTXFile::ReadContext::texture.
Referenced by getResource().
|
staticprivate |
Definition at line 196 of file nsbtxfile.cpp.
References Aurora::NSBTXFile::Texture::height, Aurora::NSBTXFile::ReadContext::nsbtx, Common::SeekableSubReadStreamEndian::readUint16(), Aurora::NSBTXFile::ReadContext::texture, Aurora::NSBTXFile::Texture::width, and writePixel().
Referenced by getTexture().
|
staticprivate |
Definition at line 138 of file nsbtxfile.cpp.
References Aurora::NSBTXFile::Texture::alpha, Aurora::NSBTXFile::Texture::height, Aurora::NSBTXFile::ReadContext::nsbtx, Aurora::NSBTXFile::ReadContext::palette, Common::ReadStream::readByte(), Aurora::NSBTXFile::ReadContext::texture, Aurora::NSBTXFile::Texture::width, and writePixel().
Referenced by getTexture().
|
staticprivate |
Definition at line 159 of file nsbtxfile.cpp.
References Aurora::NSBTXFile::Texture::alpha, Aurora::NSBTXFile::Texture::height, Aurora::NSBTXFile::ReadContext::nsbtx, Aurora::NSBTXFile::ReadContext::palette, Common::ReadStream::readByte(), Aurora::NSBTXFile::ReadContext::texture, Aurora::NSBTXFile::Texture::width, and writePixel().
Referenced by getTexture().
|
staticprivate |
Definition at line 180 of file nsbtxfile.cpp.
References Aurora::NSBTXFile::Texture::alpha, Aurora::NSBTXFile::Texture::height, Aurora::NSBTXFile::ReadContext::nsbtx, Aurora::NSBTXFile::ReadContext::palette, Common::ReadStream::readByte(), Aurora::NSBTXFile::ReadContext::texture, Aurora::NSBTXFile::Texture::width, and writePixel().
Referenced by getTexture().
|
staticprivate |
Definition at line 212 of file nsbtxfile.cpp.
References Aurora::NSBTXFile::Texture::height, Aurora::NSBTXFile::ReadContext::nsbtx, Aurora::NSBTXFile::ReadContext::palette, Common::ReadStream::readByte(), Aurora::NSBTXFile::ReadContext::texture, Aurora::NSBTXFile::Texture::width, and writePixel().
Referenced by getTexture().
|
staticprivate |
Definition at line 230 of file nsbtxfile.cpp.
References Aurora::NSBTXFile::Texture::height, Aurora::NSBTXFile::ReadContext::nsbtx, Aurora::NSBTXFile::ReadContext::palette, Common::ReadStream::readByte(), Aurora::NSBTXFile::ReadContext::texture, Aurora::NSBTXFile::Texture::width, and writePixel().
Referenced by getTexture().
|
private |
Definition at line 343 of file nsbtxfile.cpp.
References Common::StackException::add(), createResourceList(), readHeader(), readPalettes(), and readTextures().
Referenced by NSBTXFile().
|
private |
Definition at line 363 of file nsbtxfile.cpp.
References _textureOffset, Common::debugTag(), kBTX0ID, Common::ReadStream::readByte(), Common::SeekableSubReadStreamEndian::readUint16(), Common::SeekableSubReadStreamEndian::readUint32(), Common::ReadStream::readUint32BE(), and Common::SeekableSubReadStream::size().
Referenced by readHeader().
|
private |
Definition at line 358 of file nsbtxfile.cpp.
References readFileHeader(), and readInfoHeader().
Referenced by load().
|
private |
Definition at line 392 of file nsbtxfile.cpp.
References _paletteDataOffset, _paletteInfoOffset, _textureDataOffset, _textureInfoOffset, _textureOffset, Common::debugTag(), kTEX0ID, Common::SeekableSubReadStreamEndian::readUint16(), Common::SeekableSubReadStreamEndian::readUint32(), Common::ReadStream::readUint32BE(), Common::SeekableSubReadStream::seek(), and Common::SeekableReadStream::skip().
Referenced by readHeader().
|
private |
Definition at line 483 of file nsbtxfile.cpp.
References _paletteDataOffset, _paletteInfoOffset, _palettes, Common::kEncodingASCII, Common::ReadStream::readByte(), Common::readStringFixed(), Common::SeekableSubReadStreamEndian::readUint16(), Common::SeekableSubReadStream::seek(), Common::SeekableReadStream::skip(), and Common::UString::toLower().
Referenced by load().
|
private |
Definition at line 419 of file nsbtxfile.cpp.
References _textureDataOffset, _textureInfoOffset, _textures, Common::kEncodingASCII, Common::ReadStream::readByte(), Common::readStringFixed(), Common::SeekableSubReadStreamEndian::readUint16(), Common::SeekableSubReadStream::seek(), Common::SeekableReadStream::skip(), and Common::UString::toLower().
Referenced by load().
|
staticprivate |
Definition at line 110 of file nsbtxfile.cpp.
References Aurora::NSBTXFile::Texture::coordTransform, Aurora::NSBTXFile::Texture::flipX, Aurora::NSBTXFile::Texture::flipY, Aurora::NSBTXFile::Texture::height, kITEXID, kXEOSID, Aurora::NSBTXFile::ReadContext::stream, Aurora::NSBTXFile::ReadContext::texture, Aurora::NSBTXFile::Texture::width, Aurora::NSBTXFile::Texture::wrapX, Aurora::NSBTXFile::Texture::wrapY, Common::WriteStream::writeByte(), Common::WriteStream::writeUint32BE(), and Common::WriteStream::writeUint32LE().
Referenced by getResource().
|
staticprivate |
Definition at line 131 of file nsbtxfile.cpp.
References Aurora::NSBTXFile::ReadContext::stream, and Common::WriteStream::writeByte().
Referenced by getTexture16bpp(), getTexture2bpp(), getTexture4bpp(), getTexture8bpp(), getTextureA3I5(), and getTextureA5I3().
|
private |
The name of the NSBTX file.
Definition at line 119 of file nsbtxfile.h.
Referenced by getResource(), and NSBTXFile().
|
private |
Definition at line 130 of file nsbtxfile.h.
Referenced by readInfoHeader(), and readPalettes().
|
private |
Definition at line 127 of file nsbtxfile.h.
Referenced by readInfoHeader(), and readPalettes().
|
private |
Definition at line 133 of file nsbtxfile.h.
Referenced by findPalette(), and readPalettes().
|
private |
External list of resource names and types.
Definition at line 122 of file nsbtxfile.h.
Referenced by createResourceList(), and getResources().
|
private |
Definition at line 129 of file nsbtxfile.h.
Referenced by readInfoHeader(), and readTextures().
|
private |
Definition at line 126 of file nsbtxfile.h.
Referenced by readInfoHeader(), and readTextures().
|
private |
Definition at line 124 of file nsbtxfile.h.
Referenced by readFileHeader(), and readInfoHeader().
|
private |
Definition at line 132 of file nsbtxfile.h.
Referenced by createResourceList(), getResource(), getResourceSize(), and readTextures().