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; } }
/********************************************************************* * BitBangストリームをデバイスに送信する。必要なら受信データも受け取る ********************************************************************* */ void BitBang(uchar *stream,int cnt,int wait,uchar *result) { bitBuf cmd; int reply_len = 0; memset(&cmd,0,sizeof(bitBuf)); memcpy(&cmd.data,stream,cnt); if(result) { cmd.cmd = PICSPX_BITREAD ; reply_len = cnt; }else{ cmd.cmd = PICSPX_BITBANG ; } cmd.size= cnt; cmd.wait= wait; #if DEBUG_STREAM // 1:データ列をデバッグする. dumpStream(cmd.data,cmd.size,cmd.wait); #endif if( QueryAVR((cmdBuf *)&cmd,result,reply_len) == 0) { //失敗. } }
void extractFiles(Aurora::HERFFile &herf) { const Aurora::Archive::ResourceList &resources = herf.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 fileName = r->name, fileExt = TypeMan.setFileType("", r->type); if (fileName.empty()) findHashedName(r->hash, fileName, fileExt); fileName = fileName + fileExt; std::printf("Extracting %u/%u: %s ... ", (uint)i, (uint)fileCount, fileName.c_str()); Common::SeekableReadStream *stream = 0; try { stream = herf.getResource(r->index); dumpStream(*stream, fileName); std::printf("Done\n"); } catch (Common::Exception &e) { Common::printException(e, ""); } delete stream; } }
void Quassel::logFatalMessage(const char *msg) { #ifdef Q_OS_MAC Q_UNUSED(msg) #else QFile dumpFile(coreDumpFileName()); dumpFile.open(QIODevice::Append); QTextStream dumpStream(&dumpFile); dumpStream << "Fatal: " << msg << '\n'; dumpStream.flush(); dumpFile.close(); #endif }
const QString &Quassel::coreDumpFileName() { if(_coreDumpFileName.isEmpty()) { QDir configDir(configDirPath()); _coreDumpFileName = configDir.absoluteFilePath(QString("Quassel-Crash-%1.log").arg(QDateTime::currentDateTime().toString("yyyyMMdd-hhmm"))); QFile dumpFile(_coreDumpFileName); dumpFile.open(QIODevice::Append); QTextStream dumpStream(&dumpFile); dumpStream << "Quassel IRC: " << _buildInfo.baseVersion << ' ' << _buildInfo.commitHash << '\n'; qDebug() << "Quassel IRC: " << _buildInfo.baseVersion << ' ' << _buildInfo.commitHash; dumpStream.flush(); dumpFile.close(); } return _coreDumpFileName; }
bool dumpResource(const Common::UString &name, Aurora::FileType type, Common::UString file) { Common::SeekableReadStream *res = ResMan.getResource(name, type); if (!res) return false; if (file.empty()) file = TypeMan.setFileType(name, type); bool success = dumpStream(*res, file); delete res; return success; }
/********************************************************************* * 1レコード分のBitBangストリームを送信して、結果も受け取る. ********************************************************************* */ void flushBitBangRead(uchar *buf) { if(bit_cnt) { #if DEBUG_STREAM // 1:データ列をデバッグする. printf("*flushBitBangRead bit_cnt=%d wait=%d\n",bit_cnt,bit_wait); #endif BitBang(bit_stream,bit_cnt,bit_wait,buf); #if DEBUG_STREAM // 1:データ列をデバッグする. printf("*INPUT=\n"); dumpStream(buf,bit_cnt,0); #endif bit_cnt = 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; } }