5#include "../PackFile.h"
37 static std::unique_ptr<PackFile>
create(
const std::string& path, uint32_t version = 2, uint32_t godotMajorVersion = 0, uint32_t godotMinorVersion = 0, uint32_t godotPatchVersion = 0);
40 [[nodiscard]]
static std::unique_ptr<PackFile>
open(
const std::string& path,
const EntryCallback& callback =
nullptr);
42 static constexpr inline std::string_view
GUID =
"28F4A6FF40EB46E38D47EEC6EFB47C4F";
44 [[nodiscard]]
constexpr std::string_view
getGUID()
const override {
52 [[nodiscard]] std::optional<std::vector<std::byte>>
readEntry(
const std::string& path_)
const override;
58 [[nodiscard]]
explicit operator std::string()
const override;
66 [[nodiscard]] std::tuple<uint32_t, uint32_t, uint32_t>
getGodotVersion()
const;
68 void setGodotVersion(uint32_t major, uint32_t minor = 0, uint32_t patch = 0);
#define VPKPP_REGISTER_PACKFILE_OPEN_EXECUTABLE(function)
#define VPKPP_REGISTER_PACKFILE_OPEN(extension, function)
This class represents the metadata that a file has inside a PackFile.
void setGodotVersion(uint32_t major, uint32_t minor=0, uint32_t patch=0)
void addEntryInternal(Entry &entry, const std::string &path, std::vector< std::byte > &buffer, EntryOptions options) override
static constexpr std::string_view GUID
std::tuple< uint32_t, uint32_t, uint32_t > getGodotVersion() const
static std::unique_ptr< PackFile > open(const std::string &path, const EntryCallback &callback=nullptr)
Open a PCK file (potentially embedded in an executable)
constexpr std::string_view getGUID() const override
Get the GUID corresponding to the pack file type.
constexpr bool isCaseSensitive() const override
Does the format support case-sensitive file names?
std::optional< std::vector< std::byte > > readEntry(const std::string &path_) const override
Try to read the entry's data to a bytebuffer.
uint32_t getVersion() const
Returns 1 for v1, 2 for v2.
Attribute getSupportedEntryAttributes() const override
Returns a list of supported entry attributes Mostly for GUI programs that show entries and their meta...
bool bake(const std::string &outputDir_, BakeOptions options, const EntryCallback &callback) override
If output folder is an empty string, it will overwrite the original.
static std::unique_ptr< PackFile > create(const std::string &path, uint32_t version=2, uint32_t godotMajorVersion=0, uint32_t godotMinorVersion=0, uint32_t godotPatchVersion=0)
Create a new PCK file.
void setVersion(uint32_t version)
Change the version of the PCK. Valid values are 1 and 2.
@ FLAG_DIR_RELATIVE_FILE_DATA
EntryCallbackBase< void > EntryCallback
PackFile(const PackFile &other)=delete
consteval uint32_t makeFourCC(const char fourCC[4])
Creates a FourCC identifier from a string of 4 characters.
constexpr auto PCK_SIGNATURE
constexpr std::string_view PCK_EXTENSION
constexpr std::string_view PCK_PATH_PREFIX