Skip to content

Commit 760d076

Browse files
authored
Merge pull request #7 from qudix/dev/ue
feat: `UE` stuff
2 parents 19e2e74 + 4930917 commit 760d076

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2185
-23
lines changed

include/RE/IDs.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,41 @@ namespace RE::ID
4343

4444
namespace UE::ID
4545
{
46+
namespace FMemory
47+
{
48+
inline constexpr REL::Offset Free{ 0x0E30580 };
49+
inline constexpr REL::Offset Malloc{ 0x0E3CFC0 };
50+
inline constexpr REL::Offset Realloc{ 0x0E3EE30 };
51+
}
52+
53+
namespace FName
54+
{
55+
inline constexpr REL::Offset Ctor1{ 0x0F45900 };
56+
inline constexpr REL::Offset AppendString{ 0x0F4B710 };
57+
inline constexpr REL::Offset ToString{ 0x0F61010 };
58+
}
59+
60+
namespace FNamePool
61+
{
62+
inline constexpr REL::Offset GetSingleton{ 0x909EE80 };
63+
}
64+
65+
namespace FString
66+
{
67+
inline constexpr REL::Offset Ctor1{ 0x0DE4F20 };
68+
inline constexpr REL::Offset Ctor2{ 0x0DE50B0 };
69+
}
70+
71+
namespace FUObjectArray
72+
{
73+
inline constexpr REL::Offset GetSingleton{ 0x9145160 };
74+
}
75+
76+
namespace UClass
77+
{
78+
inline constexpr REL::Offset FindFunctionByName{ 0x1005AA0 };
79+
}
80+
4681
namespace UEngine
4782
{
4883
inline constexpr REL::Offset GetSingleton{ 0x92B0E48 };
@@ -53,4 +88,13 @@ namespace UE::ID
5388
{
5489
inline constexpr REL::Offset GetPlayerController{ 0x31B6B80 };
5590
}
91+
92+
namespace UObjectBaseUtility
93+
{
94+
inline constexpr REL::Offset GetFullName1{ 0x111F730 };
95+
inline constexpr REL::Offset GetFullName2{ 0x111F8D0 };
96+
}
97+
98+
inline constexpr REL::Offset StaticFindObjectFast{ 0x112C350 };
99+
inline constexpr REL::Offset StaticFindObject{ 0x112C0F0 };
56100
}

include/REX/REX/EnumSet.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,13 @@ namespace REX
180180
std::underlying_type_t<
181181
std::common_type_t<Args...>>>;
182182
}
183+
184+
#define REX_DEFINE_ENUM_CLASS_FLAGS(E) \
185+
inline constexpr E& operator|=(E& a_lhs, E a_rhs) { return a_lhs = (E)((__underlying_type(E))a_lhs | (__underlying_type(E))a_rhs); } \
186+
inline constexpr E& operator&=(E& a_lhs, E a_rhs) { return a_lhs = (E)((__underlying_type(E))a_lhs & (__underlying_type(E))a_rhs); } \
187+
inline constexpr E& operator^=(E& a_lhs, E a_rhs) { return a_lhs = (E)((__underlying_type(E))a_lhs ^ (__underlying_type(E))a_rhs); } \
188+
inline constexpr E operator|(E a_lhs, E a_rhs) { return (E)((__underlying_type(E))a_lhs | (__underlying_type(E))a_rhs); } \
189+
inline constexpr E operator&(E a_lhs, E a_rhs) { return (E)((__underlying_type(E))a_lhs & (__underlying_type(E))a_rhs); } \
190+
inline constexpr E operator^(E a_lhs, E a_rhs) { return (E)((__underlying_type(E))a_lhs ^ (__underlying_type(E))a_rhs); } \
191+
inline constexpr bool operator!(E a_lhs) { return !(__underlying_type(E))a_lhs; } \
192+
inline constexpr E operator~(E a_lhs) { return (E) ~(__underlying_type(E))a_lhs; }

