mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-18 07:07:32 +08:00

* feat(Spoofing): add spoofing * feat(Spoofing): prepare code for player attach * remove(PlayerAttach): isn't going to work due to netsync architecture * fix(GUI): fix scaling * feat(Project): add clang-format file * feat(Classes): update classes * fix(BlackHole): remove unnecessary cleanup * fix(Formatting): fix formatting for initializer lists * feat(clang-format): Set tab width and 1 space before comment Co-authored-by: Yimura <24669514+Yimura@users.noreply.github.com>
38 lines
623 B
C++
38 lines
623 B
C++
#include "byte_patch.hpp"
|
|
|
|
namespace memory
|
|
{
|
|
byte_patch::~byte_patch()
|
|
{
|
|
restore();
|
|
}
|
|
|
|
void byte_patch::apply() const
|
|
{
|
|
memcpy(m_address, m_value.get(), m_size);
|
|
}
|
|
|
|
void byte_patch::restore() const
|
|
{
|
|
memcpy(m_address, m_original_bytes.get(), m_size);
|
|
}
|
|
|
|
void byte_patch::remove() const
|
|
{
|
|
if (const auto it = std::find(m_patches.begin(), m_patches.end(), this); it != m_patches.end())
|
|
{
|
|
m_patches.erase(it);
|
|
}
|
|
}
|
|
|
|
void byte_patch::restore_all()
|
|
{
|
|
m_patches.clear();
|
|
}
|
|
|
|
bool operator==(const std::unique_ptr<byte_patch>& a, const byte_patch* b)
|
|
{
|
|
return a->m_address == b->m_address;
|
|
}
|
|
}
|