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; wc[i] = 0x2014;
else if (wc[i] == 0xe000) else if (wc[i] == 0xe000)
wc[i] = 0x2026; wc[i] = 0x2026;
return true;
} }
return true;
}; };
auto succ = NewHook(hp, "eushully"); auto succ = NewHook(hp, "eushully");
hp.address = (DWORD)GetTextExtentPoint32W; hp.address = (DWORD)GetTextExtentPoint32W;

View File

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