libER 0.1.4.2
ELDEN RING API library
Loading...
Searching...
No Matches
resource.hpp
Go to the documentation of this file.
1
8#pragma once
9
10#include <dantelion2/text.hpp>
12#include <detail/preprocessor.hpp>
13#include <fd4/component.hpp>
15
16#include <filesystem>
17
18// TODO: anchor vtables
19
20namespace from {
21namespace FD4 {
22// Forward declarations
23class FD4FileCap;
24class FD4ResRep;
25
31public:
32 virtual ~FD4FileLoadProcess() = default;
33
34private:
35 FD4FileCap* file_cap;
37 void* resource_load_queue;
39};
40
48public:
49 FD4_RUNTIME_CLASS(FD4ResCapHolderItem);
50
51 ~FD4ResCapHolderItem() = default;
52
59 return this->res_name;
60 }
61
68 return this->res_name;
69 }
70
77 return this->next_item;
78 }
79
85 const FD4ResCapHolderItem* next() const {
86 return this->next_item;
87 }
88
94 size_t& ref_count() {
95 return this->rcount;
96 }
97
103 const size_t& ref_count() const {
104 return this->rcount;
105 }
106
107private:
109 FD4ResRep* owning_repository;
110 FD4ResCapHolderItem* next_item;
111 size_t rcount;
112};
113
121public:
122 FD4_RUNTIME_CLASS(FD4ResCap);
123
124 ~FD4ResCap() = default;
125
133 virtual void set_debug(bool value) LIBER_INTERFACE;
134
135 virtual void liber_unknown() LIBER_INTERFACE;
136
137private:
138 bool debug;
139 bool liber_unknown; // FD4BndMountDeviceCapSeed + 0x10
140 void* debug_menu_item; // FD4::FD4DebugMenuItem
141 bool liber_unknown;
142};
143
149public:
150 FD4_RUNTIME_CLASS(FD4ResCapHolder);
151
152 virtual ~FD4ResCapHolder() = default;
153
154private:
155 virtual from::allocator<void> get_allocator1() const noexcept {
156 return this->allocator;
157 }
158
159 virtual from::allocator<void> get_allocator2() const noexcept {
160 return this->allocator;
161 }
162
163 virtual from::allocator<void> get_allocator3() const noexcept {
164 return this->allocator;
165 }
166
167public:
173 virtual FD4ResRep* get_owner() noexcept {
174 return this->owning_repository;
175 }
176
182 virtual FD4ResRep* get_owner() const noexcept {
183 return this->owning_repository;
184 }
185
192 LIBERAPI FD4ResCap* get_res_cap(const std::wstring& name) const;
193
194private:
195 friend class FD4FileCapHolder;
196
198 FD4ResRep* owning_repository;
199 int liber_unknown;
200 int capacity;
201 FD4ResCapHolderItem** items;
202};
203
211public:
212 FD4_RUNTIME_CLASS(FD4FileCapHolder);
213
220 LIBERAPI FD4FileCap* get_file_cap(const std::filesystem::path& path) const;
221};
222
227enum class FD4FileCapState : char {
228 INITIAL = 0,
229 QUEUED = 1,
230 PROCESSING = 2,
231 UNKNOWN = 3,
232 READY = 4
233};
234
239class FD4FileCap : public FD4ResCap {
240public:
241 FD4_RUNTIME_CLASS(FD4FileCap);
242
243 virtual ~FD4FileCap() = default;
244
250 FD4FileCapState get_state() const noexcept {
251 return this->state;
252 }
253
259 void* get_load_task() const noexcept {
260 return this->load_task;
261 };
262
269 bool ready() const noexcept {
270 return this->state == FD4FileCapState::READY;
271 }
272
273private:
274 virtual void liber_unknown() = 0;
275 virtual void liber_unknown(DLTX::DLString*) = 0;
276 virtual void* liber_unknown() = 0;
277 virtual void* liber_unknown() = 0;
278 virtual void* liber_unknown() = 0;
279
280public:
286 virtual void request_file_load(FD4FileLoadProcess* load_process) = 0;
287
294 virtual void force_file_load() = 0;
295
296private:
297 virtual void request_header_load() = 0;
298 virtual void liber_unknown() = 0;
299 virtual bool liber_unknown() = 0;
300 virtual bool liber_unknown() = 0;
301
302 FD4FileLoadProcess* load_process;
303 void* load_task;
304 FD4FileCapState state;
305 char liber_unknown;
306 short liber_unknown;
307};
308
316class FD4ResRep : public FD4ResCap {
317public:
318 FD4_RUNTIME_CLASS(FD4ResRep);
319
320 virtual ~FD4ResRep() = default;
321
328 return this->res_holder;
329 }
330
336 const FD4ResCapHolder& get_res_holder() const noexcept {
337 return this->res_holder;
338 }
339
340private:
341 FD4ResCapHolder res_holder;
342};
343
344LIBER_ASSERTS_BEGIN(FD4ResCapHolderItem);
345LIBER_ASSERT_SIZE(0x60);
346LIBER_ASSERTS_END;
347
348LIBER_ASSERTS_BEGIN(FD4ResCap);
349LIBER_ASSERT_SIZE(0x78);
350LIBER_ASSERTS_END;
351
352LIBER_ASSERTS_BEGIN(FD4FileCap);
353LIBER_ASSERT_SIZE(0x90);
354LIBER_ASSERTS_END;
355
356LIBER_ASSERTS_BEGIN(FD4ResCapHolder);
357LIBER_ASSERT_SIZE(0x28);
358LIBER_ASSERTS_END;
359
360LIBER_ASSERTS_BEGIN(FD4ResRep);
361LIBER_ASSERT_SIZE(0xA0);
362LIBER_ASSERTS_END;
363} // namespace FD4
364} // namespace from
A minimal FD4BasicHashString implementation.
Definition text.hpp:118
A refcounted pointer that models std::shared_ptr<T>.
Definition utility.hpp:99
A hash table of FD4::FD4FileCaps.
Definition resource.hpp:210
LIBERAPI FD4FileCap * get_file_cap(const std::filesystem::path &path) const
Get the file capsule with the given filename.
Abstract file capsule class.
Definition resource.hpp:239
void * get_load_task() const noexcept
Get the load task associated with the capsule.
Definition resource.hpp:259
bool ready() const noexcept
Has the file been fully processed?
Definition resource.hpp:269
FD4FileCapState get_state() const noexcept
Get the processing state.
Definition resource.hpp:250
virtual void force_file_load()=0
Force the loading of the file capsule's associated resources.
virtual void request_file_load(FD4FileLoadProcess *load_process)=0
Request a file to be loaded with the specified load process.
Structure internal to the file processing in ELDEN RING.
Definition resource.hpp:30
A single abstract item in a resource hash table.
Definition resource.hpp:47
size_t & ref_count()
Get the reference count of the item.
Definition resource.hpp:94
const size_t & ref_count() const
Get the reference count of the item (const).
Definition resource.hpp:103
FD4ResCapHolderItem * next()
Get the next item in the hash table.
Definition resource.hpp:76
DLTX::FD4BasicHashString & name()
Get the item name.
Definition resource.hpp:58
const FD4ResCapHolderItem * next() const
Get the next item in the hash table (const).
Definition resource.hpp:85
const DLTX::FD4BasicHashString & name() const
Get the item name (const).
Definition resource.hpp:67
A hash table of FD4::FD4ResCapHolderItems.
Definition resource.hpp:148
LIBERAPI FD4ResCap * get_res_cap(const std::wstring &name) const
Get the capsule with the given name.
virtual FD4ResRep * get_owner() noexcept
Get the owning repository of this capsule holder.
Definition resource.hpp:173
virtual FD4ResRep * get_owner() const noexcept
Get the owning repository of this capsule holder (const).
Definition resource.hpp:182
The base of any resource, which can also be a file or a repository.
Definition resource.hpp:120
virtual void set_debug(bool value) LIBER_INTERFACE
Set the internal debugging state.
Abstract resource repository class.
Definition resource.hpp:316
const FD4ResCapHolder & get_res_holder() const noexcept
Get the resource capsule holder (const).
Definition resource.hpp:336
FD4ResCapHolder & get_res_holder() noexcept
Get the resource capsule holder.
Definition resource.hpp:327
The main libER stand-in for ER allocator proxies.
Definition from_allocator.hpp:310
FD4ComponentBase implementation.
ELDEN RING allocation interface and from::allocator.
FD4FileCapState
States of file capsule processing.
Definition resource.hpp:227
Reflection implementation for a given class.
Definition component.hpp:34
Dantelion2 strings.
std::pair< from::wstring, bool > DLString
Common Dantelion string type.
Definition text.hpp:232
Dantelion2 utility.