update anex86 hook
This commit is contained in:
parent
93238e13ed
commit
8e67827ae6
@ -13,6 +13,12 @@
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"inheritEnvironments": [ "msvc_x86" ]
|
||||
},
|
||||
{
|
||||
"name": "x86-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"inheritEnvironments": [ "msvc_x86" ]
|
||||
},
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
@ -24,6 +30,12 @@
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"inheritEnvironments": [ "msvc_x64" ]
|
||||
},
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"inheritEnvironments": [ "msvc_x64" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace
|
||||
}
|
||||
HCode.erase(0, 1);
|
||||
|
||||
if ((hp.type & USING_STRING))
|
||||
if (hp.type & USING_STRING)
|
||||
{
|
||||
if (HCode[0] == L'F')
|
||||
{
|
||||
|
@ -145,6 +145,9 @@ inline std::string WideStringToString(const std::wstring& text)
|
||||
template <typename... Args>
|
||||
inline void TEXTRACTOR_MESSAGE(const wchar_t* format, const Args&... args) { MessageBoxW(NULL, FormatString(format, args...).c_str(), L"Textractor", MB_OK); }
|
||||
|
||||
template <typename... Args>
|
||||
inline void TEXTRACTOR_DEBUG(const wchar_t* format, const Args&... args) { std::thread([=] { TEXTRACTOR_MESSAGE(format, args...); }).detach(); }
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define TEST(...) static auto _ = CreateThread(nullptr, 0, [](auto) { __VA_ARGS__; return 0UL; }, NULL, 0, nullptr);
|
||||
#else
|
||||
|
@ -31,4 +31,4 @@ inline QString S(const std::string& s) { return QString::fromStdString(s); }
|
||||
inline QString S(const std::wstring& s) { return QString::fromStdWString(s); }
|
||||
// TODO: allow paired surrogates
|
||||
inline void sanitize(QString& s) { s.chop(std::distance(std::remove_if(s.begin(), s.end(), [](QChar ch) { return ch.isSurrogate(); }), s.end())); }
|
||||
inline QString sanitize(QString&& s) { sanitize(s); return s; }
|
||||
inline QString sanitize(QString&& s) { sanitize(s); return std::move(s); }
|
||||
|
@ -10095,7 +10095,7 @@ BYTE JIS_tableL[0x80] = {
|
||||
0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x00,
|
||||
};
|
||||
|
||||
void SpecialHookAnex86(DWORD esp_base, HookParam *hp, BYTE, DWORD *data, DWORD *split, DWORD *len)
|
||||
void SpecialHookAnex86(DWORD esp_base, HookParam*, BYTE, DWORD *data, DWORD *split, DWORD *len)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
@ -10134,19 +10134,28 @@ _fin:
|
||||
} // unnamed namespace
|
||||
bool InsertAnex86Hook()
|
||||
{
|
||||
const DWORD dwords[] = {0x618ac033,0x0d418a0c}; // jichi 12/25/2013: Remove static keyword
|
||||
for (DWORD i = processStartAddress + 0x1000; i < processStopAddress - 8; i++)
|
||||
if (*(DWORD *)i == dwords[0])
|
||||
if (*(DWORD *)(i + 4) == dwords[1]) {
|
||||
const BYTE bytes[] = {
|
||||
0x8a, XX, 0x0c, // mov ??,[ecx+0C]
|
||||
0x8a, XX, 0x0d // mov ??,[ecx+0D]
|
||||
};
|
||||
bool found = false;
|
||||
for (auto addr : Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress)) {
|
||||
//const DWORD dwords[] = {0x618ac033,0x0d418a0c}; // jichi 12/25/2013: Remove static keyword
|
||||
//for (DWORD i = processStartAddress + 0x1000; i < processStopAddress - 8; i++)
|
||||
//if (*(DWORD *)i == dwords[0])
|
||||
//if (*(DWORD *)(i + 4) == dwords[1]) {
|
||||
HookParam hp = {};
|
||||
hp.address = i;
|
||||
if (*(BYTE*)(addr - 2) == 0x33 || *(BYTE*)(addr - 2) == 0x31) addr = addr - 2;
|
||||
hp.address = addr;
|
||||
hp.offset = pusha_ecx_off - 4;
|
||||
hp.text_fun = SpecialHookAnex86;
|
||||
//hp.type = EXTERN_HOOK;
|
||||
hp.length_offset = 1;
|
||||
ConsoleOutput("vnreng: INSERT Anex86");
|
||||
NewHook(hp, "Anex86");
|
||||
return true;
|
||||
found = true;
|
||||
}
|
||||
if (found) return true;
|
||||
ConsoleOutput("vnreng:Anex86: failed");
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user