Skip to content

Commit

Permalink
feat(Vfs): allow setting Vfs save date
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed Dec 6, 2024
1 parent 2cdc8e3 commit afe886a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/zenkit/Vfs.hh
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ namespace zenkit {
/// \return The node with the given name or `nullptr` if no node with the given name was found.
[[nodiscard]] ZKAPI VfsNode* find(std::string_view name) noexcept;

ZKAPI void save(Write* w, GameVersion version) const;
ZKAPI void save(Write* w, GameVersion version, time_t unix_t = 0) const;

private:
ZKINT void mount_disk(std::byte const* buf, std::size_t size, VfsOverwriteBehavior overwrite);
Expand Down
4 changes: 2 additions & 2 deletions src/Vfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ namespace zenkit {
return dos;
}

void Vfs::save(Write* w, GameVersion version) const {
void Vfs::save(Write* w, GameVersion version, time_t unix_t) const {
std::vector<std::byte> catalog;
auto write_catalog = Write::to(&catalog);

Expand Down Expand Up @@ -360,7 +360,7 @@ namespace zenkit {
w->write_string(version == GameVersion::GOTHIC_1 ? VFS_DISK_SIGNATURE_G1 : VFS_DISK_SIGNATURE_G2);
w->write_uint(index);
w->write_uint(files);
w->write_uint(vfs_unix_to_dos_time(time(nullptr)));
w->write_uint(unix_t == 0 ? vfs_unix_to_dos_time(time(nullptr)) : vfs_unix_to_dos_time(time(&unix_t)));
w->write_uint(off + catalog.size());
w->write_uint(header_size);
w->write_uint(80);
Expand Down

0 comments on commit afe886a

Please sign in to comment.