A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
Archive.hh
1#pragma once
2
3#include <Common.hh>
4
5#include <abstract/Archive.hh>
6#include <abstract/memory/List.hh>
7
8namespace Kinoko {
9
10namespace Host {
11
12class Context;
13
14} // namespace Host
15
16namespace Abstract::Memory {
17
18struct MEMList;
19
20} // namespace Abstract::Memory
21
23namespace EGG {
24
26 friend class Host::Context;
27
28public:
29 ~Archive();
30
31 void unmount();
32 [[nodiscard]] s32 convertPathToEntryId(const char *path) const;
33 void *getFileFast(s32 entryId, Abstract::ArchiveHandle::FileInfo &info) const;
34
35 [[nodiscard]] static Archive *FindArchive(void *archiveStart);
36 [[nodiscard]] static Archive *Mount(void *archiveStart);
37
38private:
39 Archive(void *archiveStart);
40
41 [[nodiscard]] static constexpr uintptr_t GetLinkOffset() {
42 // offsetof doesn't work, so instead of hardcoding an offset, we derive it ourselves
43 return reinterpret_cast<uintptr_t>(&reinterpret_cast<Archive *>(NULL)->m_link);
44 }
45
47 s32 m_refCount = 1;
49
51};
52
53} // namespace EGG
54
55} // namespace Kinoko
This header houses common data types such as our integral types and enums.
~Archive()
Removes the archive from the static list.
Definition Archive.cc:11
static Abstract::Memory::MEMList s_archiveList
The linked list of all mounted archives.
Definition Archive.hh:50
static Archive * Mount(void *archiveStart)
Creates a new Archive object or increments the ref count for an already existing Archive.
Definition Archive.cc:53
static Archive * FindArchive(void *archiveStart)
Checks to see if a given archive is already mounted.
Definition Archive.cc:37
An interface for ensuring certain structures and classes are destroyed with the heap.
Definition Disposer.hh:11
Contexts can be used to restore a previous memory state for the current session.
Definition Context.hh:71
Intrusive doubly-linked list. Links are placed within the corresponding object.
Definition List.hh:14