libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
File.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <variant>
5#include <vector>
6#include <memory>
7#include <stdint.h>
11
12namespace tinyxml2 {
13class XMLDocument;
14class XMLElement;
15} // namespace tinyxml2
16
17namespace Ship {
18class Archive;
19
21#define RESOURCE_FORMAT_BINARY 0
23#define RESOURCE_FORMAT_XML 1
24
36 Endianness ByteOrder;
38 uint32_t Type;
42 uint64_t Id;
46 uint32_t Format;
47};
48
56struct File {
58 std::shared_ptr<std::vector<char>> Buffer;
60 size_t BufferOffset = 0;
62 std::variant<std::shared_ptr<tinyxml2::XMLDocument>, std::shared_ptr<BinaryReader>> Reader;
64 bool IsLoaded = false;
65};
66} // namespace Ship
Uniquely identifies a cached resource by path/hash, owner, and source archive.
Definition ResourceIdentifier.h:15
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14
Raw file buffer as read from an archive or the filesystem.
Definition File.h:56
bool IsLoaded
True once the file has been fully loaded from its backing store.
Definition File.h:64
size_t BufferOffset
Byte offset into Buffer where the resource payload starts (after any header).
Definition File.h:60
std::shared_ptr< std::vector< char > > Buffer
Raw byte buffer of the file contents.
Definition File.h:58
std::variant< std::shared_ptr< tinyxml2::XMLDocument >, std::shared_ptr< BinaryReader > > Reader
Parsed reader; either a BinaryReader or an XMLDocument, depending on the format.
Definition File.h:62
Metadata that describes how a resource was (or should be) loaded.
Definition File.h:32
uint32_t Format
Binary or XML format tag (RESOURCE_FORMAT_BINARY / RESOURCE_FORMAT_XML).
Definition File.h:46
Endianness ByteOrder
Byte order of the raw data.
Definition File.h:36
uint32_t Type
Resource type identifier (see ResourceType).
Definition File.h:38
ResourceIdentifier Identifier
Cache/resource identity used for loading and ownership scoping.
Definition File.h:34
int32_t ResourceVersion
Version of the resource format within its type family.
Definition File.h:40
uint64_t Id
Content-hash / unique identifier for this resource.
Definition File.h:42
bool IsCustom
True when this resource originated from an "alt assets" override path.
Definition File.h:44