1
0
mirror of synced 2025-02-01 04:15:50 +01:00

Revert "Fix x64 Lame way, pls do better later"

This reverts commit 58df5e642aa3ba0becbf70af96e2fe6f78c56769.
This commit is contained in:
avail 2019-06-04 02:11:30 +02:00
parent f4afc7e04f
commit b7fe2026cd
6 changed files with 56 additions and 28 deletions

View File

@ -74,9 +74,27 @@ 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);
ScanMyPattern("F:\\", 'F');
ScanMyPattern("G:\\", 'G');
ScanMyPattern("H:\\", 'H');
auto chars = { 'F', 'G', 'J' };
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,8 +1276,28 @@ static InitFunction Wmmt5Func([]()
}
}
ScanMyPattern("F:\\", 'F');
ScanMyPattern("G:\\", 'G');
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);
}
}
}
if (ToBool(config["General"]["SkipMovies"]))
{

View File

@ -232,6 +232,7 @@ 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,6 +332,17 @@ namespace hook
}
}
void pattern::hint(uint64_t hash, uintptr_t address)
{
auto range = GetHints().equal_range(hash);
@ -348,23 +359,3 @@ 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,6 +198,4 @@ namespace hook
}
}
extern void ScanMyPattern(hook::pattern patternToScan, char cha);
#pragma warning(pop)