-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathID.h
More file actions
44 lines (35 loc) · 719 Bytes
/
ID.h
File metadata and controls
44 lines (35 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include "REX/FModule.h"
#include "REL/IDDB.h"
namespace REL
{
class ID
{
public:
constexpr ID() noexcept = default;
explicit constexpr ID(std::uint64_t a_id) noexcept :
m_id(a_id)
{}
constexpr ID& operator=(std::uint64_t a_id) noexcept
{
m_id = a_id;
return *this;
}
[[nodiscard]] std::uintptr_t address() const
{
const auto mod = REX::FModule::GetExecutingModule();
return mod.GetBaseAddress() + offset();
}
[[nodiscard]] constexpr std::uint64_t id() const noexcept
{
return m_id;
}
[[nodiscard]] std::size_t offset() const
{
const auto iddb = IDDB::GetSingleton();
return iddb->offset(m_id);
}
private:
std::uint64_t m_id{ 0 };
};
}