mirror of
https://github.com/Mr-X-GTA/GTAV-Classes-1.git
synced 2024-12-22 14:37:31 +08:00
269a2c568d
* feat(joaat): make consteval compatible * fix(ObfVar): ctime include * feat(joaat): consteval -> constexpr
52 lines
688 B
C++
52 lines
688 B
C++
#pragma once
|
|
#include <cstdint>
|
|
#include <ctime>
|
|
|
|
namespace rage
|
|
{
|
|
template <typename T>
|
|
class ObfVar
|
|
{
|
|
private:
|
|
T m_unk1;
|
|
T m_unk2;
|
|
T m_unk3;
|
|
T m_unk4;
|
|
|
|
public:
|
|
T getData()
|
|
{
|
|
auto v105 = m_unk4;
|
|
auto v28 = m_unk1 & v105;
|
|
auto v94 = m_unk2 & ~v105;
|
|
return v28 | v94;
|
|
}
|
|
|
|
operator T ()
|
|
{
|
|
return getData();
|
|
}
|
|
|
|
#if _WIN32
|
|
void setData(T val)
|
|
{
|
|
auto seed = time(nullptr);
|
|
m_unk3 = seed;
|
|
seed = time(nullptr);
|
|
m_unk4 = seed;
|
|
|
|
auto v48 = val & ~seed;
|
|
m_unk1 = seed & val;
|
|
m_unk2 = v48;
|
|
}
|
|
|
|
void operator =(T val)
|
|
{
|
|
setData(val);
|
|
}
|
|
#endif
|
|
};
|
|
|
|
using Obf16 = ObfVar<unsigned short>;
|
|
using Obf32 = ObfVar<unsigned int>;
|
|
} |