mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-22 13:32:36 +01:00
Updated Memory
This commit is contained in:
parent
e44ad21204
commit
fe37899ac1
@ -20,6 +20,7 @@
|
||||
#include <Windows.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cassert>
|
||||
|
||||
#ifndef _MEMORY_NO_CRT
|
||||
#include <initializer_list>
|
||||
@ -523,6 +524,14 @@ namespace Memory
|
||||
func = Func(*(ptrdiff_t*)((intptr_t)address+1) + (intptr_t)address + 5);
|
||||
}
|
||||
|
||||
template<typename AT>
|
||||
inline void* ReadCallFrom(AT address, ptrdiff_t offset = 0)
|
||||
{
|
||||
uintptr_t addr;
|
||||
ReadCall( address, addr );
|
||||
return reinterpret_cast<void*>( addr + offset );
|
||||
}
|
||||
|
||||
#ifndef _MEMORY_NO_CRT
|
||||
inline bool MemEquals(uintptr_t address, std::initializer_list<uint8_t> val)
|
||||
{
|
||||
@ -531,6 +540,13 @@ namespace Memory
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename AT>
|
||||
inline AT Verify(AT address, uintptr_t expected)
|
||||
{
|
||||
assert( uintptr_t(address) == expected );
|
||||
return address;
|
||||
}
|
||||
|
||||
namespace DynBase
|
||||
{
|
||||
template<typename T, typename AT>
|
||||
@ -571,11 +587,23 @@ namespace Memory
|
||||
Memory::ReadCall(DynBaseAddress(address), func);
|
||||
}
|
||||
|
||||
template<typename AT>
|
||||
inline void* ReadCallFrom(AT address, ptrdiff_t offset = 0)
|
||||
{
|
||||
return Memory::ReadCallFrom(DynBaseAddress(address), offset);
|
||||
}
|
||||
|
||||
#ifndef _MEMORY_NO_CRT
|
||||
inline bool MemEquals(uintptr_t address, std::initializer_list<uint8_t> val)
|
||||
{
|
||||
return Memory::MemEquals(DynBaseAddress(address), std::move(val));
|
||||
}
|
||||
|
||||
template<typename AT>
|
||||
inline AT Verify(AT address, uintptr_t expected)
|
||||
{
|
||||
return Memory::Verify(address, DynBaseAddress(expected));
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -636,6 +664,12 @@ namespace Memory
|
||||
Memory::ReadCall(address, func);
|
||||
}
|
||||
|
||||
template<typename AT>
|
||||
inline void* ReadCallFrom(AT address, ptrdiff_t offset = 0)
|
||||
{
|
||||
return Memory::ReadCallFrom(address, offset);
|
||||
}
|
||||
|
||||
#ifndef _MEMORY_NO_CRT
|
||||
inline bool MemEquals(uintptr_t address, std::initializer_list<uint8_t> val)
|
||||
{
|
||||
@ -643,6 +677,12 @@ namespace Memory
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename AT>
|
||||
inline AT Verify(AT address, uintptr_t expected)
|
||||
{
|
||||
return Memory::Verify(address, expected);
|
||||
}
|
||||
|
||||
namespace DynBase
|
||||
{
|
||||
template<typename T, typename AT>
|
||||
@ -683,12 +723,25 @@ namespace Memory
|
||||
Memory::ReadCall(DynBaseAddress(address), func);
|
||||
}
|
||||
|
||||
template<typename AT>
|
||||
inline void* ReadCallFrom(AT address, ptrdiff_t offset = 0)
|
||||
{
|
||||
Memory::ReadCallFrom(DynBaseAddress(address), offset);
|
||||
}
|
||||
|
||||
#ifndef _MEMORY_NO_CRT
|
||||
inline bool MemEquals(uintptr_t address, std::initializer_list<uint8_t> val)
|
||||
{
|
||||
return Memory::MemEquals(DynBaseAddress(address), std::move(val));
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename AT>
|
||||
inline AT Verify(AT address, uintptr_t expected)
|
||||
{
|
||||
return Memory::Verify(address, DynBaseAddress(expected));
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user