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
6
7#include "../PackFile.h"
8
9namespace vpkpp {
10
11constexpr int8_t WAD3_FILENAME_MAX_SIZE = 16;
13constexpr std::string_view WAD3_EXTENSION = ".wad";
14
18class WAD3 : public PackFile {
19public:
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
32protected:
34
35 void addEntryInternal(Entry& entry, const std::string& path, std::vector<std::byte>& buffer, EntryOptions options) override;
36
37private:
39};
40
41} // namespace vpkpp
#define VPKPP_REGISTER_PACKFILE_OPEN(extension, function)
Definition PackFile.h:245
This class represents the metadata that a file has inside a PackFile.
Definition Entry.h:14
EntryCallbackBase< void > EntryCallback
Definition PackFile.h:38
PackFile(const PackFile &other)=delete
Valve GoldSrc WAD3 file.
Definition WAD3.h:18
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open a WAD3 file.
Definition WAD3.cpp:61
static std::unique_ptr< PackFile > create(const std::string &path)
Create a WAD3 file.
Definition WAD3.cpp:52
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
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
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
PackFile(const PackFile &other)=delete
void addEntryInternal(Entry &entry, const std::string &path, std::vector< std::byte > &buffer, EntryOptions options) override
Definition WAD3.cpp:139
consteval uint32_t makeFourCC(const char fourCC[4])
Creates a FourCC identifier from a string of 4 characters.
Definition Binary.h:20
constexpr int8_t WAD3_FILENAME_MAX_SIZE
Definition WAD3.h:11
constexpr auto WAD3_SIGNATURE
Definition WAD3.h:12
Attribute
Definition Attribute.h:7
constexpr std::string_view WAD3_EXTENSION
Definition WAD3.h:13