void extractFiles(Aurora::RIMFile &rim, Aurora::GameID game) { const Aurora::Archive::ResourceList &resources = rim.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) { const Aurora::FileType type = TypeMan.aliasFileType(r->type, game); const Common::UString fileName = TypeMan.setFileType(r->name, type); std::printf("Extracting %u/%u: %s ... ", (uint)i, (uint)fileCount, fileName.c_str()); Common::SeekableReadStream *stream = 0; try { stream = rim.getResource(r->index); dumpStream(*stream, fileName); std::printf("Done\n"); } catch (Common::Exception &e) { Common::printException(e, ""); } delete stream; } }
void listFiles(Aurora::RIMFile &rim, Aurora::GameID game) { const Aurora::Archive::ResourceList &resources = rim.getResources(); const size_t fileCount = resources.size(); std::printf("Number of files: %u\n\n", (uint)fileCount); std::printf(" Filename | Size\n"); std::printf("=====================================|===========\n"); for (Aurora::Archive::ResourceList::const_iterator r = resources.begin(); r != resources.end(); ++r) { const Aurora::FileType type = TypeMan.aliasFileType(r->type, game); std::printf("%32s%s | %10d\n", r->name.c_str(), TypeMan.setFileType("", type).c_str(), rim.getResourceSize(r->index)); } }