include/REX/REX/LOG.h

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,20 @@ namespace REX
1414

1515
void LOG(const std::source_location a_loc, const LOG_LEVEL a_level, const std::string_view a_fmt);
1616

17+
void LOG(const std::source_location a_loc, const LOG_LEVEL a_level, const std::wstring_view a_fmt);
18+
1719
template <class... T>
1820
void LOG(const std::source_location a_loc, const LOG_LEVEL a_level, const std::format_string<T...> a_fmt, T&&... a_args)
1921
{
2022
LOG(a_loc, a_level, std::vformat(a_fmt.get(), std::make_format_args(a_args...)));
2123
}
2224

25+
template <class... T>
26+
void LOG(const std::source_location a_loc, const LOG_LEVEL a_level, const std::wformat_string<T...> a_fmt, T&&... a_args)
27+
{
28+
LOG(a_loc, a_level, std::vformat(a_fmt.get(), std::make_wformat_args(a_args...)));
29+
}
30+
2331
template <class... T>
2432
struct TRACE
2533
{
@@ -29,6 +37,11 @@ namespace REX
2937
{
3038
LOG(a_loc, LOG_LEVEL::TRACE, a_fmt, std::forward<T>(a_args)...);
3139
}
40+
41+
explicit TRACE(const std::wformat_string<T...> a_fmt, T&&... a_args, const std::source_location a_loc = std::source_location::current())
42+
{
43+
LOG(a_loc, LOG_LEVEL::TRACE, a_fmt, std::forward<T>(a_args)...);
44+
}
3245
};
3346

3447
template <>
@@ -40,6 +53,11 @@ namespace REX
4053
{
4154
LOG(a_loc, LOG_LEVEL::TRACE, a_fmt);
4255
}
56+
57+
explicit TRACE(const std::wstring_view a_fmt, const std::source_location a_loc = std::source_location::current())
58+
{
59+
LOG(a_loc, LOG_LEVEL::TRACE, a_fmt);
60+
}
4361
};
4462

4563
template <class... T>
@@ -51,6 +69,11 @@ namespace REX
5169
{
5270
LOG(a_loc, LOG_LEVEL::DEBUG, a_fmt, std::forward<T>(a_args)...);
5371
}
72+
73+
explicit DEBUG(const std::wformat_string<T...> a_fmt, T&&... a_args, const std::source_location a_loc = std::source_location::current())
74+
{
75+
LOG(a_loc, LOG_LEVEL::DEBUG, a_fmt, std::forward<T>(a_args)...);
76+
}
5477
};
5578

5679
template <>
@@ -62,6 +85,11 @@ namespace REX
6285
{
6386
LOG(a_loc, LOG_LEVEL::DEBUG, a_fmt);
6487
}
88+
89+
explicit DEBUG(const std::wstring_view a_fmt, const std::source_location a_loc = std::source_location::current())
90+
{
91+
LOG(a_loc, LOG_LEVEL::DEBUG, a_fmt);
92+
}
6593
};
6694

6795
template <class... T>
@@ -73,6 +101,11 @@ namespace REX
73101
{
74102
LOG(a_loc, LOG_LEVEL::INFO, a_fmt, std::forward<T>(a_args)...);
75103
}
104+
105+
explicit INFO(const std::wformat_string<T...> a_fmt, T&&... a_args, const std::source_location a_loc = std::source_location::current())
106+
{
107+
LOG(a_loc, LOG_LEVEL::INFO, a_fmt, std::forward<T>(a_args)...);
108+
}
76109
};
77110

78111
template <>
@@ -84,6 +117,11 @@ namespace REX
84117
{
85118
LOG(a_loc, LOG_LEVEL::INFO, a_fmt);
86119
}
120+
121+
explicit INFO(const std::wstring_view a_fmt, const std::source_location a_loc = std::source_location::current())
122+
{
123+
LOG(a_loc, LOG_LEVEL::INFO, a_fmt);
124+
}
87125
};
88126

89127
template <class... T>
@@ -95,6 +133,11 @@ namespace REX
95133
{
96134
LOG(a_loc, LOG_LEVEL::WARN, a_fmt, std::forward<T>(a_args)...);
97135
}
136+
137+
explicit WARN(const std::wformat_string<T...> a_fmt, T&&... a_args, const std::source_location a_loc = std::source_location::current())
138+
{
139+
LOG(a_loc, LOG_LEVEL::WARN, a_fmt, std::forward<T>(a_args)...);
140+
}
98141
};
99142

100143
template <>
@@ -106,6 +149,11 @@ namespace REX
106149
{
107150
LOG(a_loc, LOG_LEVEL::WARN, a_fmt);
108151
}
152+
153+
explicit WARN(const std::wstring_view a_fmt, const std::source_location a_loc = std::source_location::current())
154+
{
155+
LOG(a_loc, LOG_LEVEL::WARN, a_fmt);
156+
}
109157
};
110158

111159
template <class... T>
@@ -117,6 +165,11 @@ namespace REX
117165
{
118166
LOG(a_loc, LOG_LEVEL::ERROR, a_fmt, std::forward<T>(a_args)...);
119167
}
168+
169+
explicit ERROR(const std::wformat_string<T...> a_fmt, T&&... a_args, const std::source_location a_loc = std::source_location::current())
170+
{
171+
LOG(a_loc, LOG_LEVEL::ERROR, a_fmt, std::forward<T>(a_args)...);
172+
}
120173
};
121174

122175
template <>
@@ -128,6 +181,11 @@ namespace REX
128181
{
129182
LOG(a_loc, LOG_LEVEL::ERROR, a_fmt);
130183
}
184+
185+
explicit ERROR(const std::wstring_view a_fmt, const std::source_location a_loc = std::source_location::current())
186+
{
187+
LOG(a_loc, LOG_LEVEL::ERROR, a_fmt);
188+
}
131189
};
132190

133191
template <class... T>
@@ -139,6 +197,11 @@ namespace REX
139197
{
140198
LOG(a_loc, LOG_LEVEL::CRITICAL, a_fmt, std::forward<T>(a_args)...);
141199
}
200+
201+
explicit CRITICAL(const std::wformat_string<T...> a_fmt, T&&... a_args, const std::source_location a_loc = std::source_location::current())
202+
{
203+
LOG(a_loc, LOG_LEVEL::CRITICAL, a_fmt, std::forward<T>(a_args)...);
204+
}
142205
};
143206

144207
template <>
@@ -150,29 +213,52 @@ namespace REX
150213
{
151214
LOG(a_loc, LOG_LEVEL::CRITICAL, a_fmt);
152215
}
216+
217+
explicit CRITICAL(const std::wstring_view a_fmt, const std::source_location a_loc = std::source_location::current())
218+
{
219+
LOG(a_loc, LOG_LEVEL::CRITICAL, a_fmt);
220+
}
153221
};
154222

155223
template <class... T>
156224
TRACE(const std::format_string<T...>, T&&...) -> TRACE<T...>;
225+
template <class... T>
226+
TRACE(const std::wformat_string<T...>, T&&...) -> TRACE<T...>;
157227
TRACE(const std::string_view) -> TRACE<void>;
228+
TRACE(const std::wstring_view) -> TRACE<void>;
158229

159230
template <class... T>
160231
DEBUG(const std::format_string<T...>, T&&...) -> DEBUG<T...>;
232+
template <class... T>
233+
DEBUG(const std::wformat_string<T...>, T&&...) -> DEBUG<T...>;
161234
DEBUG(const std::string_view) -> DEBUG<void>;
235+
DEBUG(const std::wstring_view) -> DEBUG<void>;
162236

