1
0
mirror of synced 2024-11-15 07:17:35 +01:00

Fix x64 Lame way, pls do better later

Fix x64 Lame way, pls do better later
This commit is contained in:
Reaver 2019-06-03 22:08:33 +03:00
parent d130815f0d
commit c37e00d98b
6 changed files with 28 additions and 56 deletions

View File

@ -74,27 +74,9 @@ static InitFunction PokkenFunc([]()
// 18: imageBase + 0x661820
injector::MakeNOP(hook::get_pattern("48 8D 8F F8 00 00 00 88 9F 05 01 00 00", -0x2), 2);
auto chars = { 'F', 'G', 'J' };
ScanMyPattern("F:\\", 'F');
ScanMyPattern("G:\\", 'G');
ScanMyPattern("H:\\", 'H');
for (auto cha : chars)
{
auto patterns = hook::pattern(va("%02X 3A 5C", cha));
if (patterns.size() > 0)
{
for (int i = 0; i < patterns.size(); i++)
{
char* text = patterns.get(i).get<char>(0);
std::string text_str(text);
std::string to_replace = va("%c:\\", cha);
std::string replace_with = va(".\\%c", cha);
std::string replaced = text_str.replace(0, to_replace.length(), replace_with);
injector::WriteMemoryRaw(text, (char*)replaced.c_str(), replaced.length() + 1, true);
}
}
}
}, GameID::PokkenTournament);
#endif

View File

@ -1276,28 +1276,8 @@ static InitFunction Wmmt5Func([]()
}
}
auto chars = { 'F', 'G' };
for (auto cha : chars)
{
auto patterns = hook::pattern(va("%02X 3A 2F", cha));
if (patterns.size() > 0)
{
for (int i = 0; i < patterns.size(); i++)
{
char* text = patterns.get(i).get<char>(0);
std::string text_str(text);
std::string to_replace = va("%c:/", cha);
std::string replace_with = va("./%c", cha);
std::string replaced = text_str.replace(0, to_replace.length(), replace_with);
injector::WriteMemoryRaw(text, (char*)replaced.c_str(), replaced.length() + 1, true);
}
}
}
ScanMyPattern("F:\\", 'F');
ScanMyPattern("G:\\", 'G');
if (ToBool(config["General"]["SkipMovies"]))
{

View File

@ -232,7 +232,6 @@ void InitializeHints()
}
}
static InitFunction globalFunc([]()
{
InitializeHints();

View File

@ -86,7 +86,7 @@ T iatHook(const char* moduleName, T function, TOrdinal ordinal)
{
if (iat_matches_ordinal(nameTableEntry, ordinal))
{
T origEntry = (T)*addressTableEntry;
T origEntry = (T)* addressTableEntry;
injector::WriteMemory(addressTableEntry, (uintptr_t)function, true);
return origEntry;

View File

@ -332,17 +332,6 @@ namespace hook
}
}
void pattern::hint(uint64_t hash, uintptr_t address)
{
auto range = GetHints().equal_range(hash);
@ -359,3 +348,23 @@ namespace hook
}
#endif
}
void ScanMyPattern(hook::pattern patternToScan, char cha)
{
auto patterns = hook::pattern(patternToScan);
if (patterns.size() > 0)
{
for (int i = 0; i < patterns.size(); i++)
{
char* text = patterns.get(i).get<char>(0);
std::string text_str(text);
std::string to_replace = va("%c:\\", cha);
std::string replace_with = va(".\\%c", cha);
std::string replaced = text_str.replace(0, to_replace.length(), replace_with);
injector::WriteMemoryRaw(text, (char*)replaced.c_str(), replaced.length() + 1, true);
}
}
}

View File

@ -198,4 +198,6 @@ namespace hook
}
}
extern void ScanMyPattern(hook::pattern patternToScan, char cha);
#pragma warning(pop)