Update ENTERGRAM.cpp

Update Eushully.cpp
This commit is contained in:
恍兮惚兮 2024-09-07 14:08:34 +08:00
parent 831f5dbb1b
commit 4f431b2e68
2 changed files with 33 additions and 27 deletions

View File

@ -592,8 +592,8 @@ namespace
wc[i] = 0x2014;
else if (wc[i] == 0xe000)
wc[i] = 0x2026;
return true;
}
return true;
};
auto succ = NewHook(hp, "eushully");
hp.address = (DWORD)GetTextExtentPoint32W;

View File

@ -1,39 +1,45 @@
#include"ENTERGRAM.h"
bool ENTERGRAMfilter(void* data, size_t* size, HookParam* hp) {
#include "ENTERGRAM.h"
auto text = reinterpret_cast<LPWSTR>(data);
std::wstring str =std::wstring(text,*size / 2);
bool ENTERGRAMfilter(void *data, size_t *size, HookParam *hp)
{
auto text = reinterpret_cast<LPWSTR>(data);
std::wstring str = std::wstring(text, *size / 2);
std::wregex reg1(L"\\|(.*?)\x300a(.*?)\x300b");
std::wstring result1 = std::regex_replace(str, reg1, L"$1");
std::wregex reg2(L"\x3000|\n");
std::wstring result2 = std::regex_replace(result1, reg2, L"");
write_string_overwrite(text,size,result2);
write_string_overwrite(text, size, result2);
return true;
};
bool InsertENTERGRAM() {
//https://vndb.org/v40521
bool InsertENTERGRAM()
{
// https://vndb.org/v40521
//[240125][1208048][エンターグラム] すだまリレイシヨン パッケージ版 (mdf+mds)
const BYTE BYTES[] = {
0x48,0x8B,0x43,0x38,
0x48,0x8D,0x7C,0x24,0x30,
0x48,0x8B,0x74,0x24,0x20,
0x48,0x85,0xC0,
0x48,0x8B,0xCD,
0x48,0x89,0x6C,0x24,0x40,
0x48,0x0F,0x45,0xF8,
//clang-format off
0x48, 0x8B, 0x43, 0x38,
0x48, 0x8D, 0x7C, 0x24, 0x30,
0x48, 0x8B, 0x74, 0x24, 0x20,
0x48, 0x85, 0xC0,
0x48, 0x8B, 0xCD,
0x48, 0x89, 0x6C, 0x24, 0x40,
0x48, 0x0F, 0x45, 0xF8,
//clang-format on
};
auto addr=MemDbg::findBytes(BYTES, sizeof(BYTES), processStartAddress, processStopAddress);
if(addr==0)return false;
auto addr = MemDbg::findBytes(BYTES, sizeof(BYTES), processStartAddress, processStopAddress);
if (addr == 0)
return false;
HookParam hp;
hp.address=addr+14;
hp.type=USING_STRING|CODEC_UTF16|NO_CONTEXT;
hp.filter_fun=ENTERGRAMfilter;
hp.offset=get_reg(regs::rsi);
return NewHook(hp,"ENTERGRAM");
hp.address = addr + 14;
hp.type = USING_STRING | CODEC_UTF16 | NO_CONTEXT;
hp.filter_fun = ENTERGRAMfilter;
hp.offset = get_reg(regs::rsi);
hp.newlineseperator = L"\\n";
return NewHook(hp, "ENTERGRAM");
}
bool ENTERGRAM::attach_function() {
bool ENTERGRAM::attach_function()
{
return InsertENTERGRAM();
}
}