163237
template <class... T>
164238
INFO(const std::format_string<T...>, T&&...) -> INFO<T...>;
239+
template <class... T>
240+
INFO(const std::wformat_string<T...>, T&&...) -> INFO<T...>;
165241
INFO(const std::string_view) -> INFO<void>;
242+
INFO(const std::wstring_view) -> INFO<void>;
166243

167244
template <class... T>
168245
WARN(const std::format_string<T...>, T&&...) -> WARN<T...>;
246+
template <class... T>
247+
WARN(const std::wformat_string<T...>, T&&...) -> WARN<T...>;
169248
WARN(const std::string_view) -> WARN<void>;
249+
WARN(const std::wstring_view) -> WARN<void>;
170250

171251
template <class... T>
172252
ERROR(const std::format_string<T...>, T&&...) -> ERROR<T...>;
253+
template <class... T>
254+
ERROR(const std::wformat_string<T...>, T&&...) -> ERROR<T...>;
173255
ERROR(const std::string_view) -> ERROR<void>;
256+
ERROR(const std::wstring_view) -> ERROR<void>;
174257

175258
template <class... T>
176259
CRITICAL(const std::format_string<T...>, T&&...) -> CRITICAL<T...>;
260+
template <class... T>
261+
CRITICAL(const std::wformat_string<T...>, T&&...) -> CRITICAL<T...>;
177262
CRITICAL(const std::string_view) -> CRITICAL<void>;
263+
CRITICAL(const std::wstring_view) -> CRITICAL<void>;
178264
}

include/REX/W32/KERNEL32.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ namespace REX::W32
496496
void GetSystemInfo(SYSTEM_INFO* a_info) noexcept;
497497
bool IMAGE_SNAP_BY_ORDINAL64(std::uint64_t a_ordinal) noexcept;
498498
IMAGE_SECTION_HEADER* IMAGE_FIRST_SECTION(const IMAGE_NT_HEADERS64* a_header) noexcept;
499+
void InitializeCriticalSection(CRITICAL_SECTION* a_criticalSection);
499500
bool InitializeCriticalSectionAndSpinCount(CRITICAL_SECTION* a_criticalSection, std::uint32_t a_spinCount);
500501
std::uint32_t InterlockedCompareExchange(volatile std::uint32_t* a_target, std::uint32_t a_value, std::uint32_t a_compare) noexcept;
501502
std::uint64_t InterlockedCompareExchange64(volatile std::uint64_t* a_target, std::uint64_t a_value, std::uint64_t a_compare) noexcept;
@@ -520,12 +521,14 @@ namespace REX::W32
520521
bool QueryPerformanceCounter(std::int64_t* a_counter) noexcept;
521522
bool QueryPerformanceFrequency(std::int64_t* a_frequency) noexcept;
522523
std::uint32_t ResumeThread(HANDLE a_handle) noexcept;
524+
std::uint32_t SetCriticalSectionSpinCount(CRITICAL_SECTION* a_criticalSection, std::uint32_t a_spinCount) noexcept;
523525
bool SetEnvironmentVariableA(const char* a_name, const char* a_value) noexcept;
524526
bool SetEnvironmentVariableW(const wchar_t* a_name, const wchar_t* a_value) noexcept;
525527
void Sleep(std::uint32_t a_milliseconds) noexcept;
526528
bool TerminateProcess(HANDLE a_process, std::uint32_t a_exitCode) noexcept;
527529
void* TlsGetValue(std::uint32_t a_index) noexcept;
528530
bool TlsSetValue(std::uint32_t a_index, void* a_value) noexcept;
531+
bool TryEnterCriticalSection(CRITICAL_SECTION* a_criticalSection) noexcept;
529532
bool UnmapViewOfFile(const void* a_baseAddress) noexcept;
530533
void* VirtualAlloc(void* a_address, std::size_t a_size, std::uint32_t a_type, std::uint32_t a_protect) noexcept;
531534
void* VirtualAllocEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_type, std::uint32_t a_protect) noexcept;

