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 Host {
9
10class Context;
11
12} // namespace Host
13
14namespace Abstract::Memory {
15
16struct MEMList;
17
18} // namespace Abstract::Memory
19
21namespace EGG {
22
24 friend class Host::Context;
25
26public:
27 ~Archive();
28
29 void unmount();
30 [[nodiscard]] s32 convertPathToEntryId(const char *path) const;
31 void *getFileFast(s32 entryId, Abstract::ArchiveHandle::FileInfo &info) const;
32
33 [[nodiscard]] static Archive *FindArchive(void *archiveStart);
34 [[nodiscard]] static Archive *Mount(void *archiveStart);
35
36private:
37 Archive(void *archiveStart);
38
39 [[nodiscard]] static constexpr uintptr_t GetLinkOffset() {
40 // offsetof doesn't work, so instead of hardcoding an offset, we derive it ourselves
41 return reinterpret_cast<uintptr_t>(&reinterpret_cast<Archive *>(NULL)->m_link);
42 }
43
45 s32 m_refCount = 1;
47
49};
50
51} // namespace EGG
This header houses common data types such as our integral types and enums.
static Abstract::Memory::MEMList s_archiveList
The linked list of all mounted archives.
Definition Archive.hh:48
static Archive * FindArchive(void *archiveStart)
Checks to see if a given archive is already mounted.
Definition Archive.cc:37
~Archive()
Removes the archive from the static list.
Definition Archive.cc:11
static Archive * Mount(void *archiveStart)
Creates a new Archive object or increments the ref count for an already existing Archive.
Definition Archive.cc:53
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:59
EGG core library.
Definition Archive.cc:6
Represents the host application.
Definition HeapCommon.hh:9
Intrusive doubly-linked list. Links are placed within the corresponding object.
Definition List.hh:14