SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
VPP.h
Go to the documentation of this file.
1// ReSharper disable CppRedundantQualifier
2
3#pragma once
4
5#include "../PackFile.h"
6
7namespace vpkpp {
8
9constexpr uint32_t VPP_SIGNATURE_LIL = 0x51890ACE;
10constexpr uint32_t VPP_SIGNATURE_BIG = 0xCE0A8951;
11constexpr uint32_t VPP_ALIGNMENT = 2048;
12constexpr std::string_view VPP_EXTENSION = ".vpp";
13constexpr std::string_view VPP_EXTENSION_PC = ".vpp_pc";
14constexpr std::string_view VPP_EXTENSION_XBOX2 = ".vpp_xbox2";
15
16class VPP : public PackFileReadOnly {
17public:
18 enum Flags : uint32_t {
22 };
23
25 [[nodiscard]] static std::unique_ptr<PackFile> open(const std::string& path, const EntryCallback& callback = nullptr);
26
27 static constexpr std::string_view GUID = "C47C5C4D88AE4032967F8CDC93D6D2E1";
28
29 [[nodiscard]] constexpr std::string_view getGUID() const override {
30 return VPP::GUID;
31 }
32
33 [[nodiscard]] std::optional<std::vector<std::byte>> readEntry(const std::string& path_) const override;
34
35 [[nodiscard]] Attribute getSupportedEntryAttributes() const override;
36
37protected:
39
41 uint32_t entryBaseOffset = 0;
42 std::vector<std::byte> uncondensedData;
43
44private:
48};
50
51} // namespace vpkpp
#define SOURCEPP_BITFLAGS_ENUM(Enum)
Defines bitwise operators for an enum or enum class.
Definition Macros.h:26
#define VPKPP_REGISTER_PACKFILE_OPEN(extension, function)
Definition PackFile.h:255
PackFileReadOnly(const std::string &fullFilePath_)
Definition PackFile.cpp:728
EntryCallbackBase< void > EntryCallback
Definition PackFile.h:38
constexpr std::string_view getGUID() const override
Get the GUID corresponding to the pack file type.
Definition VPP.h:29
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open a VPP file.
Definition VPP.cpp:12
static constexpr std::string_view GUID
Definition VPP.h:27
Flags flags
Definition VPP.h:40
Attribute getSupportedEntryAttributes() const override
Returns a list of supported entry attributes Mostly for GUI programs that show entries and their meta...
Definition VPP.cpp:263
@ FLAG_NONE
Definition VPP.h:19
@ FLAG_COMPRESSED
Definition VPP.h:20
@ FLAG_CONDENSED
Definition VPP.h:21
std::vector< std::byte > uncondensedData
Definition VPP.h:42
std::optional< std::vector< std::byte > > readEntry(const std::string &path_) const override
Try to read the entry's data to a bytebuffer.
Definition VPP.cpp:220
uint32_t entryBaseOffset
Definition VPP.h:41
PackFileReadOnly(const std::string &fullFilePath_)
Definition PackFile.cpp:728
constexpr uint32_t VPP_ALIGNMENT
Definition VPP.h:11
constexpr std::string_view VPP_EXTENSION_PC
Definition VPP.h:13
constexpr uint32_t VPP_SIGNATURE_BIG
Definition VPP.h:10
Attribute
Definition Attribute.h:7
constexpr std::string_view VPP_EXTENSION
Definition VPP.h:12
constexpr uint32_t VPP_SIGNATURE_LIL
Definition VPP.h:9
constexpr std::string_view VPP_EXTENSION_XBOX2
Definition VPP.h:14