xoreos
0.0.5
|
A class encapsulating Nintendo DS ROM access. More...
#include <ndsrom.h>
Classes | |
struct | IResource |
Internal resource information. More... | |
Public Member Functions | |
NDSFile (const Common::UString &fileName) | |
Over this file in the filesystem and read a NDS file out of it. More... | |
NDSFile (Common::SeekableReadStream *nds) | |
Take over this stream and read a NDS file out of it. More... | |
~NDSFile () | |
bool | hasResource (Common::UString name) const |
Does the Nintendo DS ROM contain a certain resource? More... | |
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... | |
const Common::UString & | getTitle () const |
Return the game title string stored in the NDS header. More... | |
const Common::UString & | getCode () const |
Return the game code string stored in the NDS header. More... | |
const Common::UString & | getMaker () const |
Return the maker code string stored in the NDS header. 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... | |
Static Public Member Functions | |
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. More... | |
Private Types | |
typedef std::vector< IResource > | IResourceList |
Private Member Functions | |
void | load (Common::SeekableReadStream &nds) |
void | readNames (Common::SeekableReadStream &nds, uint32 offset, uint32 length) |
void | readFAT (Common::SeekableReadStream &nds, uint32 offset) |
const IResource & | getIResource (uint32 index) const |
Private Attributes | |
Common::ScopedPtr< Common::SeekableReadStream > | _nds |
Common::UString | _title |
Common::UString | _code |
Common::UString | _maker |
ResourceList | _resources |
External list of resource names and types. More... | |
IResourceList | _iResources |
Internal list of resource offsets and sizes. More... | |
Additional Inherited Members | |
Public Types inherited from Aurora::Archive | |
typedef std::list< Resource > | ResourceList |
|
private |
Aurora::NDSFile::NDSFile | ( | const Common::UString & | fileName | ) |
Over this file in the filesystem and read a NDS file out of it.
Definition at line 41 of file ndsrom.cpp.
References _nds, load(), and Common::ScopedPtrBase< T, Deallocator >::reset().
Aurora::NDSFile::NDSFile | ( | Common::SeekableReadStream * | nds | ) |
Take over this stream and read a NDS file out of it.
Definition at line 47 of file ndsrom.cpp.
Aurora::NDSFile::~NDSFile | ( | ) |
Definition at line 53 of file ndsrom.cpp.
const Common::UString & Aurora::NDSFile::getCode | ( | ) | const |
Return the game code string stored in the NDS header.
Definition at line 114 of file ndsrom.cpp.
References _code.
|
private |
Definition at line 155 of file ndsrom.cpp.
References _iResources.
Referenced by getResource(), and getResourceSize().
const Common::UString & Aurora::NDSFile::getMaker | ( | ) | const |
Return the maker code string stored in the NDS header.
Definition at line 118 of file ndsrom.cpp.
References _maker.
|
virtual |
Return a stream of the resource's contents.
Implements Aurora::Archive.
Definition at line 166 of file ndsrom.cpp.
References _nds, Common::ScopedPtrBase< T, Deallocator >::get(), getIResource(), Aurora::NDSFile::IResource::offset, and Aurora::NDSFile::IResource::size.
|
virtual |
Return the list of resources.
Implements Aurora::Archive.
Definition at line 151 of file ndsrom.cpp.
References _resources.
Return the size of a resource.
Reimplemented from Aurora::Archive.
Definition at line 162 of file ndsrom.cpp.
References getIResource(), and Aurora::NDSFile::IResource::size.
const Common::UString & Aurora::NDSFile::getTitle | ( | ) | const |
Return the game title string stored in the NDS header.
Definition at line 110 of file ndsrom.cpp.
References _title.
bool Aurora::NDSFile::hasResource | ( | Common::UString | name | ) | const |
Does the Nintendo DS ROM contain a certain resource?
Definition at line 141 of file ndsrom.cpp.
References _resources, Common::UString::makeLower(), and TypeMan.
Referenced by Engines::Sonic::SonicEngine::detectLanguages().
|
static |
Check if a stream is a valid Nintendo DS ROM and read its title, code and maker strings.
Definition at line 122 of file ndsrom.cpp.
References Common::kEncodingASCII, Common::readStringFixed(), Common::SeekableReadStream::seek(), and Common::SeekableReadStream::size().
Referenced by load(), and Engines::Sonic::EngineProbe::probe().
|
private |
Definition at line 56 of file ndsrom.cpp.
References _code, _maker, _title, Common::StackException::add(), isNDS(), readFAT(), readNames(), Common::ReadStream::readUint32LE(), and Common::SeekableReadStream::seek().
Referenced by NDSFile().
|
private |
Definition at line 100 of file ndsrom.cpp.
References _iResources, _resources, Common::ReadStream::readUint32LE(), and Common::SeekableReadStream::seek().
Referenced by load().
|
private |
Definition at line 79 of file ndsrom.cpp.
References _resources, Aurora::Archive::Resource::index, Common::kEncodingASCII, Aurora::kFileTypeNone, Aurora::Archive::Resource::name, Common::SeekableReadStream::pos(), Common::ReadStream::readByte(), Common::readStringFixed(), Common::SeekableReadStream::seek(), Common::UString::toLower(), Aurora::Archive::Resource::type, and TypeMan.
Referenced by load().
|
private |
|
private |
Internal list of resource offsets and sizes.
Definition at line 95 of file ndsrom.h.
Referenced by getIResource(), and readFAT().
|
private |
Definition at line 89 of file ndsrom.h.
Referenced by getMaker(), and load().
|
private |
Definition at line 85 of file ndsrom.h.
Referenced by getResource(), and NDSFile().
|
private |
External list of resource names and types.
Definition at line 92 of file ndsrom.h.
Referenced by getResources(), hasResource(), readFAT(), and readNames().
|
private |
Definition at line 87 of file ndsrom.h.
Referenced by getTitle(), and load().