mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
Patterns fixup
This commit is contained in:
parent
32fa0c9e51
commit
af2e15ca21
2 changed files with 7 additions and 7 deletions
|
@ -11,7 +11,6 @@
|
|||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
#include <algorithm>
|
||||
#include <string_view>
|
||||
|
||||
#if PATTERNS_USE_HINTS
|
||||
#include <map>
|
||||
|
@ -138,15 +137,15 @@ public:
|
|||
inline uintptr_t end() const { return m_end; }
|
||||
};
|
||||
|
||||
void pattern::Initialize(const char* pattern, size_t length)
|
||||
void pattern::Initialize(std::string_view pattern)
|
||||
{
|
||||
// get the hash for the base pattern
|
||||
#if PATTERNS_USE_HINTS
|
||||
m_hash = fnv_1()(std::string_view(pattern, length));
|
||||
m_hash = fnv_1()(pattern);
|
||||
#endif
|
||||
|
||||
// transform the base pattern from IDA format to canonical format
|
||||
TransformPattern(std::string_view(pattern, length), m_bytes, m_mask);
|
||||
TransformPattern(pattern, m_bytes, m_mask);
|
||||
|
||||
#if PATTERNS_USE_HINTS
|
||||
// if there's hints, try those first
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
#include <string_view>
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4201)
|
||||
|
@ -98,7 +99,7 @@ namespace hook
|
|||
{
|
||||
}
|
||||
|
||||
void Initialize(const char* pattern, size_t length);
|
||||
void Initialize(std::string_view pattern);
|
||||
|
||||
private:
|
||||
bool ConsiderHint(uintptr_t offset);
|
||||
|
@ -115,7 +116,7 @@ namespace hook
|
|||
pattern(const char (&pattern)[Len])
|
||||
: pattern(getRVA<void>(0))
|
||||
{
|
||||
Initialize(pattern, Len-1);
|
||||
Initialize(std::string_view(pattern, Len-1));
|
||||
}
|
||||
|
||||
inline pattern&& count(uint32_t expected)
|
||||
|
@ -203,7 +204,7 @@ namespace hook
|
|||
range_pattern(uintptr_t begin, uintptr_t end, const char(&pattern)[Len])
|
||||
: pattern(begin, end)
|
||||
{
|
||||
Initialize(pattern, Len-1);
|
||||
Initialize(std::string_view(pattern, Len-1));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue