t8-mod/source/proxy-dll/std_include.cpp

66 lines
974 B
C++
Raw Normal View History

2023-03-06 15:40:07 -05:00
#include <std_include.hpp>
2023-11-10 16:52:20 -05:00
#include <utilities/nt.hpp>
2023-03-06 15:40:07 -05:00
extern "C"
{
int s_read_arc4random(void*, size_t)
{
return -1;
}
int s_read_getrandom(void*, size_t)
{
return -1;
}
int s_read_urandom(void*, size_t)
{
return -1;
}
int s_read_ltm_rng(void*, size_t)
{
return -1;
}
}
2023-03-06 15:40:07 -05:00
size_t get_base()
{
2023-11-10 16:52:20 -05:00
static auto base = size_t(utilities::nt::library{}.get_ptr());
2023-03-06 15:40:07 -05:00
assert(base && "Failed to resolve base");
return base;
}
size_t operator"" _b(const size_t val)
{
return get_base() + val;
}
size_t reverse_b(const size_t val)
{
return val - get_base();
}
size_t reverse_b(const void* val)
{
return reverse_b(reinterpret_cast<size_t>(val));
}
size_t operator"" _g(const size_t val)
{
static auto base = get_base();
return base + (val - 0x140000000);
}
size_t reverse_g(const size_t val)
{
static auto base = get_base();
return (val - base) + 0x140000000;
}
size_t reverse_g(const void* val)
{
return reverse_g(reinterpret_cast<size_t>(val));
}