diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2022-09-02 00:38:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-02 00:38:07 +0200 |
commit | f2e670bd32fc291dbb6a4b45c08cb8f2d94a6bc8 (patch) | |
tree | eb23e0d5ebfc8f796b7bde55179ae3dc0ae46d3f /NorthstarDLL/memory.cpp | |
parent | 80673fb5cfa32d3ff75d54c4c4173d32905fda30 (diff) | |
download | NorthstarLauncher-f2e670bd32fc291dbb6a4b45c08cb8f2d94a6bc8.tar.gz NorthstarLauncher-f2e670bd32fc291dbb6a4b45c08cb8f2d94a6bc8.zip |
Refactor cleanup (some formatting fixes) (#257)
* Fix some formatting
* More formatting fixes
Diffstat (limited to 'NorthstarDLL/memory.cpp')
-rw-r--r-- | NorthstarDLL/memory.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/NorthstarDLL/memory.cpp b/NorthstarDLL/memory.cpp index d93b736e..8b7694bd 100644 --- a/NorthstarDLL/memory.cpp +++ b/NorthstarDLL/memory.cpp @@ -11,7 +11,7 @@ MemoryAddress::operator uintptr_t() const return m_nAddress; } -MemoryAddress::operator void* () const +MemoryAddress::operator void*() const { return reinterpret_cast<void*>(m_nAddress); } @@ -41,12 +41,12 @@ bool MemoryAddress::operator!=(const uintptr_t& addr) const return m_nAddress != addr; } -MemoryAddress MemoryAddress::operator+(const MemoryAddress& other) const +MemoryAddress MemoryAddress::operator+(const MemoryAddress& other) const { return Offset(other.m_nAddress); } -MemoryAddress MemoryAddress::operator-(const MemoryAddress& other) const +MemoryAddress MemoryAddress::operator-(const MemoryAddress& other) const { return MemoryAddress(m_nAddress - other.m_nAddress); } @@ -110,7 +110,7 @@ inline std::vector<uint8_t> HexBytesToString(const char* pHexString) // If this is a space character, ignore it if (isspace(pHexString[i])) continue; - + if (i < size - 1) { BYTE result = 0; @@ -159,7 +159,7 @@ void MemoryAddress::NOP(const size_t nSize) memset(pBytes, 0x90, nSize); Patch(pBytes, nSize); - + delete[] pBytes; } @@ -176,9 +176,7 @@ bool MemoryAddress::IsMemoryReadable(const size_t nSize) return memInfo.RegionSize >= nSize && memInfo.State & MEM_COMMIT && !(memInfo.Protect & PAGE_NOACCESS); } - - -CModule::CModule(const HMODULE pModule) +CModule::CModule(const HMODULE pModule) { MODULEINFO mInfo {0}; @@ -343,7 +341,7 @@ inline std::pair<std::vector<uint8_t>, std::string> MaskedBytesFromPattern(const return std::make_pair(vRet, sMask); } -MemoryAddress CModule::FindPattern(const char* pPattern) +MemoryAddress CModule::FindPattern(const char* pPattern) { const auto pattern = MaskedBytesFromPattern(pPattern); return FindPattern(pattern.first.data(), pattern.second.c_str()); |