-
Notifications
You must be signed in to change notification settings - Fork 1
/
Preprocessors.hh
39 lines (29 loc) · 1.42 KB
/
Preprocessors.hh
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
#pragma once
//==============================================================================
// Defines
#ifdef SDK_NO_RVA_PREPROCESSOR
#define UFG_RVA(x) x
#define UFG_RVA_GET(x) x
#else
#define UFG_RVA(x) (UFG::g_BaseAddress + x)
#define UFG_RVA_GET(x) (reinterpret_cast<uintptr_t>(x) - UFG::g_BaseAddress)
#endif
#define UFG_RVA_PTR(x) reinterpret_cast<void*>(UFG_RVA(x))
#define UFG_CONST_CHAR(x) reinterpret_cast<const char*>(UFG_RVA(x))
#define UFG_THIS_OFFSET(x) (reinterpret_cast<uintptr_t>(this) + x)
//==============================================================================
// Inline
#define UFG_INLINE __forceinline
#define UFG_STATIC_INLINE __forceinline static
//==============================================================================
// Asserts
#define UFG_ASSERT_CLASS(className, classSize) \
static_assert(sizeof(className) == classSize, "Size of class: '" #className "' is invalid!")
#define UFG_ASSERT_STRUCT(structName, structSize) \
static_assert(sizeof(structName) == structSize, "Size of struct: '" #structName "' is invalid!")
//==============================================================================
// Padding
#define UFG_PAD_INSERT(x, y) x ## y
#define UFG_PAD_DEFINE(x, y) UFG_PAD_INSERT(x, y)
#define UFG_PAD(size) char UFG_PAD_DEFINE(padding_, __LINE__)[size]
#define UFG_PAD_ALIGN(size) private: UFG_PAD(size); public: