This commit is contained in:
恍兮惚兮 2024-03-26 20:15:30 +08:00
parent d5fb0e4503
commit 271aa43cee
2 changed files with 4 additions and 2 deletions

View File

@ -231,6 +231,7 @@ UINT64 texthash(void*data,size_t len)
} }
bool checktranslatedok(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; if(len>1000)return true;
return(translatecache.find(texthash(data,len))!=translatecache.end()); 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{ else{
if(waitforevent(embedsharedmem->waittime,tp,origin)==false)return false; if(waitforevent(embedsharedmem->waittime,tp,origin)==false)return false;
translate=embedsharedmem->text; translate=embedsharedmem->text;
if((translate.size()==0)||(translate==origin))return false; if((translate.size()==0))return false;
translatecache.insert(std::make_pair(hash,translate)); translatecache.insert(std::make_pair(hash,translate));
} }
if(hp.newlineseperator)strReplace(translate,L"\n",hp.newlineseperator); if(hp.newlineseperator)strReplace(translate,L"\n",hp.newlineseperator);

View File

@ -1488,7 +1488,8 @@ bool InsertBGI4Hook()
hp.address = addr; hp.address = addr;
hp.offset=get_reg(regs::eax); hp.offset=get_reg(regs::eax);
hp.split = get_reg(regs::esp); 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; hp.filter_fun = BGI7Filter;
ConsoleOutput("BGI4"); ConsoleOutput("BGI4");