libER 0.1.4.2
ELDEN RING API library
Loading...
Searching...
No Matches
fd4_task.hpp
Go to the documentation of this file.
1
8#pragma once
9
11#include <detail/preprocessor.hpp>
12#include <fd4/component.hpp>
14#include <fd4/time.hpp>
16#include <memory/from_deque.hpp>
17#include <memory/from_map.hpp>
18#include <memory/from_set.hpp>
21
22#include <utility>
23
32#define CS_TASK_GROUP_ID(INDEX) \
33 (INDEX ^ LIBER_BIT_FLAG(28) ^ LIBER_BIT_FLAG(31))
34
35namespace from {
36// Forward declaration
37namespace CS {
38class CSTask;
39
40// CSTaskGroupId
41using cstgi = unsigned int;
42
43// All task groups:
45} // namespace CS
46
47namespace FD4 {
61 float get_dt() const noexcept {
62 return this->delta_time.time;
63 }
64
70 CS::CSTaskGroup get_task_group() const noexcept {
71 return static_cast<CS::CSTaskGroup>(CS_TASK_GROUP_ID(this->task_group_id));
72 }
73
83 int get_seed() const noexcept {
84 return this->seed;
85 }
86
87private:
88 FD4Time delta_time;
89 CS::cstgi task_group_id;
90 int seed;
91};
92
102public:
103 FD4_RUNTIME_CLASS(FD4TaskBase);
104
105 LIBERAPI virtual ~FD4TaskBase();
106
112 virtual void execute(FD4TaskData* data) = 0;
113
114private:
115 void* liber_unknown = nullptr;
116};
117
119
120// The base step interface.
121// Only its FD4TaskBase instantiation is implemented
122template <class Impl>
123class FD4StepTemplateInterface;
124
125// TODO: methods
126template <>
127class FD4StepTemplateInterface<FD4TaskBase> : public FD4TaskBase {
128public:
129 FD4_RUNTIME_CLASS(FD4StepTemplateInterface);
130
131private:
132 virtual void execute_second(FD4TaskData*) LIBER_INTERFACE;
133 virtual bool test_int_0x48() LIBER_INTERFACE;
134 virtual int get_int_0x48() LIBER_INTERFACE;
135 virtual bool unk_tree_op1() LIBER_INTERFACE;
136 virtual bool unk_tree_op2() LIBER_INTERFACE;
137 virtual bool unk_tree_op3() LIBER_INTERFACE;
138 virtual bool unk_tree_op4() LIBER_INTERFACE;
139 virtual bool unk_tree_op5() LIBER_INTERFACE;
140 virtual bool unk_tree_op6() LIBER_INTERFACE;
141 virtual bool unk_tree_op7() LIBER_INTERFACE;
142 virtual bool unk_tree_op8() LIBER_INTERFACE;
143 virtual bool unk_tree_op9() LIBER_INTERFACE;
144 virtual bool unk_tree_op10() LIBER_INTERFACE;
145};
146
147// TODO:
148// Unnamed (no RTTI) structure
149// Has a virtual destructor
150struct _unk_tree {
151 virtual ~_unk_tree() = default;
152 from::set<void*> _tree;
153 from::allocator<void> liber_unknown;
154 from::allocator<void> liber_unknown;
155};
156
157// Base step layout.
158// Common base class for all steppers
159template <class Impl>
160class FD4StepTemplateBase : public FD4StepTemplateInterface<FD4TaskBase> {
161public:
162 FD4_RUNTIME_CLASS(FD4StepTemplateBase);
163
164private:
165 virtual bool unk_tree_op11() LIBER_INTERFACE;
166 virtual bool unk_tree_op12() LIBER_INTERFACE;
167 virtual bool unk_tree_op13() LIBER_INTERFACE;
168
169 using steps_type = std::pair<void (*)(Impl*), const char*>;
170
171 steps_type* steps;
172 _unk_tree _tree;
173 void* liber_unknown = nullptr;
174 bool liber_unknown = false;
175 from::allocator<void> liber_unknown;
176 void* liber_unknown = nullptr;
177 bool liber_unknown = false;
178 bool liber_unknown = false;
179 from::wstring unk_wstr;
180 bool liber_unknown = true;
181 const wchar_t* state = L"NotExecuting";
182 bool liber_unknown = false;
183 int liber_unknown = 0;
184};
185
186// Internal FD4TaskManager strucures
187struct task_entry_group {
188 LIBER_CLASS(task_entry_group);
189
190 struct task_entry {
191 virtual ~task_entry() = default;
192 FD4TaskBase* task;
193 void* liber_unknown;
194 CS::cstgi group_id;
195 };
196
197 struct task_state {
198 FD4TaskBase* task;
199 void* liber_unknown;
200 int liber_unknown;
201 bool active;
202 };
203
204 virtual ~task_entry_group() = default;
208 int flags[2];
209 CS::cstgi group_id;
210 DLKR::DLPlainAdaptiveMutex mutex;
211 void* debug_menu_item; // FD4::FD4DebugMenuItem
212 void* liber_unknown;
213};
214
216
217// TODO: expose more functionality
223public:
224 FD4_SINGLETON_CLASS(FD4TaskManager);
225
226 virtual ~FD4TaskManager() LIBER_INTERFACE_ONLY;
227
228private:
229 from::allocator<void> liber_unknown;
230 struct {
231 void* liber_unknown;
233 from::vector<liber::dummy> liber_unknown;
234 }* liber_unknown[3];
235 void* liber_unknown;
236 void* liber_unknown;
237 bool liber_unknown;
238 bool liber_unknown;
239 CS::CSTask* cs_task;
240 struct {
241 void* liber_unknown;
242 from::allocator<void> liber_unknown;
244 from::vector<task_entry_group> liber_unknown;
245 }* liber_unknown;
246 void* liber_unknown;
247};
248
249LIBER_ASSERTS_TEMPLATE_BEGIN(FD4StepTemplateBase, void);
250LIBER_ASSERT_SIZE(0xB0);
251LIBER_ASSERT_OFFS(0x10, steps);
252LIBER_ASSERT_OFFS(0x18, _tree);
253LIBER_ASSERT_OFFS(0x70, unk_wstr);
254LIBER_ASSERT_OFFS(0xA0, state);
255LIBER_ASSERTS_END;
256
257LIBER_ASSERTS_BEGIN(task_entry_group);
258LIBER_ASSERT_SIZE(0xD0);
259LIBER_ASSERT_OFFS(0x08, entries);
260LIBER_ASSERT_OFFS(0x28, states);
261LIBER_ASSERT_OFFS(0x48, queue);
262LIBER_ASSERT_OFFS(0x80, group_id);
263LIBER_ASSERTS_END;
264
265LIBER_ASSERTS_BEGIN(FD4TaskManager);
266LIBER_ASSERT_SIZE(0x58);
267LIBER_ASSERT_OFFS(0x40, cs_task);
268LIBER_ASSERTS_END;
269} // namespace FD4
270} // namespace from
The main namespace CS task interface.
Definition task.hpp:242
A wrapper around a Windows Critical Section.
Definition kernel_runtime.hpp:38
The base task interface.
Definition fd4_task.hpp:101
virtual void execute(FD4TaskData *data)=0
Virtual method that is called when the task is executed.
Singleton responsible for managing all tasks.
Definition fd4_task.hpp:222
The main libER stand-in for ER allocator proxies.
Definition from_allocator.hpp:310
FD4ComponentBase implementation.
#define CS_TASK_GROUP_ID(INDEX)
Convert a task group id into a task group index, or back.
Definition fd4_task.hpp:32
ELDEN RING allocation interface and from::allocator.
from::deque based on std::deque
std::deque< T, from::allocator< T, AllocatorTag > > deque
std::deque with from::allocator.
Definition from_deque.hpp:23
from::map based on std::map
std::map< K, V, Pred, from::allocator< std::pair< const K, V >, AllocatorTag > > map
std::map with from::allocator.
Definition from_map.hpp:25
from::set based on std::set
std::set< T, Pred, from::allocator< T, AllocatorTag > > set
std::set with from::allocator.
Definition from_set.hpp:24
from::basic_string based on std::basic_string
from::basic_string< wchar_t, std::char_traits< wchar_t >, from::default_allocator_tag > wstring
std::wstring with from::allocator.
Definition from_string.hpp:45
from::vector based on std::vector
std::vector< T, from::allocator< T, AllocatorTag > > vector
std::vector with from::allocator.
Definition from_vector.hpp:23
Dantelion2 kernel object management and synchronization.
FD4_SINGLETON_CLASS implementation.
Reflection implementation for a given class.
Definition component.hpp:34
The data passed to tasks on execution.
Definition fd4_task.hpp:55
int get_seed() const noexcept
Get the seed.
Definition fd4_task.hpp:83
CS::CSTaskGroup get_task_group() const noexcept
Get the task group.
Definition fd4_task.hpp:70
float get_dt() const noexcept
Get the delta time.
Definition fd4_task.hpp:61
A basic floating point time class.
Definition time.hpp:20
float time
The time.
Definition time.hpp:27
unsigned int cstgi
Typedef of a special unsigned integer type that may represent a task id.
Definition task.hpp:31
All CS::CSTask taskgroups in order.
Namespace FD4 FD4Time.