diff --git a/OpenParrot/src/Functions/Games/ES3B/PokkenTournament.cpp b/OpenParrot/src/Functions/Games/ES3B/PokkenTournament.cpp index 2b4f2fc..b79ded4 100644 --- a/OpenParrot/src/Functions/Games/ES3B/PokkenTournament.cpp +++ b/OpenParrot/src/Functions/Games/ES3B/PokkenTournament.cpp @@ -78,7 +78,8 @@ static InitFunction PokkenFunc([]() for (auto cha : chars) { - auto patterns = hook::pattern(va("%02X 3A 5C", cha)); + std::string pat = va("%02X 3A 5C", cha); + auto patterns = hook::pattern(pat); if (patterns.size() > 0) { diff --git a/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp b/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp index 7d9cbeb..1453b82 100644 --- a/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp +++ b/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp @@ -1280,7 +1280,8 @@ static InitFunction Wmmt5Func([]() for (auto cha : chars) { - auto patterns = hook::pattern(va("%02X 3A 2F", cha)); + std::string pat = va("%02X 3A 2F", cha); + auto patterns = hook::pattern(pat); if (patterns.size() > 0) { diff --git a/OpenParrot/src/Utility/Hooking.Patterns.h b/OpenParrot/src/Utility/Hooking.Patterns.h index f764eb1..9b50ac3 100644 --- a/OpenParrot/src/Utility/Hooking.Patterns.h +++ b/OpenParrot/src/Utility/Hooking.Patterns.h @@ -9,6 +9,7 @@ #include #include +#include #pragma warning(push) #pragma warning(disable:4201) @@ -91,6 +92,13 @@ namespace hook Initialize(pattern, Len); } + pattern(std::string &pattern) + : pattern(GetModuleHandle(NULL)) + { + auto len = pattern.length(); + Initialize(pattern.c_str(), len); + } + inline pattern& count(uint32_t expected) & { EnsureMatches(expected);