int HPFArchive::listMembers(Common::ArchiveMemberList &list) { int numMembers = 0; for (FileMap::const_iterator i = _files.begin(); i != _files.end(); ++i) { list.push_back(Common::ArchiveMemberList::value_type(new Common::GenericArchiveMember(i->_key, this))); numMembers++; } return numMembers; }
int PlainArchive::listMembers(Common::ArchiveMemberList &list) const { int count = 0; for (FileMap::const_iterator i = _files.begin(); i != _files.end(); ++i) { list.push_back(Common::ArchiveMemberList::value_type(new Common::GenericArchiveMember(i->_key, this))); ++count; } return count; }
int TlkArchive::listMembers(Common::ArchiveMemberList &list) const { uint count = 0; for (; count < _entryCount; ++count) { const Common::String name = Common::String::format("%08u.AUD", _fileEntries[count * 2 + 0]); list.push_back(Common::ArchiveMemberList::value_type(new Common::GenericArchiveMember(name, this))); } return count; }
int XARCArchive::listMembers(Common::ArchiveMemberList &list) const { int files = 0; for (Common::ArchiveMemberList::const_iterator it = _members.begin(); it != _members.end(); ++it) { // Add all the members to the list list.push_back(*it); files++; } return files; }
int PackageSet::listMembers(Common::ArchiveMemberList &list) const { Common::HashMap<Common::String, Common::ArchiveMemberPtr>::const_iterator it = _files.begin(); Common::HashMap<Common::String, Common::ArchiveMemberPtr>::const_iterator end = _files.end(); int count = 0; for (; it != end; ++it) { const Common::ArchiveMemberPtr ptr(it->_value); list.push_back(ptr); count++; } return count; }
int AndroidAssetArchive::listMembers(Common::ArchiveMemberList &member_list) { JNIEnv *env = JNI::getEnv(); Common::List<Common::String> dirlist; dirlist.push_back(""); int count = 0; while (!dirlist.empty()) { const Common::String dir = dirlist.back(); dirlist.pop_back(); jstring jpath = env->NewStringUTF(dir.c_str()); jobjectArray jpathlist = (jobjectArray)env->CallObjectMethod(_am, MID_list, jpath); if (env->ExceptionCheck()) { warning("Error while calling AssetManager->list(%s). Ignoring.", dir.c_str()); env->ExceptionDescribe(); env->ExceptionClear(); // May as well keep going ... continue; } env->DeleteLocalRef(jpath); for (jsize i = 0; i < env->GetArrayLength(jpathlist); ++i) { jstring elem = (jstring)env->GetObjectArrayElement(jpathlist, i); const char *p = env->GetStringUTFChars(elem, 0); Common::String thispath = dir; if (!thispath.empty()) thispath += "/"; thispath += p; // Assume files have a . in them, and directories don't if (strchr(p, '.')) { member_list.push_back(getMember(thispath)); ++count; } else { dirlist.push_back(thispath); } env->ReleaseStringUTFChars(elem, p); env->DeleteLocalRef(elem); } env->DeleteLocalRef(jpathlist); } return count; }
int XARCArchive::listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) { int matches = 0; for (Common::ArchiveMemberList::iterator it = _members.begin(); it != _members.end(); ++it) { if ((*it)->getName().matchString(pattern)) { // This file matches, add it list.push_back(*it); matches++; } } return matches; }
bool PackageManager::loadPackage(const Common::String &fileName, const Common::String &mountPosition) { debug(3, "loadPackage(%s, %s)", fileName.c_str(), mountPosition.c_str()); Common::Archive *zipFile = Common::makeZipArchive(fileName); if (zipFile == NULL) { BS_LOG_ERRORLN("Unable to mount file \"%s\" to \"%s\"", fileName.c_str(), mountPosition.c_str()); return false; } else { BS_LOGLN("Package '%s' mounted as '%s'.", fileName.c_str(), mountPosition.c_str()); Common::ArchiveMemberList files; zipFile->listMembers(files); debug(3, "Capacity %d", files.size()); for (Common::ArchiveMemberList::iterator it = files.begin(); it != files.end(); ++it) debug(3, "%s", (*it)->getName().c_str()); _archiveList.push_front(new ArchiveEntry(zipFile, mountPosition)); return true; } }
void Lingo::runTests() { Common::File inFile; Common::ArchiveMemberList fsList; SearchMan.listMatchingMembers(fsList, "*.lingo"); Common::StringArray fileList; int counter = 1; for (Common::ArchiveMemberList::iterator it = fsList.begin(); it != fsList.end(); ++it) fileList.push_back((*it)->getName()); Common::sort(fileList.begin(), fileList.end()); for (uint i = 0; i < fileList.size(); i++) { Common::SeekableReadStream *const stream = SearchMan.createReadStreamForMember(fileList[i]); if (stream) { uint size = stream->size(); char *script = (char *)calloc(size + 1, 1); stream->read(script, size); debugC(2, kDebugLingoCompile, "Compiling file %s of size %d, id: %d", fileList[i].c_str(), size, counter); _hadError = false; addCode(script, kMovieScript, counter); if (!_hadError) executeScript(kMovieScript, counter); else debugC(2, kDebugLingoCompile, "Skipping execution"); free(script); counter++; } inFile.close(); } }
Common::StringArray DefaultSaveFileManager::listSavefiles(const Common::String &pattern) { Common::String savePathName = getSavePath(); checkPath(Common::FSNode(savePathName)); if (getError().getCode() != Common::kNoError) return Common::StringArray(); // recreate FSNode since checkPath may have changed/created the directory Common::FSNode savePath(savePathName); Common::FSDirectory dir(savePath); Common::ArchiveMemberList savefiles; Common::StringArray results; Common::String search(pattern); if (dir.listMatchingMembers(savefiles, search) > 0) { for (Common::ArchiveMemberList::const_iterator file = savefiles.begin(); file != savefiles.end(); ++file) { results.push_back((*file)->getName()); } } return results; }
int AndroidAssetArchive::listMembers(Common::ArchiveMemberList &member_list) const { if (_hasCached) { member_list.insert(member_list.end(), _cachedMembers.begin(), _cachedMembers.end()); return _cachedMembers.size(); } int count = 0; AAssetDir *dir = AAssetManager_openDir(_am, ""); const char *file = AAssetDir_getNextFileName(dir); while (file) { member_list.push_back(getMember(file)); ++count; file = AAssetDir_getNextFileName(dir); } AAssetDir_close(dir); _cachedMembers = Common::ArchiveMemberList(member_list); _hasCached = true; return count; }
void ZipSoundArchive::openArchive(const char *path, const char *extension, SoundFormat format, int raw_frequency) { closeArchive(); if ((format == RAW || format == RAW80) && !raw_frequency) { error("openArchive() expects frequency for RAW data"); return; } debugCN(1, kDraciArchiverDebugLevel, "Trying to open ZIP archive %s: ", path); _archive = Common::makeZipArchive(path); _path = path; _extension = extension; _format = format; _defaultFreq = raw_frequency; if (_archive) { Common::ArchiveMemberList files; _archive->listMembers(files); _sampleCount = files.size(); debugC(1, kDraciArchiverDebugLevel, "Capacity %d", _sampleCount); } else { debugC(1, kDraciArchiverDebugLevel, "Failed"); } }
ResourceLoader::ResourceLoader() { int lab_counter = 0; _cacheDirty = false; _cacheMemorySize = 0; Lab *l; Common::ArchiveMemberList files; SearchMan.listMatchingMembers(files, "*.lab"); SearchMan.listMatchingMembers(files, "*.m4b"); if (files.empty()) error("Cannot find game data - check configuration file"); for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) { const Common::String filename = (*x)->getName(); l = new Lab(); if (l->open(filename)) { if (filename.equalsIgnoreCase("data005.lab")) _labs.push_front(l); else _labs.push_back(l); lab_counter++; } else { delete l; } } files.clear(); if (g_grim->getGameFlags() & GF_DEMO) { SearchMan.listMatchingMembers(files, "*.mus"); for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) { const Common::String filename = (*x)->getName(); l = new Lab(); if (l->open(filename)) { _labs.push_back(l); lab_counter++; } else { delete l; } } } }
int ZipArchive::listMembers(Common::ArchiveMemberList &list) { int matches = 0; int err = unzGoToFirstFile(_zipFile); while (err == UNZ_OK) { char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; if (unzGetCurrentFileInfo(_zipFile, NULL, szCurrentFileName, sizeof(szCurrentFileName)-1, NULL, 0, NULL, 0) == UNZ_OK) { list.push_back(ArchiveMemberList::value_type(new GenericArchiveMember(szCurrentFileName, this))); matches++; } err = unzGoToNextFile(_zipFile); } return matches; }
int PackageManager::doSearch(Common::ArchiveMemberList &list, const Common::String &filter, const Common::String &path, uint typeFilter) { Common::String normalizedFilter = normalizePath(filter, _currentDirectory); int num = 0; if (path.size() > 0) warning("STUB: PackageManager::doSearch(<%s>, <%s>, %d)", filter.c_str(), path.c_str(), typeFilter); // Loop through checking each archive Common::List<ArchiveEntry *>::iterator i; for (i = _archiveList.begin(); i != _archiveList.end(); ++i) { Common::ArchiveMemberList memberList; if (!normalizedFilter.hasPrefix((*i)->_mountPath)) { // The mount path is in different subtree. Skipping continue; } // Construct relative path Common::String resFilter(&normalizedFilter.c_str()[(*i)->_mountPath.size()]); if ((*i)->archive->listMatchingMembers(memberList, resFilter) == 0) continue; // Create a list of the matching names for (Common::ArchiveMemberList::iterator it = memberList.begin(); it != memberList.end(); ++it) { if (((typeFilter & PackageManager::FT_DIRECTORY) && (*it)->getName().hasSuffix("/")) || ((typeFilter & PackageManager::FT_FILE) && !(*it)->getName().hasSuffix("/"))) { // Do not add duplicate files bool found = false; for (Common::ArchiveMemberList::iterator it1 = list.begin(); it1 != list.end(); ++it1) { if ((*it1)->getName() == (*it)->getName()) { found = true; break; } } if (!found) list.push_back(*it); num++; } } } return num; }
int NSArchive::listMembers(Common::ArchiveMemberList &list) const { for (uint32 i = 0; i < _numFiles; i++) { list.push_back(Common::SharedPtr<Common::GenericArchiveMember>(new Common::GenericArchiveMember(_archiveDir[i], this))); } return _numFiles; }
bool Resource::reset() { unloadAllPakFiles(); Common::FSNode dir(ConfMan.get("path")); if (!dir.exists() || !dir.isDirectory()) error("invalid game path '%s'", dir.getPath().c_str()); if (_vm->game() == GI_KYRA1) { // We only need kyra.dat for the demo. if (_vm->gameFlags().isDemo && !_vm->gameFlags().isTalkie) return true; if (!_vm->gameFlags().isDemo && _vm->gameFlags().isTalkie) { // List of files in the talkie version, which can never be unload. static const char * const list[] = { "ADL.PAK", "CHAPTER1.VRM", "COL.PAK", "FINALE.PAK", "INTRO1.PAK", "INTRO2.PAK", "INTRO3.PAK", "INTRO4.PAK", "MISC.PAK", "SND.PAK", "STARTUP.PAK", "XMI.PAK", "CAVE.APK", "DRAGON1.APK", "DRAGON2.APK", "LAGOON.APK", 0 }; loadProtectedFiles(list); } else { Common::ArchiveMemberList files; _files.listMatchingMembers(files, "*.PAK"); _files.listMatchingMembers(files, "*.APK"); for (Common::ArchiveMemberList::const_iterator i = files.begin(); i != files.end(); ++i) { Common::String name = (*i)->getName(); name.toUppercase(); // No PAK file if (name == "TWMUSIC.PAK") continue; // We need to only load the script archive for the language the user specified if (name == ((_vm->gameFlags().lang == Common::EN_ANY) ? "JMC.PAK" : "EMC.PAK")) continue; Common::Archive *archive = loadArchive(name, *i); if (archive) _files.add(name, archive, 0, false); else error("Couldn't load PAK file '%s'", name.c_str()); } } } else if (_vm->game() == GI_KYRA2) { if (_vm->gameFlags().useInstallerPackage) _files.add("installer", loadInstallerArchive("WESTWOOD", "%03d", 6), 2, false); // mouse pointer, fonts, etc. required for initialization if (_vm->gameFlags().isDemo && !_vm->gameFlags().isTalkie) { loadPakFile("GENERAL.PAK"); } else { loadPakFile("INTROGEN.PAK"); loadPakFile("OTHER.PAK"); } } else if (_vm->game() == GI_KYRA3) { if (_vm->gameFlags().useInstallerPackage) { if (!loadPakFile("WESTWOOD.001")) error("Couldn't load file: 'WESTWOOD.001'"); } if (!loadFileList("FILEDATA.FDT")) error("Couldn't load file: 'FILEDATA.FDT'"); } else if (_vm->game() == GI_LOL) { if (_vm->gameFlags().useInstallerPackage) _files.add("installer", loadInstallerArchive("WESTWOOD", "%d", 0), 2, false); if (!_vm->gameFlags().isTalkie && !_vm->gameFlags().isDemo) { static const char * const list[] = { "GENERAL.PAK", 0 }; loadProtectedFiles(list); } } else { error("Unknown game id: %d", _vm->game()); return false; // for compilers that don't support NORETURN } return true; }
void dumpEveryResultAction(const Common::String &destFile) { Common::HashMap<Common::String, byte> count; Common::HashMap<Common::String, bool> fileAlreadyUsed; Common::DumpFile output; output.open(destFile); // Find scr files Common::ArchiveMemberList list; SearchMan.listMatchingMembers(list, "*.scr"); for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) { Common::SeekableReadStream *stream = (*iter)->createReadStream(); Common::String line = stream->readLine(); trimCommentsAndWhiteSpace(&line); while (!stream->eos()) { if (line.matchString("*:add*", true)) { tryToDumpLine("add", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:animplay*", true)) { tryToDumpLine("animplay", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:animpreload*", true)) { tryToDumpLine("animpreload", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:animunload*", true)) { tryToDumpLine("animunload", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:attenuate*", true)) { tryToDumpLine("attenuate", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:assign*", true)) { tryToDumpLine("assign", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:change_location*", true)) { tryToDumpLine("change_location", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:crossfade*", true) && !fileAlreadyUsed["add"]) { tryToDumpLine("crossfade", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:debug*", true)) { tryToDumpLine("debug", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:delay_render*", true)) { tryToDumpLine("delay_render", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:disable_control*", true)) { tryToDumpLine("disable_control", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:disable_venus*", true)) { tryToDumpLine("disable_venus", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:display_message*", true)) { tryToDumpLine("display_message", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:dissolve*", true)) { tryToDumpLine("dissolve", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:distort*", true)) { tryToDumpLine("distort", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:enable_control*", true)) { tryToDumpLine("enable_control", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:flush_mouse_events*", true)) { tryToDumpLine("flush_mouse_events", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:inventory*", true)) { tryToDumpLine("inventory", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:kill*", true)) { tryToDumpLine("kill", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:menu_bar_enable*", true)) { tryToDumpLine("menu_bar_enable", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:music*", true)) { tryToDumpLine("music", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:pan_track*", true)) { tryToDumpLine("pan_track", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:playpreload*", true)) { tryToDumpLine("playpreload", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:preferences*", true)) { tryToDumpLine("preferences", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:quit*", true)) { tryToDumpLine("quit", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:random*", true)) { tryToDumpLine("random", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:region*", true)) { tryToDumpLine("region", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:restore_game*", true)) { tryToDumpLine("restore_game", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:rotate_to*", true)) { tryToDumpLine("rotate_to", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:save_game*", true)) { tryToDumpLine("save_game", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:set_partial_screen*", true)) { tryToDumpLine("set_partial_screen", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:set_screen*", true)) { tryToDumpLine("set_screen", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:set_venus*", true)) { tryToDumpLine("set_venus", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:stop*", true)) { tryToDumpLine("stop", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:streamvideo*", true)) { tryToDumpLine("streamvideo", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:syncsound*", true)) { tryToDumpLine("syncsound", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:timer*", true)) { tryToDumpLine("timer", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:ttytext*", true)) { tryToDumpLine("ttytext", line, &count, &fileAlreadyUsed, output); } else if (line.matchString("*:universe_music*", true)) { tryToDumpLine("universe_music", line, &count, &fileAlreadyUsed, output); } line = stream->readLine(); trimCommentsAndWhiteSpace(&line); } for (Common::HashMap<Common::String, bool>::iterator fileUsedIter = fileAlreadyUsed.begin(); fileUsedIter != fileAlreadyUsed.end(); ++fileUsedIter) { fileUsedIter->_value = false; } } output.close(); }
void MacFontManager::loadFonts() { Common::Archive *dat; dat = Common::makeZipArchive("classicmacfonts.dat"); if (!dat) { warning("Could not find classicmacfonts.dat. Falling back to built-in fonts"); _builtInFonts = true; return; } Common::ArchiveMemberList list; dat->listMembers(list); for (Common::ArchiveMemberList::iterator it = list.begin(); it != list.end(); ++it) { Common::SeekableReadStream *stream = dat->createReadStreamForMember((*it)->getName()); Common::MacResManager *fontFile = new Common::MacResManager(); if (!fontFile->loadFromMacBinary(*stream)) continue; Common::MacResIDArray fonds = fontFile->getResIDArray(MKTAG('F','O','N','D')); if (fonds.size() > 0) { for (Common::Array<uint16>::iterator iterator = fonds.begin(); iterator != fonds.end(); ++iterator) { Common::SeekableReadStream *fond = fontFile->getResource(MKTAG('F', 'O', 'N', 'D'), *iterator); Common::String familyName = fontFile->getResName(MKTAG('F', 'O', 'N', 'D'), *iterator); Graphics::MacFontFamily *fontFamily = new MacFontFamily(); fontFamily->load(*fond); Common::Array<Graphics::MacFontFamily::AsscEntry> *assoc = fontFamily->getAssocTable(); for (uint i = 0; i < assoc->size(); i++) { debug("size: %d style: %d id: %d", (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle, (*assoc)[i]._fontID); Common::SeekableReadStream *fontstream; MacFont *macfont; Graphics::MacFONTFont *font; fontstream = fontFile->getResource(MKTAG('N', 'F', 'N', 'T'), (*assoc)[i]._fontID); if (!fontstream) fontstream = fontFile->getResource(MKTAG('F', 'O', 'N', 'T'), (*assoc)[i]._fontID); if (!fontstream) { warning("Unknown FontId: %d", (*assoc)[i]._fontID); continue; } font = new Graphics::MacFONTFont; font->loadFont(*fontstream, fontFamily, (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle); delete fontstream; Common::String fontName = Common::String::format("%s-%d-%d", familyName.c_str(), (*assoc)[i]._fontStyle, (*assoc)[i]._fontSize); macfont = new MacFont(_fontNames.getVal(familyName, kMacFontNonStandard), (*assoc)[i]._fontSize, (*assoc)[i]._fontStyle); FontMan.assignFontToName(fontName, font); macfont->setFont(font); _fontRegistry.setVal(fontName, macfont); debug(2, " %s", fontName.c_str()); } delete fond; } } delete fontFile; } _builtInFonts = false; delete dat; }
int InstallerArchive::listMembers(Common::ArchiveMemberList &list) { for (FileMap::const_iterator it = _map.begin(); it != _map.end(); it++) list.push_back(getMember(it->_key)); return _map.size(); }
int MsCabinet::listMembers(Common::ArchiveMemberList &list) const { for (FileMap::const_iterator it = _fileMap.begin(); it != _fileMap.end(); it++) list.push_back(getMember(it->_key)); return _fileMap.size(); }
Common::SeekableReadStream *openDiskFile(const Common::String &filename) { uint32 prefixSize = 0; Common::SeekableReadStream *file = NULL; Common::String fixedFilename = filename; // Absolute path: TODO: Add specific fallbacks here. if (filename.contains(':')) { if (filename.hasPrefix("c:\\windows\\fonts\\")) { // East Side Story refers to "c:\windows\fonts\framd.ttf" fixedFilename = filename.c_str() + 17; } else { error("openDiskFile::Absolute path or invalid filename used in %s", filename.c_str()); } } // Try directly from SearchMan first Common::ArchiveMemberList files; SearchMan.listMatchingMembers(files, fixedFilename); for (Common::ArchiveMemberList::iterator it = files.begin(); it != files.end(); ++it) { if ((*it)->getName() == filename) { file = (*it)->createReadStream(); break; } } // File wasn't found in SearchMan, try to parse the path as a relative path. if (!file) { Common::FSNode searchNode = getNodeForRelativePath(filename); if (searchNode.exists() && !searchNode.isDirectory() && searchNode.isReadable()) { file = searchNode.createReadStream(); } } if (file) { uint32 magic1, magic2; magic1 = file->readUint32LE(); magic2 = file->readUint32LE(); bool compressed = false; if (magic1 == DCGF_MAGIC && magic2 == COMPRESSED_FILE_MAGIC) { compressed = true; } if (compressed) { uint32 dataOffset, compSize, uncompSize; dataOffset = file->readUint32LE(); compSize = file->readUint32LE(); uncompSize = file->readUint32LE(); byte *compBuffer = new byte[compSize]; if (!compBuffer) { error("Error allocating memory for compressed file '%s'", filename.c_str()); delete file; return NULL; } byte *data = new byte[uncompSize]; if (!data) { error("Error allocating buffer for file '%s'", filename.c_str()); delete[] compBuffer; delete file; return NULL; } file->seek(dataOffset + prefixSize, SEEK_SET); file->read(compBuffer, compSize); if (Common::uncompress(data, (unsigned long *)&uncompSize, compBuffer, compSize) != true) { error("Error uncompressing file '%s'", filename.c_str()); delete[] compBuffer; delete file; return NULL; } delete[] compBuffer; delete file; return new Common::MemoryReadStream(data, uncompSize, DisposeAfterUse::YES); } else { file->seek(0, SEEK_SET); return file; } return file; } return NULL; }