bool BufferToArchive(MPQHANDLE &hMpq, const buffer &buf, const std::string &mpqFilePath) { if ( hMpq == nullptr ) CHKD_ERR("NULL MPQ file specified for writing buffer"); else { DWORD dataSize = (DWORD)buf.size(); LPVOID dataPointer = (LPVOID)buf.getPtr(0); if ( MpqAddFileFromBuffer(hMpq, dataPointer, dataSize, mpqFilePath.c_str(), MAFA_COMPRESS | MAFA_REPLACE_EXISTING) == TRUE ) return true; else CHKD_ERR("Failed to add buffered file to archive"); } return false; }