From 12b108c2f8749fb4a98a62b23576d1a5f1088b57 Mon Sep 17 00:00:00 2001 From: craftablescience Date: Sat, 4 Jan 2025 16:36:23 -0500 Subject: [PATCH 1/2] vpkpp: clean up GCF a bit --- src/vpkpp/format/GCF.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/vpkpp/format/GCF.cpp b/src/vpkpp/format/GCF.cpp index 1202145e2..fd85580fc 100644 --- a/src/vpkpp/format/GCF.cpp +++ b/src/vpkpp/format/GCF.cpp @@ -18,17 +18,14 @@ std::unique_ptr GCF::open(const std::string& path, const EntryCallback return nullptr; } - // Create the pack file auto* gcf = new GCF{path}; auto packFile = std::unique_ptr(gcf); - // open file FileStream reader(gcf->fullFilePath); reader.seek_in(0); - // we read the main header here (not the block header) + // read the main header here (not the block header) reader.read(gcf->header); - if (gcf->header.dummy1 != 1 && gcf->header.dummy2 != 1 && gcf->header.gcfversion != 6) { /** * This should NEVER occur when reading a "normal" gcf file. @@ -39,8 +36,7 @@ std::unique_ptr GCF::open(const std::string& path, const EntryCallback return nullptr; } - uintmax_t real_size = std::filesystem::file_size(gcf->fullFilePath); - if (real_size != gcf->header.filesize) { + if (gcf->header.filesize != std::filesystem::file_size(gcf->fullFilePath)) { // again, this should never occur with a valid gcf file return nullptr; } @@ -103,14 +99,13 @@ std::unique_ptr GCF::open(const std::string& path, const EntryCallback reader.read(gcf->dirheader); uint64_t diroffset = reader.tell_in() + (gcf->dirheader.itemcount * 28); - uint64_t currentoffset; std::vector direntries{}; for (int i = 0; i < gcf->dirheader.itemcount; i++) { DirectoryEntry2& entry = direntries.emplace_back(); reader.read(entry.entry_real); - currentoffset = reader.tell_in(); + auto currentoffset = reader.tell_in(); reader.seek_in_u(diroffset + entry.entry_real.nameoffset); reader.read(entry.filename); if (entry.entry_real.dirtype != 0) { // if not directory @@ -252,7 +247,6 @@ std::optional> GCF::readEntry(const std::string& path_) c FileStream stream{this->fullFilePath}; if (!stream) { - //printf("!stream\n"); return std::nullopt; } From 641be9876f77afbb311ff75cd938187e8cd5d263 Mon Sep 17 00:00:00 2001 From: craftablescience Date: Sat, 4 Jan 2025 16:37:09 -0500 Subject: [PATCH 2/2] vpkpp: GCFs are case-sensitive apparently --- include/vpkpp/format/GCF.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/vpkpp/format/GCF.h b/include/vpkpp/format/GCF.h index 297e833e1..e409b8ab8 100644 --- a/include/vpkpp/format/GCF.h +++ b/include/vpkpp/format/GCF.h @@ -124,6 +124,10 @@ class GCF : public PackFileReadOnly { [[nodiscard]] std::vector verifyEntryChecksums() const override; + [[nodiscard]] constexpr bool isCaseSensitive() const override { + return true; + } + [[nodiscard]] std::optional> readEntry(const std::string& path_) const override; [[nodiscard]] Attribute getSupportedEntryAttributes() const override;