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
25class Archive : Disposer {
26 friend class Host::Context;
27
28public:
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 EGG_NEW_DELETE_FRIEND
38
39 Archive(void *archiveStart);
40 ~Archive();
41
42 [[nodiscard]] static constexpr uintptr_t GetLinkOffset() {
43 // offsetof doesn't work, so instead of hardcoding an offset, we derive it ourselves
44 return reinterpret_cast<uintptr_t>(&reinterpret_cast<Archive *>(NULL)->m_link);
45 }
46
48 s32 m_refCount = 1;
50
52};
53
54} // namespace EGG
55
56} // 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:51
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
Contexts can be used to restore a previous memory state for the current session.
Definition Context.hh:71
EGG core library.
Definition Allocator.hh:5
Represents the host application.
Definition HeapCommon.hh:11
Intrusive doubly-linked list. Links are placed within the corresponding object.
Definition List.hh:14