Exemplo n.º 1
0
void NDSFile::load() {
	Common::File nds;
	open(nds);

	if (!isNDS(nds))
		throw Common::Exception("Not a support NDS ROM file");

	nds.seek(0x40);

	uint32 fileNameTableOffset = nds.readUint32LE();
	uint32 fileNameTableLength = nds.readUint32LE();
	uint32 fatOffset           = nds.readUint32LE();
	//uint32 fatLength = nds.readUint32LE();

	try {

		readNames(nds, fileNameTableOffset, fileNameTableLength);
		readFAT(nds, fatOffset);

	if (nds.err())
		throw Common::Exception(Common::kReadError);

	} catch (Common::Exception &e) {
		e.add("Failed reading NDS file");
		throw;
	}

}
Exemplo n.º 2
0
void NDSFile::load(Common::SeekableReadStream &nds) {
	if (!isNDS(nds, _title, _code, _maker))
		throw Common::Exception("Not a supported NDS ROM file");

	nds.seek(0x40);

	uint32 fileNameTableOffset = nds.readUint32LE();
	uint32 fileNameTableLength = nds.readUint32LE();
	uint32 fatOffset           = nds.readUint32LE();
	//uint32 fatLength = nds.readUint32LE();

	try {

		readNames(nds, fileNameTableOffset, fileNameTableLength);
		readFAT(nds, fatOffset);

	} catch (Common::Exception &e) {
		e.add("Failed reading NDS file");
		throw;
	}

}