Skip to content

Commit ae94d7f

Browse files
vpkpp: HOG and VPP should not be case-sensitive, and clean up VPP a bit
1 parent 48ee5d2 commit ae94d7f

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

include/vpkpp/format/HOG.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ class HOG : public PackFileReadOnly {
1818
return HOG::GUID;
1919
}
2020

21-
[[nodiscard]] constexpr bool isCaseSensitive() const override {
22-
return true;
23-
}
24-
2521
[[nodiscard]] std::optional<std::vector<std::byte>> readEntry(const std::string& path_) const override;
2622

2723
[[nodiscard]] Attribute getSupportedEntryAttributes() const override;

include/vpkpp/format/VPP.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ class VPP : public PackFileReadOnly {
2020
return VPP::GUID;
2121
}
2222

23-
[[nodiscard]] constexpr bool isCaseSensitive() const override {
24-
return true;
25-
}
26-
2723
[[nodiscard]] std::optional<std::vector<std::byte>> readEntry(const std::string& path_) const override;
2824

2925
[[nodiscard]] Attribute getSupportedEntryAttributes() const override;

src/vpkpp/format/VPP.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ std::unique_ptr<PackFile> VPP::open(const std::string& path, const EntryCallback
3838
}
3939

4040
// Get file table offset
41-
// 16 is the byte size of the header
42-
uint32_t headerSize = 16;
41+
static constexpr uint32_t headerSize = sizeof(uint32_t) * 4;
4342
reader.seek_in(headerSize + sourcepp::math::paddingForAlignment(VPP_ALIGNMENT, headerSize));
4443

4544
// Get first file offset
46-
// 64 is the byte size of each file directory entry
47-
uint32_t fileTableSize = 64 * entryCount;
45+
const uint32_t fileTableSize = (60 + sizeof(uint32_t)) * entryCount;
4846
uint32_t entryOffset = reader.tell_in() + fileTableSize + sourcepp::math::paddingForAlignment(VPP_ALIGNMENT, fileTableSize);
4947

5048
// Read file entries
@@ -78,13 +76,11 @@ std::unique_ptr<PackFile> VPP::open(const std::string& path, const EntryCallback
7876
}
7977

8078
// Get file table offset
81-
// 16 is the byte size of the header
82-
uint32_t headerSize = 16;
79+
static constexpr uint32_t headerSize = sizeof(uint32_t) * 4;
8380
reader.seek_in(headerSize + sourcepp::math::paddingForAlignment(VPP_ALIGNMENT, headerSize));
8481

8582
// Get first file offset
86-
// 32 is the byte size of each file directory entry
87-
uint32_t fileTableSize = 32 * entryCount;
83+
const uint32_t fileTableSize = (24 + sizeof(uint32_t) * 2) * entryCount;
8884
uint32_t entryOffset = reader.tell_in() + fileTableSize + sourcepp::math::paddingForAlignment(VPP_ALIGNMENT, fileTableSize);
8985

9086
// Read file entries

0 commit comments

Comments
 (0)