Пример #1
0
void TalkTable_GFF::readString05(Entry &entry, bool bigEndian) const {
	Common::ScopedPtr<Common::SeekableReadStream>
		huffTree (_gff->getTopLevel().getData(kGFF4HuffTalkStringHuffTree)),
		bitStream(_gff->getTopLevel().getData(kGFF4HuffTalkStringBitStream));

	if (!huffTree || !bitStream)
		return;

	Common::SeekableSubReadStreamEndian huffTreeEndian(huffTree.get(), 0, huffTree->size(), bigEndian);
	Common::SeekableSubReadStreamEndian bitStreamEndian(bitStream.get(), 0, bitStream->size(), bigEndian);

	readString05(huffTreeEndian, bitStreamEndian, entry);
}
Пример #2
0
int main(int argc, char **argv) {
	initPlatform();

	try {
		std::vector<Common::UString> args;
		Common::Platform::getParameters(argc, argv, args);

		int returnValue = 1;
		Common::UString keyFile;
		std::set<Common::UString> files;

		if (!parseCommandLine(args, returnValue, keyFile, files))
			return returnValue;

		Aurora::KEYWriter keyWriter;

		std::list<BIFGroup> groups;

		for (const auto& file : files) {
			if (file.endsWith(".bif") || file.endsWith(".bzf")) {
				BIFGroup group;
				group.name = file;
				groups.push_back(group);
				continue;
			} else {
				if (groups.empty())
					throw Common::Exception("Files have to start with a bif or bzf archive");
				groups.back().files.push_back(file);
			}
		}

		for (const auto& group : groups) {
			std::printf("Packing %s ... \n", group.name.c_str());

			Common::WriteFile writeBIFFile(group.name);
			Common::ScopedPtr<Aurora::KEYDataWriter> dataFile;

			if (group.name.endsWith(".bzf"))
				dataFile.reset(new Aurora::BZFWriter(group.files.size(), writeBIFFile));
			else
				dataFile.reset(new Aurora::BIFWriter(group.files.size(), writeBIFFile));

			size_t i = 1;
			for (const auto& file : group.files) {
				std::printf("\tPacking %u/%u: %s ... ", (uint)i, static_cast<uint>(group.files.size()), file.c_str());
				std::fflush(stdout);

				Common::ReadFile packFile(file);
				dataFile->add(packFile, TypeMan.getFileType(file));

				++i;

				std::printf("Done\n");
			}

			keyWriter.addBIF(group.name, group.files, dataFile->size());
		}

		Common::WriteFile writeFile(keyFile);
		keyWriter.write(writeFile);
	} catch (...) {
		Common::exceptionDispatcherError();
	}

	return 0;
}