actually fix pattern library
This commit is contained in:
parent
9692dddc7a
commit
e57729a653
@ -78,8 +78,7 @@ static InitFunction PokkenFunc([]()
|
||||
|
||||
for (auto cha : chars)
|
||||
{
|
||||
std::string pat = va("%02X 3A 5C", cha);
|
||||
auto patterns = hook::pattern(pat);
|
||||
auto patterns = hook::pattern(va("%02X 3A 5C", cha));
|
||||
|
||||
if (patterns.size() > 0)
|
||||
{
|
||||
|
@ -1280,8 +1280,7 @@ static InitFunction Wmmt5Func([]()
|
||||
|
||||
for (auto cha : chars)
|
||||
{
|
||||
std::string pat = va("%02X 3A 2F", cha);
|
||||
auto patterns = hook::pattern(pat);
|
||||
auto patterns = hook::pattern(va("%02X 3A 2F", cha));
|
||||
|
||||
if (patterns.size() > 0)
|
||||
{
|
||||
|
@ -191,51 +191,9 @@ void init_windowHooks(windowHooks* data)
|
||||
}
|
||||
/* END WINDOW HOOKS */
|
||||
|
||||
void InitializeHints()
|
||||
{
|
||||
static std::string modPath;
|
||||
|
||||
if (modPath.empty())
|
||||
{
|
||||
char exeName[512];
|
||||
GetModuleFileNameA(GetModuleHandle(NULL), exeName, sizeof(exeName));
|
||||
|
||||
char* exeBaseName = strrchr(exeName, '\\');
|
||||
exeBaseName[0] = L'\0';
|
||||
|
||||
modPath = exeName;
|
||||
modPath += "\\";
|
||||
|
||||
GetFullPathNameA(modPath.c_str(), sizeof(exeName), exeName, nullptr);
|
||||
|
||||
modPath = exeName;
|
||||
modPath += "\\";
|
||||
}
|
||||
|
||||
std::string hintsFile = modPath + "hints.dat";
|
||||
FILE* hints = fopen(hintsFile.c_str(), "rb");
|
||||
|
||||
if (hints)
|
||||
{
|
||||
while (!feof(hints))
|
||||
{
|
||||
uint64_t hash;
|
||||
uintptr_t hint;
|
||||
|
||||
fread(&hash, 1, sizeof(hash), hints);
|
||||
fread(&hint, 1, sizeof(hint), hints);
|
||||
|
||||
hook::pattern::hint(hash, hint);
|
||||
}
|
||||
|
||||
fclose(hints);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static InitFunction globalFunc([]()
|
||||
{
|
||||
InitializeHints();
|
||||
hook::pattern::InitializeHints();
|
||||
CreateThread(NULL, 0, QuitGameThread, NULL, 0, NULL);
|
||||
}, GameID::Global);
|
||||
#pragma optimize("", on)
|
@ -290,8 +290,7 @@ namespace hook
|
||||
}
|
||||
|
||||
#if PATTERNS_USE_HINTS
|
||||
|
||||
void InitializeHints()
|
||||
void pattern::InitializeHints()
|
||||
{
|
||||
static std::string modPath;
|
||||
|
||||
@ -332,17 +331,6 @@ namespace hook
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void pattern::hint(uint64_t hash, uintptr_t address)
|
||||
{
|
||||
auto range = GetHints().equal_range(hash);
|
||||
|
@ -92,7 +92,7 @@ namespace hook
|
||||
Initialize(pattern, Len);
|
||||
}
|
||||
|
||||
pattern(std::string &pattern)
|
||||
pattern(const std::string &pattern)
|
||||
: pattern(GetModuleHandle(NULL))
|
||||
{
|
||||
auto len = pattern.length();
|
||||
@ -169,6 +169,9 @@ namespace hook
|
||||
|
||||
public:
|
||||
#if PATTERNS_USE_HINTS
|
||||
// load hints.dat
|
||||
static void InitializeHints();
|
||||
|
||||
// define a hint
|
||||
static void hint(uint64_t hash, uintptr_t address);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user