From 271aa43ceee623e3348c57653f77498282fde166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Tue, 26 Mar 2024 20:15:30 +0800 Subject: [PATCH] fix --- LunaHook/embed_util.cc | 3 ++- LunaHook/engine32/BGI.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/LunaHook/embed_util.cc b/LunaHook/embed_util.cc index f6b1857..898a250 100644 --- a/LunaHook/embed_util.cc +++ b/LunaHook/embed_util.cc @@ -231,6 +231,7 @@ UINT64 texthash(void*data,size_t len) } bool checktranslatedok(void*data ,size_t len) { + ZeroMemory(embedsharedmem->text,sizeof(embedsharedmem->text));//clear trans before call if(len>1000)return true; return(translatecache.find(texthash(data,len))!=translatecache.end()); } @@ -247,7 +248,7 @@ bool TextHook::waitfornotify(TextOutput_T* buffer,void*data ,size_t*len,ThreadPa else{ if(waitforevent(embedsharedmem->waittime,tp,origin)==false)return false; translate=embedsharedmem->text; - if((translate.size()==0)||(translate==origin))return false; + if((translate.size()==0))return false; translatecache.insert(std::make_pair(hash,translate)); } if(hp.newlineseperator)strReplace(translate,L"\n",hp.newlineseperator); diff --git a/LunaHook/engine32/BGI.cpp b/LunaHook/engine32/BGI.cpp index f7a22be..e3c61e0 100644 --- a/LunaHook/engine32/BGI.cpp +++ b/LunaHook/engine32/BGI.cpp @@ -1488,7 +1488,8 @@ bool InsertBGI4Hook() hp.address = addr; hp.offset=get_reg(regs::eax); hp.split = get_reg(regs::esp); - hp.type = CODEC_UTF16 | USING_STRING| USING_SPLIT ; + hp.type = CODEC_UTF16 | USING_STRING| USING_SPLIT |EMBED_ABLE|EMBED_BEFORE_SIMPLE|EMBED_AFTER_OVERWRITE; + hp.hook_font=F_TextOutW|F_GetTextExtentPoint32W; hp.filter_fun = BGI7Filter; ConsoleOutput("BGI4");