Merge remote-tracking branch 'Blu3train/OtomeHook'

This commit is contained in:
Chenx221 2024-09-05 12:04:27 +08:00
commit 49923da6b3
3 changed files with 45 additions and 0 deletions

View File

@ -23579,6 +23579,46 @@ bool InsertNamcoPS2Hook()
} }
#endif // 0 #endif // 0
bool InsertOtomeHook()
{
//by Blu3train
/*
* Sample games:
* https://vndb.org/r57599
* https://vndb.org/r57600
* https://vndb.org/r57601
*/
const BYTE bytes[] = {
0x33, 0xFF, // xor edi,edi << hook here
0x66, 0x39, 0x3B, // cmp [ebx],di
0x74, 0x2E, // je JyakounoLylaVol3.exe+9E8F2
0x8B, 0xD3, // mov edx,ebx
0xEB, 0x08 // jmp JyakounoLylaVol3.exe+9E8D0
};
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
if (!addr) {
ConsoleOutput("vnreng:Otome: pattern not found");
return false;
}
HookParam hp = {};
hp.address = addr;
hp.offset = pusha_ebx_off -4;
hp.index = 0;
hp.filter_fun = [](LPVOID data, DWORD* len, HookParam*, BYTE)
{
WideCharReplacer((wchar_t*)data, reinterpret_cast<size_t *>(len), L'\n', L' ');
return true;
};
hp.type = USING_UNICODE | USING_STRING | NO_CONTEXT;
ConsoleOutput("vnreng: INSERT Otome");
NewHook(hp, "Otome");
return true;
}
bool YaneSDKFilter(LPVOID data, DWORD *size, HookParam *, BYTE) bool YaneSDKFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
{ {
auto text = reinterpret_cast<LPWSTR>(data); auto text = reinterpret_cast<LPWSTR>(data);

View File

@ -156,6 +156,7 @@ bool InsertWillPlusHook(); // WillPlus: Rio.arc
bool InsertWolfHook(); // Wolf: Data.wolf bool InsertWolfHook(); // Wolf: Data.wolf
bool InsertYukaSystemHooks(); // YukaSystem2: *.ykc bool InsertYukaSystemHooks(); // YukaSystem2: *.ykc
bool InsertYurisHook(); // YU-RIS: *.ypf bool InsertYurisHook(); // YU-RIS: *.ypf
bool InsertOtomeHook(); // Otome: fsroot*
bool InsertYaneSDKHook(); // YaneSDK: arc/evimage.dat bool InsertYaneSDKHook(); // YaneSDK: arc/evimage.dat
bool InsertBishopHook(); // Bishop: *.bsa bool InsertBishopHook(); // Bishop: *.bsa
bool InsertCodeXHook(); // codeX RScript: *.xfl bool InsertCodeXHook(); // codeX RScript: *.xfl

View File

@ -380,6 +380,10 @@ bool DetermineEngineByFile3()
bool DetermineEngineByFile4() bool DetermineEngineByFile4()
{ {
if (Util::CheckFile(L"fsroot*")) {
if (InsertOtomeHook())
return true;
}
if (Util::CheckFile(L"arc/evimage.dat")) { if (Util::CheckFile(L"arc/evimage.dat")) {
if (InsertYaneSDKHook()) if (InsertYaneSDKHook())
return true; return true;