SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
WAD3.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
int8_t
WAD3_FILENAME_MAX_SIZE
= 16;
12
constexpr
auto
WAD3_SIGNATURE
=
sourcepp::parser::binary::makeFourCC
(
"WAD3"
);
13
constexpr
std::string_view
WAD3_EXTENSION
=
".wad"
;
14
18
class
WAD3
:
public
PackFile
{
19
public
:
21
static
std::unique_ptr<PackFile>
create
(
const
std::string& path);
22
24
[[nodiscard]]
static
std::unique_ptr<PackFile>
open
(
const
std::string& path,
const
EntryCallback
& callback =
nullptr
);
25
26
[[nodiscard]] std::optional<std::vector<std::byte>>
readEntry
(
const
std::string& path_)
const override
;
27
28
bool
bake
(
const
std::string& outputDir_
/*= ""*/
,
BakeOptions
options
/*= {}*/
,
const
EntryCallback
& callback
/*= nullptr*/
)
override
;
29
30
[[nodiscard]]
Attribute
getSupportedEntryAttributes
()
const override
;
31
32
protected
:
33
using
PackFile::PackFile
;
34
35
void
addEntryInternal
(
Entry
& entry,
const
std::string& path, std::vector<std::byte>& buffer,
EntryOptions
options)
override
;
36
37
private
:
38
VPKPP_REGISTER_PACKFILE_OPEN
(
WAD3_EXTENSION
, &
WAD3::open
);
39
};
40
41
}
// namespace vpkpp
Binary.h
PackFile.h
VPKPP_REGISTER_PACKFILE_OPEN
#define VPKPP_REGISTER_PACKFILE_OPEN(extension, function)
Definition
PackFile.h:245
vpkpp::Entry
This class represents the metadata that a file has inside a PackFile.
Definition
Entry.h:14
vpkpp::PackFile::EntryCallback
EntryCallbackBase< void > EntryCallback
Definition
PackFile.h:38
vpkpp::PackFile::PackFile
PackFile(const PackFile &other)=delete
vpkpp::WAD3
Valve GoldSrc WAD3 file.
Definition
WAD3.h:18
vpkpp::WAD3::open
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open a WAD3 file.
Definition
WAD3.cpp:61
vpkpp::WAD3::create
static std::unique_ptr< PackFile > create(const std::string &path)
Create a WAD3 file.
Definition
WAD3.cpp:52
vpkpp::WAD3::bake
bool bake(const std::string &outputDir_, BakeOptions options, const EntryCallback &callback) override
If output folder is an empty string, it will overwrite the original.
Definition
WAD3.cpp:146
vpkpp::WAD3::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
WAD3.cpp:118
vpkpp::WAD3::getSupportedEntryAttributes
Attribute getSupportedEntryAttributes() const override
Returns a list of supported entry attributes Mostly for GUI programs that show entries and their meta...
Definition
WAD3.cpp:225
vpkpp::WAD3::PackFile
PackFile(const PackFile &other)=delete
vpkpp::WAD3::addEntryInternal
void addEntryInternal(Entry &entry, const std::string &path, std::vector< std::byte > &buffer, EntryOptions options) override
Definition
WAD3.cpp:139
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::WAD3_FILENAME_MAX_SIZE
constexpr int8_t WAD3_FILENAME_MAX_SIZE
Definition
WAD3.h:11
vpkpp::WAD3_SIGNATURE
constexpr auto WAD3_SIGNATURE
Definition
WAD3.h:12
vpkpp::Attribute
Attribute
Definition
Attribute.h:7
vpkpp::WAD3_EXTENSION
constexpr std::string_view WAD3_EXTENSION
Definition
WAD3.h:13
vpkpp::BakeOptions
Definition
Options.h:19
vpkpp::EntryOptions
Definition
Options.h:33
include
vpkpp
format
WAD3.h
Generated on
for SourcePP by
1.14.0