Skip to content
This repository has been archived by the owner on Nov 17, 2024. It is now read-only.

Commit

Permalink
issues/63
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed Jun 16, 2024
1 parent 22be914 commit 06e881e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LunaHook/embed_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ bool waitforevent(UINT32 timems,const ThreadParam& tp,const std::wstring &origin

void TextHook::parsenewlineseperator(void*data ,size_t*len)
{
if(!(hp.type&EMBED_ABLE && hp.newlineseperator))return;
if(!(hp.newlineseperator))return;

if (hp.type & CODEC_UTF16)
{
Expand Down
43 changes: 42 additions & 1 deletion LunaHook/engine32/NeXAS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,48 @@ namespace {
return NewHook(hp, "NeXAS2");
}
}
namespace
{
bool _3(){
//真剣で私に恋しなさい!A-5
char atv[] ="@v";
auto aV=MemDbg::findBytes(atv,sizeof(atv),processStartAddress,processStopAddress);
if(!aV)return false;
aV=MemDbg::findBytes(atv,sizeof(atv),aV+1,processStopAddress);//第一个是历史,第二个才是当前文本
if(!aV)return false;
auto addr=MemDbg::findPushAddress(aV,processStartAddress,processStopAddress);
if(addr==0)return 0;
addr=MemDbg::findEnclosingAlignedFunction(addr);
if(addr==0)return 0;
HookParam hp;
hp.address = addr;
hp.type=USING_STRING;
hp.text_fun=[](hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){
auto a2=(TextUnionA*)stack->stack[1];//std::string*
*data=(DWORD)a2->getText();
*len=strlen(a2->getText());
};
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
auto s=std::string((char*)data,*len);
if(startWith(s,"@")){
if(startWith(s,"@v")){
//S001_L1_0001
s=std::regex_replace(s, std::regex("@v[a-zA-Z0-9]{4}_[a-zA-Z0-9]{2}_[a-zA-Z0-9]{4}"), "");
return write_string_overwrite(data,len,s);
}
else{
return false;
}
}

return true;
};
hp.newlineseperator=L"@n";
return NewHook(hp, "NeXAS3");
}
}

bool NeXAS::attach_function() {
auto _=_2();
auto _=_2()||_3();
return InsertNeXASHook()||_;
}

0 comments on commit 06e881e

Please sign in to comment.