SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Toggle main menu visibility
Loading...
Searching...
No Matches
GMA.h
Go to the documentation of this file.
1
// ReSharper disable CppRedundantQualifier
2
3
#pragma once
4
5
#include <
sourcepp/parser/Binary.h
>
6
7
#include "
../PackFile.h
"
8
9
namespace
vpkpp
{
10
11
constexpr
auto
GMA_SIGNATURE
=
sourcepp::parser::binary::makeFourCC
(
"GMAD"
);
12
constexpr
std::string_view
GMA_EXTENSION
=
".gma"
;
13
14
class
GMA
:
public
PackFile
{
15
protected
:
16
struct
Header
{
17
int32_t
signature
;
18
uint8_t
version
;
19
uint64_t
steamID
;
20
uint64_t
timestamp
;
21
std::string
requiredContent
;
22
std::string
addonName
;
23
std::string
addonDescription
;
24
std::string
addonAuthor
;
25
int32_t
addonVersion
;
26
};
27
28
public
:
30
[[nodiscard]]
static
std::unique_ptr<PackFile>
open
(
const
std::string& path,
const
EntryCallback
& callback =
nullptr
);
31
32
[[nodiscard]]
constexpr
bool
hasEntryChecksums
()
const override
{
33
return
true
;
34
}
35
36
[[nodiscard]] std::vector<std::string>
verifyEntryChecksums
()
const override
;
37
38
[[nodiscard]]
bool
hasPackFileChecksum
()
const override
;
39
40
[[nodiscard]]
bool
verifyPackFileChecksum
()
const override
;
41
42
[[nodiscard]] std::optional<std::vector<std::byte>>
readEntry
(
const
std::string& path_)
const override
;
43
44
bool
bake
(
const
std::string& outputDir_
/*= ""*/
,
BakeOptions
options
/*= {}*/
,
const
EntryCallback
& callback
/*= nullptr*/
)
override
;
45
46
[[nodiscard]]
Attribute
getSupportedEntryAttributes
()
const override
;
47
48
[[nodiscard]]
explicit
operator
std::string()
const override
;
49
50
protected
:
51
using
PackFile::PackFile
;
52
53
void
addEntryInternal
(
Entry
& entry,
const
std::string& path, std::vector<std::byte>& buffer,
EntryOptions
options)
override
;
54
55
Header
header
{};
56
57
private
:
58
VPKPP_REGISTER_PACKFILE_OPEN
(
GMA_EXTENSION
, &
GMA::open
);
59
};
60
61
}
// namespace vpkpp
Binary.h
PackFile.h
VPKPP_REGISTER_PACKFILE_OPEN
#define VPKPP_REGISTER_PACKFILE_OPEN(extension, function)
Definition
PackFile.h:254
vpkpp::Entry
This class represents the metadata that a file has inside a PackFile.
Definition
Entry.h:14
vpkpp::GMA
Definition
GMA.h:14
vpkpp::GMA::addEntryInternal
void addEntryInternal(Entry &entry, const std::string &path, std::vector< std::byte > &buffer, EntryOptions options) override
Definition
GMA.cpp:108
vpkpp::GMA::header
Header header
Definition
GMA.h:55
vpkpp::GMA::verifyPackFileChecksum
bool verifyPackFileChecksum() const override
Verify the checksum of the entire file, returns true on success Will return true if there is no check...
Definition
GMA.cpp:75
vpkpp::GMA::getSupportedEntryAttributes
Attribute getSupportedEntryAttributes() const override
Returns a list of supported entry attributes Mostly for GUI programs that show entries and their meta...
Definition
GMA.cpp:196
vpkpp::GMA::open
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open a GMA file.
Definition
GMA.cpp:13
vpkpp::GMA::hasEntryChecksums
constexpr bool hasEntryChecksums() const override
Returns true if the format has a checksum for each entry.
Definition
GMA.h:32
vpkpp::GMA::verifyEntryChecksums
std::vector< std::string > verifyEntryChecksums() const override
Verify the checksums of each file, if a file fails the check its path will be added to the vector If ...
Definition
GMA.cpp:67
vpkpp::GMA::hasPackFileChecksum
bool hasPackFileChecksum() const override
Returns true if the entire file has a checksum.
Definition
GMA.cpp:71
vpkpp::GMA::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
GMA.cpp:89
vpkpp::GMA::PackFile
PackFile(const PackFile &other)=delete
vpkpp::PackFile::EntryCallback
EntryCallbackBase< void > EntryCallback
Definition
PackFile.h:38
vpkpp::PackFile::bake
bool bake()
If output folder is an empty string, it will overwrite the original.
Definition
PackFile.cpp:369
vpkpp::PackFile::PackFile
PackFile(const PackFile &other)=delete
sourcepp::parser::binary::makeFourCC
consteval uint32_t makeFourCC(const char fourCC[4])
Creates a FourCC identifier from a string of 4 characters.
Definition
Binary.h:20
vpkpp
Definition
Attribute.h:5
vpkpp::GMA_EXTENSION
constexpr std::string_view GMA_EXTENSION
Definition
GMA.h:12
vpkpp::Attribute
Attribute
Definition
Attribute.h:7
vpkpp::GMA_SIGNATURE
constexpr auto GMA_SIGNATURE
Definition
GMA.h:11
vpkpp::BakeOptions
Definition
Options.h:20
vpkpp::EntryOptions
Definition
Options.h:34
vpkpp::GMA::Header
Definition
GMA.h:16
vpkpp::GMA::Header::requiredContent
std::string requiredContent
Definition
GMA.h:21
vpkpp::GMA::Header::timestamp
uint64_t timestamp
Definition
GMA.h:20
vpkpp::GMA::Header::addonDescription
std::string addonDescription
Definition
GMA.h:23
vpkpp::GMA::Header::addonVersion
int32_t addonVersion
Definition
GMA.h:25
vpkpp::GMA::Header::steamID
uint64_t steamID
Definition
GMA.h:19
vpkpp::GMA::Header::version
uint8_t version
Definition
GMA.h:18
vpkpp::GMA::Header::addonAuthor
std::string addonAuthor
Definition
GMA.h:24
vpkpp::GMA::Header::signature
int32_t signature
Definition
GMA.h:17
vpkpp::GMA::Header::addonName
std::string addonName
Definition
GMA.h:22
include
vpkpp
format
GMA.h
Generated on
for SourcePP by
1.17.0