include/UE/E/EClassCastFlags.h

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#pragma once
2+
3+
namespace UE
4+
{
5+
enum class EClassCastFlags : std::uint64_t
6+
{
7+
None = 0x0000000000000000,
8+
UField = 0x0000000000000001,
9+
FInt8Property = 0x0000000000000002,
10+
UEnum = 0x0000000000000004,
11+
UStruct = 0x0000000000000008,
12+
UScriptStruct = 0x0000000000000010,
13+
UClass = 0x0000000000000020,
14+
FByteProperty = 0x0000000000000040,
15+
FIntProperty = 0x0000000000000080,
16+
FFloatProperty = 0x0000000000000100,
17+
FUInt64Property = 0x0000000000000200,
18+
FClassProperty = 0x0000000000000400,
19+
FUInt32Property = 0x0000000000000800,
20+
FInterfaceProperty = 0x0000000000001000,
21+
FNameProperty = 0x0000000000002000,
22+
FStrProperty = 0x0000000000004000,
23+
FProperty = 0x0000000000008000,
24+
FObjectProperty = 0x0000000000010000,
25+
FBoolProperty = 0x0000000000020000,
26+
FUInt16Property = 0x0000000000040000,
27+
UFunction = 0x0000000000080000,
28+
FStructProperty = 0x0000000000100000,
29+
FArrayProperty = 0x0000000000200000,
30+
FInt64Property = 0x0000000000400000,
31+
FDelegateProperty = 0x0000000000800000,
32+
FNumericProperty = 0x0000000001000000,
33+
FMulticastDelegateProperty = 0x0000000002000000,
34+
FObjectPropertyBase = 0x0000000004000000,
35+
FWeakObjectProperty = 0x0000000008000000,
36+
FLazyObjectProperty = 0x0000000010000000,
37+
FSoftObjectProperty = 0x0000000020000000,
38+
FTextProperty = 0x0000000040000000,
39+
FInt16Property = 0x0000000080000000,
40+
FDoubleProperty = 0x0000000100000000,
41+
FSoftClassProperty = 0x0000000200000000,
42+
UPackage = 0x0000000400000000,
43+
ULevel = 0x0000000800000000,
44+
AActor = 0x0000001000000000,
45+
APlayerController = 0x0000002000000000,
46+
APawn = 0x0000004000000000,
47+
USceneComponent = 0x0000008000000000,
48+
UPrimitiveComponent = 0x0000010000000000,
49+
USkinnedMeshComponent = 0x0000020000000000,
50+
USkeletalMeshComponent = 0x0000040000000000,
51+
UBlueprint = 0x0000080000000000,
52+
UDelegateFunction = 0x0000100000000000,
53+
UStaticMeshComponent = 0x0000200000000000,
54+
FMapProperty = 0x0000400000000000,
55+
FSetProperty = 0x0000800000000000,
56+
FEnumProperty = 0x0001000000000000,
57+
USparseDelegateFunction = 0x0002000000000000,
58+
FMulticastInlineDelegateProperty = 0x0004000000000000,
59+
FMulticastSparseDelegateProperty = 0x0008000000000000,
60+
FFieldPathProperty = 0x0010000000000000,
61+
FObjectPtrProperty = 0x0020000000000000,
62+
FClassPtrProperty = 0x0040000000000000,
63+
FLargeWorldCoordinatesRealProperty = 0x0080000000000000,
64+
FOptionalProperty = 0x0100000000000000,
65+
};
66+
REX_DEFINE_ENUM_CLASS_FLAGS(EClassCastFlags);
67+
}

include/UE/E/EExprToken.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
3+
namespace UE
4+
{
5+
enum class EExprToken : std::uint8_t;
6+
}

0 commit comments

Comments
 (0)