Ejemplo n.º 1
0
void extractFiles(Aurora::ERFFile &erf, Aurora::GameID game,
                  std::set<Common::UString> &files, ExtractMode mode) {

    const Aurora::Archive::ResourceList &resources = erf.getResources();
    const size_t fileCount = resources.size();

    std::printf("Number of files: %u\n\n", (uint)fileCount);

    size_t i = 1;
    for (Aurora::Archive::ResourceList::const_iterator r = resources.begin(); r != resources.end(); ++r, ++i) {
        Common::UString name = r->name;
        if (name.empty())
            findHashedName(r->hash, name);

        name.replaceAll('\\', '/');

        if (mode == kExtractModeStrip)
            name = Common::FilePath::getFile(name);

        const Aurora::FileType type = TypeMan.aliasFileType(r->type, game);
        Common::UString fileName = TypeMan.addFileType(name, type);

        if (!files.empty() && (files.find(fileName) == files.end()))
            continue;

        if (mode == kExtractModeSubstitute)
            fileName.replaceAll('/', '=');

        std::printf("Extracting %u/%u: %s ... ", (uint)i, (uint)fileCount, fileName.c_str());

        Common::SeekableReadStream *stream = 0;
        try {
            stream = erf.getResource(r->index);

            dumpStream(*stream, fileName);

            std::printf("Done\n");
        } catch (Common::Exception &e) {
            Common::printException(e, "");
        }

        delete stream;
    }

}
Ejemplo n.º 2
0
Common::UString Creature::getBaseModel(const Common::UString &base) {
	const Aurora::TwoDARow &appearance = TwoDAReg.get2DA("appearance").getRow(_appearanceID);

	Common::UString baseModel = appearance.getString(base);

	// Male/Female
	baseModel.replaceAll('?', isFemale() ? 'F' : 'M');

	return baseModel;
}
Ejemplo n.º 3
0
void listVerboseFiles(Aurora::ERFFile &erf, Aurora::GameID game) {
    const Aurora::Archive::ResourceList &resources = erf.getResources();
    const size_t fileCount = resources.size();

    std::printf("Number of files: %u\n\n", (uint)fileCount);

    std::vector<FileEntry> fileEntries;
    fileEntries.reserve(fileCount);

    size_t nameLength = 10;
    for (Aurora::Archive::ResourceList::const_iterator r = resources.begin(); r != resources.end(); ++r) {
        const Aurora::FileType type = TypeMan.aliasFileType(r->type, game);

        Common::UString name = r->name;
        if (name.empty())
            findHashedName(r->hash, name);

        name.replaceAll('\\', '/');

        name = TypeMan.addFileType(name, type);

        nameLength = MAX<size_t>(nameLength, name.size() + 1);

        fileEntries.push_back(FileEntry(name, erf.getResourceSize(r->index)));
    }

    if ((nameLength % 2) == 1)
        nameLength++;

    std::printf("%sFileName%s|    Size\n", Common::UString(' ', (nameLength - 8) / 2).c_str(),
                Common::UString(' ', (nameLength - 8) / 2).c_str());
    std::printf("%s|===========\n", Common::UString('=', nameLength).c_str());

    for (std::vector<FileEntry>::const_iterator f = fileEntries.begin(); f != fileEntries.end(); ++f)
        std::printf("%-*s| %10d\n", (int)nameLength, f->file.c_str(), f->size);
}