mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
+ Pattern.for_each_result
This commit is contained in:
parent
a17495fdbc
commit
c81ab5f3f9
2 changed files with 12 additions and 4 deletions
|
@ -188,6 +188,16 @@ namespace hook
|
|||
return get_one().get<T>(offset);
|
||||
}
|
||||
|
||||
template <typename Pred>
|
||||
inline void for_each_result(Pred pred)
|
||||
{
|
||||
EnsureMatches(UINT32_MAX);
|
||||
for ( auto it : m_matches )
|
||||
{
|
||||
pred(it);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
#if PATTERNS_USE_HINTS
|
||||
// define a hint
|
||||
|
|
|
@ -4615,9 +4615,7 @@ void Patch_SA_NewSteam_Common()
|
|||
auto patternie = pattern( "8B 75 10 8B ? 14 56" ).count(2); // 0x77C588 and 0x77C5CC in newsteam r2
|
||||
auto defproc = get_pattern( "8B 4D 14 8B 55 10 8B 45 08" );
|
||||
|
||||
for ( size_t i = 0; i < 2; ++i )
|
||||
{
|
||||
auto match = patternie.get(i);
|
||||
patternie.for_each_result( [&]( pattern_match match ) {
|
||||
InjectHook( match.get<int>(0x39), defproc, PATCH_JUMP );
|
||||
Patch<uint8_t>( match.get<int>(1), 0x5D ); // esi -> ebx
|
||||
Patch<uint8_t>( match.get<int>(6), 0x53 ); // esi -> ebx
|
||||
|
@ -4625,7 +4623,7 @@ void Patch_SA_NewSteam_Common()
|
|||
Patch<int8_t>( match.get<int>(8 + 2), -8 ); // use stack space for new lParam
|
||||
Patch<int8_t>( match.get<int>(0x18 + 2), -8 ); // use stack space for new lParam
|
||||
Patch<int8_t>( match.get<int>(0x2B + 2), -8 ); // use stack space for new lParam
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue