libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
OtrArchive.h
Go to the documentation of this file.
1#ifdef INCLUDE_MPQ_SUPPORT
2
3#pragma once
4
5#undef _DLL
6
7#include <string>
8
9#include <stdint.h>
10#include <map>
11#include <unordered_map>
12#include <string>
13#include <vector>
14#include <unordered_set>
15#include <mutex>
16#include <StormLib.h>
17
20
21namespace Ship {
22struct File;
23
39class OtrArchive final : virtual public Archive {
40 public:
45 OtrArchive(const std::string& archivePath, std::shared_ptr<ResourceManager> resourceManager = nullptr,
46 std::shared_ptr<Keystore> keystore = nullptr);
48
53 bool Open();
54
59 bool Close();
60
67 bool WriteFile(const std::string& filename, const std::vector<uint8_t>& data);
68
74 std::shared_ptr<File> LoadFile(const std::string& filePath);
75
81 std::shared_ptr<File> LoadFile(uint64_t hash);
82
83 private:
84 HANDLE mHandle;
85};
86} // namespace Ship
87
88#endif // INCLUDE_MPQ_SUPPORT
Abstract base class representing a mounted archive (OTR, O2R, or folder).
Definition Archive.h:61
Archive implementation backed by an MPQ file (Blizzard's MoPaQ format).
Definition OtrArchive.h:39
bool WriteFile(const std::string &filename, const std::vector< uint8_t > &data)
Writes raw data to a file entry inside the MPQ archive.
bool Close()
Closes the MPQ file handle and releases StormLib resources.
std::shared_ptr< File > LoadFile(const std::string &filePath)
Loads a file from the archive by its virtual path.
bool Open()
Opens the underlying MPQ file via StormLib.
OtrArchive(const std::string &archivePath, std::shared_ptr< ResourceManager > resourceManager=nullptr, std::shared_ptr< Keystore > keystore=nullptr)
Constructs an OtrArchive for the given MPQ file path.
std::shared_ptr< File > LoadFile(uint64_t hash)
Loads a file from the archive by its 64-bit hash.
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14