Add more spoofing options and added clang-format (#1020)

* 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 <[email protected]>
This commit is contained in:
maybegreat48andYimura authored and GitHub committed 2023-03-01 21:27:15 +00:00
1 parent 92aea20cd6
commit 97a8c5d60b
466 files changed
+55224 -35596

No files matched your search

+14 -12
View File
@@ -1,11 +1,13 @@
#include "../common.hpp"
#include "range.hpp"
#include "../common.hpp"
#include "pattern.hpp"
namespace memory
{
range::range(handle base, std::size_t size) :
m_base(base), m_size(size)
m_base(base),
m_size(size)
{
}
@@ -34,15 +36,15 @@ namespace memory
handle scan_pattern(const std::optional<std::uint8_t>* sig, std::size_t length, handle begin, std::size_t module_size)
{
std::size_t maxShift = length;
std::size_t max_idx = length - 1;
std::size_t max_idx = length - 1;
//Get wildcard index, and store max shiftable byte count
std::size_t wild_card_idx{ static_cast<size_t>(-1) };
for (int i{ static_cast<int>(max_idx - 1) }; i >= 0; --i)
std::size_t wild_card_idx{static_cast<size_t>(-1)};
for (int i{static_cast<int>(max_idx - 1)}; i >= 0; --i)
{
if (!sig[i])
{
maxShift = max_idx - i;
maxShift = max_idx - i;
wild_card_idx = i;
break;
}
@@ -56,7 +58,7 @@ namespace memory
}
//Fill shift table with sig bytes
for (std::size_t i{ wild_card_idx + 1 }; i != max_idx; ++i)
for (std::size_t i{wild_card_idx + 1}; i != max_idx; ++i)
{
shift_table[*sig[i]] = max_idx - i;
}
@@ -65,7 +67,7 @@ namespace memory
const auto scan_end = module_size - length;
for (std::size_t current_idx{}; current_idx <= scan_end;)
{
for (std::ptrdiff_t sig_idx{ (std::ptrdiff_t)max_idx }; sig_idx >= 0; --sig_idx)
for (std::ptrdiff_t sig_idx{(std::ptrdiff_t)max_idx}; sig_idx >= 0; --sig_idx)
{
if (sig[sig_idx] && *begin.add(current_idx + sig_idx).as<uint8_t*>() != *sig[sig_idx])
{
@@ -81,9 +83,9 @@ namespace memory
return nullptr;
}
handle range::scan(pattern const &sig)
handle range::scan(pattern const& sig)
{
auto data = sig.m_bytes.data();
auto data = sig.m_bytes.data();
auto length = sig.m_bytes.size();
if (auto result = scan_pattern(data, length, m_base, m_size); result)
@@ -107,10 +109,10 @@ namespace memory
return true;
}
std::vector<handle> range::scan_all(pattern const &sig)
std::vector<handle> range::scan_all(pattern const& sig)
{
std::vector<handle> result{};
auto data = sig.m_bytes.data();
auto data = sig.m_bytes.data();
auto length = sig.m_bytes.size();
const auto scan_end = m_size - length;