From 9f8e523ce31eb9f14f7912925cd539b8a643652f Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sat, 5 Jun 2021 02:30:34 -0600 Subject: [PATCH] (hopefully) improved renpy hook --- texthook/engine/engine.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/texthook/engine/engine.cc b/texthook/engine/engine.cc index baf6503..f5052b2 100644 --- a/texthook/engine/engine.cc +++ b/texthook/engine/engine.cc @@ -16912,8 +16912,14 @@ bool InsertRenpyHook() hp.offset = 4; hp.index = 0xc; hp.length_offset = 0; - hp.split = pusha_ebx_off - 4; - hp.type = USING_STRING | USING_UNICODE | NO_CONTEXT | DATA_INDIRECT | USING_SPLIT; + //hp.split = pusha_ebx_off - 4; + hp.text_fun = [](auto, auto, auto, DWORD* data, DWORD* split, DWORD* count) + { + *data = *(DWORD*)(*data + 0xc); + *count = wcslen((wchar_t*)*data) * sizeof(wchar_t); + *split = wcschr((wchar_t*)*data, L'%') == nullptr; + }; + hp.type = USING_STRING | USING_UNICODE | NO_CONTEXT | DATA_INDIRECT/* | USING_SPLIT*/; //hp.filter_fun = [](void* str, auto, auto, auto) { return *(wchar_t*)str != L'%'; }; NewHook(hp, "Ren'py"); return true;