Skip to content

Commit

Permalink
Properly write the right header when saving a replay
Browse files Browse the repository at this point in the history
The client stores the replays read from the stoc messages in the structure designed for the extended header, when writing check if the replay sent was actually using the extended header, if not, write only the base header to file
  • Loading branch information
edo9300 committed Sep 21, 2022
1 parent f03be91 commit 638f65e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gframe/replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ void Replay::SaveReplay(const epro::path_string& name) {
auto replay_file = fileopen(fmt::format(EPRO_TEXT("./replay/{}.yrpX"), name).data(), "wb");
if(replay_file == nullptr)
return;
fwrite(&pheader, 1, sizeof(pheader), replay_file);
auto header_len = (pheader.base.flag & REPLAY_EXTENDED_HEADER) ? sizeof(ExtendedReplayHeader) : sizeof(ReplayHeader);
fwrite(&pheader, 1, header_len, replay_file);
fwrite(comp_data.data(), 1, comp_data.size(), replay_file);
fclose(replay_file);
}
Expand Down

0 comments on commit 638f65e

Please sign in to comment.