69 readNames(nds, fileNameTableOffset, fileNameTableLength);
73 e.
add(
"Failed reading NDS file");
83 while (((
size_t)nds.
pos()) < (
size_t)(offset + length)) {
87 if ((nameLength == 0) || ((
size_t)nds.
pos() >= (size_t)(offset + length)))
125 if (stream.
size() < 0x40)
145 if (
TypeMan.setFileType(r->name, r->type) == name)
void add(const char *s,...) GCC_PRINTF(2
uint32 readUint32LE()
Read an unsigned 32-bit word stored in little endian (LSB first) order from the stream and return it...
const Common::UString & getTitle() const
Return the game title string stored in the NDS header.
#define TypeMan
Shortcut for accessing the file type manager.
A class holding an UTF-8 string.
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.
ResourceList _resources
External list of resource names and types.
const Common::UString & getMaker() const
Return the maker code string stored in the NDS header.
A simple streaming file reading class.
Implementing the reading stream interfaces for plain memory blocks.
Utility functions to handle files used in BioWare's Aurora engine.
Common::UString name
The resource's name.
bool hasResource(Common::UString name) const
Does the Nintendo DS ROM contain a certain resource?
Exception that provides a stack of explanations.
void readFAT(Common::SeekableReadStream &nds, uint32 offset)
Basic exceptions to throw.
Utility templates and functions.
Internal resource information.
std::list< Resource > ResourceList
Utility functions for working with differing string encodings.
uint32 offset
The offset of the resource within the NDS.
A resource within the archive.
const Common::UString & getCode() const
Return the game code string stored in the NDS header.
virtual size_t size() const =0
Obtains the total size of the stream, measured in bytes.
virtual size_t pos() const =0
Obtains the current value of the stream position indicator of the stream.
Common::SeekableReadStream * getResource(uint32 index, bool tryNoCopy=false) const
Return a stream of the resource's contents.
Implementing the stream reading interfaces for files.
void readNames(Common::SeekableReadStream &nds, uint32 offset, uint32 length)
Plain, unextended ASCII (7bit clean).
PointerType get() const
Returns the plain pointer value.
IResourceList _iResources
Internal list of resource offsets and sizes.
UString toLower() const
Return a lowercased copy of the string.
Common::ScopedPtr< Common::SeekableReadStream > _nds
FileType type
The resource's type.
NDSFile(const Common::UString &fileName)
Over this file in the filesystem and read a NDS file out of it.
const IResource & getIResource(uint32 index) const
static bool isNDS(Common::SeekableReadStream &stream, Common::UString &title, Common::UString &code, Common::UString &maker)
Check if a stream is a valid Nintendo DS ROM and read its title, code and maker strings.
UString readStringFixed(SeekableReadStream &stream, Encoding encoding, size_t length)
Read length bytes as a string with the given encoding out of a stream.
SeekableSubReadStream provides access to a SeekableReadStream restricted to the range [begin...
const ResourceList & getResources() const
Return the list of resources.
uint32 getResourceSize(uint32 index) const
Return the size of a resource.
Interface for a seekable & readable data stream.
void makeLower()
Convert the string to lowercase.
byte readByte()
Read an unsigned byte from the stream and return it.
uint32 index
The resource's local index within the archive.
uint32 size
The resource's size.
void load(Common::SeekableReadStream &nds)