forked from Public-Mirror/Textractor
better renpy hook
This commit is contained in:
parent
2482c26316
commit
622a7214f3
@ -16658,11 +16658,18 @@ bool InsertAdobeFlash10Hook()
|
||||
*/
|
||||
bool InsertRenpyHook()
|
||||
{
|
||||
for (int pythonMinorVersion = 0; pythonMinorVersion <= 8; ++pythonMinorVersion)
|
||||
{
|
||||
wchar_t python[] = L"python2X.dll";
|
||||
python[7] = L'0' + pythonMinorVersion;
|
||||
if (HMODULE module = GetModuleHandleW(python))
|
||||
{
|
||||
wcscpy_s(spDefault.exportModule, python);
|
||||
HookParam hp = {};
|
||||
hp.address = (DWORD)GetProcAddress(GetModuleHandleW(L"python27"), "PyUnicodeUCS2_Format");
|
||||
hp.address = (DWORD)GetProcAddress(module, "PyUnicodeUCS2_Format");
|
||||
if (!hp.address)
|
||||
{
|
||||
ConsoleOutput("Textractor: Ren'py failed: failed to find python27.dll or PyUnicodeUCS2_Format");
|
||||
ConsoleOutput("Textractor: Ren'py failed: failed to find PyUnicodeUCS2_Format");
|
||||
return false;
|
||||
}
|
||||
hp.offset = 4;
|
||||
@ -16673,6 +16680,10 @@ bool InsertRenpyHook()
|
||||
//hp.filter_fun = [](void* str, auto, auto, auto) { return *(wchar_t*)str != L'%'; };
|
||||
NewHook(hp, "Ren'py");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ConsoleOutput("Textractor: Ren'py failed: failed to find python2X.dll");
|
||||
return false;
|
||||
}
|
||||
|
||||
void InsertMonoHook(HMODULE h)
|
||||
|
Loading…
x
Reference in New Issue
Block a user