static bool WriteHeader(ZFile& File) { REPLAY_HEADER_RG Header; Header.Header = RG_REPLAY_MAGIC_NUMBER; Header.ReplayBinaryVersion = RG_REPLAY_BINARY_VERSION; Header.Timestamp = static_cast<i64>(time(nullptr)); Header.ClientVersionMajor = RGUNZ_VERSION_MAJOR; Header.ClientVersionMinor = RGUNZ_VERSION_MINOR; Header.ClientVersionPatch = RGUNZ_VERSION_PATCH; Header.ClientVersionRevision = RGUNZ_VERSION_REVISION; return File.Write(Header); }
bool WriteReplayEnd(ZFile& File, ZObserverCommandList& ReplayCommandList) { // Write the commands for (auto* pItem : ReplayCommandList) { auto* pCommand = pItem->pCommand; constexpr int BUF_SIZE = 1024; char CommandBuffer[BUF_SIZE]; auto Size = pCommand->GetData(CommandBuffer, BUF_SIZE); if (Size <= 0) { MLog("WriteReplayEnd -- Invalid command!\n"); continue; } WRITE(pItem->fTime); WRITE(pCommand->m_Sender); WRITE(Size); File.Write(CommandBuffer, Size); } return true; }