libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
FolderArchive.h
Go to the documentation of this file.
1#pragma once
2
3#undef _DLL
4
5#include <string>
6#include <stdint.h>
7#include <string>
8
12
13namespace Ship {
14struct File;
15
24class FolderArchive final : virtual public Archive {
25 public:
30 FolderArchive(const std::string& archivePath, std::shared_ptr<ResourceManager> resourceManager = nullptr,
31 std::shared_ptr<Keystore> keystore = nullptr);
33
38 bool Open();
39
44 bool Close();
45
52 bool WriteFile(const std::string& filename, const std::vector<uint8_t>& data);
53
59 std::shared_ptr<File> LoadFile(const std::string& filePath);
60
66 std::shared_ptr<File> LoadFile(uint64_t hash);
67
68 protected:
74 std::shared_ptr<File> LoadFileRaw(const std::string& filePath);
75
81 std::shared_ptr<File> LoadFileRaw(uint64_t hash);
82
83 private:
84 std::string mArchiveBasePath;
85};
86} // namespace Ship
Abstract base class representing a mounted archive (OTR, O2R, or folder).
Definition Archive.h:61
Archive implementation backed by an on-disk directory tree.
Definition FolderArchive.h:24
FolderArchive(const std::string &archivePath, std::shared_ptr< ResourceManager > resourceManager=nullptr, std::shared_ptr< Keystore > keystore=nullptr)
Constructs a FolderArchive rooted at the given directory.
std::shared_ptr< File > LoadFile(uint64_t hash)
Loads a file by its 64-bit path hash.
std::shared_ptr< File > LoadFileRaw(const std::string &filePath)
Reads a file from disk without header parsing.
std::shared_ptr< File > LoadFileRaw(uint64_t hash)
Reads a file from disk by hash without header parsing.
std::shared_ptr< File > LoadFile(const std::string &filePath)
Loads a file by its virtual path relative to the archive root.
bool Close()
Closes the archive and clears the internal file index.
bool WriteFile(const std::string &filename, const std::vector< uint8_t > &data)
Writes raw data to a file inside the archive directory.
bool Open()
Scans the directory and indexes all files found within it.
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14