SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Toggle main menu visibility
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
7
namespace
vpkpp
{
8
9
constexpr
uint32_t
VPP_SIGNATURE_LIL
= 0x51890ACE;
10
constexpr
uint32_t
VPP_SIGNATURE_BIG
= 0xCE0A8951;
11
constexpr
uint32_t
VPP_ALIGNMENT
= 2048;
12
constexpr
std::string_view
VPP_EXTENSION
=
".vpp"
;
13
constexpr
std::string_view
VPP_EXTENSION_PC
=
".vpp_pc"
;
14
constexpr
std::string_view
VPP_EXTENSION_XBOX2
=
".vpp_xbox2"
;
15
16
class
VPP
:
public
PackFileReadOnly
{
17
public
:
18
enum
Flags
: uint32_t {
19
FLAG_NONE
= 0,
20
FLAG_COMPRESSED
= 1 << 0,
21
FLAG_CONDENSED
= 1 << 1
22
};
23
25
[[nodiscard]]
static
std::unique_ptr<PackFile>
open
(
const
std::string& path,
const
EntryCallback
& callback =
nullptr
);
26
27
[[nodiscard]] std::optional<std::vector<std::byte>>
readEntry
(
const
std::string& path_)
const override
;
28
29
[[nodiscard]]
Attribute
getSupportedEntryAttributes
()
const override
;
30
31
protected
:
32
using
PackFileReadOnly::PackFileReadOnly
;
33
34
Flags
flags
=
FLAG_NONE
;
35
uint32_t
entryBaseOffset
= 0;
36
std::vector<std::byte>
uncondensedData
;
37
38
private
:
39
VPKPP_REGISTER_PACKFILE_OPEN
(
VPP_EXTENSION
, &
VPP::open
);
40
VPKPP_REGISTER_PACKFILE_OPEN
(
VPP_EXTENSION_PC
, &
VPP::open
);
41
VPKPP_REGISTER_PACKFILE_OPEN
(
VPP_EXTENSION_XBOX2
, &
VPP::open
);
42
};
43
SOURCEPP_BITFLAGS_ENUM
(
VPP::Flags
)
44
45
}
// namespace vpkpp
SOURCEPP_BITFLAGS_ENUM
#define SOURCEPP_BITFLAGS_ENUM(Enum)
Defines bitwise operators for an enum or enum class.
Definition
Macros.h:29
PackFile.h
VPKPP_REGISTER_PACKFILE_OPEN
#define VPKPP_REGISTER_PACKFILE_OPEN(extension, function)
Definition
PackFile.h:254
vpkpp::PackFileReadOnly::PackFileReadOnly
PackFileReadOnly(const std::string &fullFilePath_)
Definition
PackFile.cpp:755
vpkpp::PackFile::EntryCallback
EntryCallbackBase< void > EntryCallback
Definition
PackFile.h:38
vpkpp::VPP
Definition
VPP.h:16
vpkpp::VPP::open
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open a VPP file.
Definition
VPP.cpp:12
vpkpp::VPP::flags
Flags flags
Definition
VPP.h:34
vpkpp::VPP::getSupportedEntryAttributes
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
vpkpp::VPP::Flags
Flags
Definition
VPP.h:18
vpkpp::VPP::FLAG_NONE
@ FLAG_NONE
Definition
VPP.h:19
vpkpp::VPP::FLAG_COMPRESSED
@ FLAG_COMPRESSED
Definition
VPP.h:20
vpkpp::VPP::FLAG_CONDENSED
@ FLAG_CONDENSED
Definition
VPP.h:21
vpkpp::VPP::uncondensedData
std::vector< std::byte > uncondensedData
Definition
VPP.h:36
vpkpp::VPP::readEntry
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
vpkpp::VPP::entryBaseOffset
uint32_t entryBaseOffset
Definition
VPP.h:35
vpkpp::VPP::PackFileReadOnly
PackFileReadOnly(const std::string &fullFilePath_)
Definition
PackFile.cpp:755
vpkpp
Definition
Attribute.h:5
vpkpp::VPP_ALIGNMENT
constexpr uint32_t VPP_ALIGNMENT
Definition
VPP.h:11
vpkpp::VPP_EXTENSION_PC
constexpr std::string_view VPP_EXTENSION_PC
Definition
VPP.h:13
vpkpp::VPP_SIGNATURE_BIG
constexpr uint32_t VPP_SIGNATURE_BIG
Definition
VPP.h:10
vpkpp::Attribute
Attribute
Definition
Attribute.h:7
vpkpp::VPP_EXTENSION
constexpr std::string_view VPP_EXTENSION
Definition
VPP.h:12
vpkpp::VPP_SIGNATURE_LIL
constexpr uint32_t VPP_SIGNATURE_LIL
Definition
VPP.h:9
vpkpp::VPP_EXTENSION_XBOX2
constexpr std::string_view VPP_EXTENSION_XBOX2
Definition
VPP.h:14
include
vpkpp
format
VPP.h
Generated on
for SourcePP by
1.17.0