Merge remote-tracking branch 'Blu3train/YaneSDKHook'
This commit is contained in:
commit
9b26b6dad7
@ -23579,6 +23579,67 @@ bool InsertNamcoPS2Hook()
|
|||||||
}
|
}
|
||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
|
bool YaneSDKFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
|
||||||
|
{
|
||||||
|
auto text = reinterpret_cast<LPWSTR>(data);
|
||||||
|
auto len = reinterpret_cast<size_t *>(size);
|
||||||
|
static std::wstring prevText;
|
||||||
|
|
||||||
|
if (!*len)
|
||||||
|
return false;
|
||||||
|
text[*len/sizeof(wchar_t)] = L'\0'; // clean text
|
||||||
|
|
||||||
|
if (!prevText.compare(text))
|
||||||
|
return false;
|
||||||
|
prevText = text;
|
||||||
|
|
||||||
|
WideStringCharReplacer(text, len, L"[r]", 3, L' ');
|
||||||
|
WideStringFilter(text, len, L"[np]", 4);
|
||||||
|
|
||||||
|
if (cpp_wcsnstr(text, L"'", *len/sizeof(wchar_t))) { // [桜木'さくらぎ]
|
||||||
|
WideStringFilterBetween(text, len, L"'", 1, L"]", 1);
|
||||||
|
}
|
||||||
|
WideCharFilter(text, len, L'[');
|
||||||
|
WideCharFilter(text, len, L']');
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool InsertYaneSDKHook()
|
||||||
|
{
|
||||||
|
//by Blu3train
|
||||||
|
/*
|
||||||
|
* Sample games:
|
||||||
|
* https://vndb.org/v21734
|
||||||
|
* https://vndb.org/v21455
|
||||||
|
* https://vndb.org/v20406
|
||||||
|
*/
|
||||||
|
const BYTE bytes[] = {
|
||||||
|
0x83, 0xF9, 0x08, // cmp ecx,08 << hook here
|
||||||
|
0x8D, 0x45, 0x0C, // lea eax,[ebp+0C]
|
||||||
|
0x8D, 0x4D, 0xBC, // lea ecx,[ebp-44]
|
||||||
|
0x0F, 0x43, 0xC2, // cmovae eax,edx
|
||||||
|
0x0F, 0xB7, 0x04, 0x70 // movzx eax,word ptr [eax+esi*2]
|
||||||
|
};
|
||||||
|
|
||||||
|
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
|
||||||
|
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
|
||||||
|
if (!addr) {
|
||||||
|
ConsoleOutput("vnreng:YaneSDK: pattern not found");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
HookParam hp = {};
|
||||||
|
hp.address = addr;
|
||||||
|
hp.offset = pusha_eax_off -4;
|
||||||
|
hp.index = 0;
|
||||||
|
hp.filter_fun = YaneSDKFilter;
|
||||||
|
hp.type = USING_UNICODE | USING_STRING | NO_CONTEXT;
|
||||||
|
ConsoleOutput("vnreng: INSERT YaneSDK");
|
||||||
|
NewHook(hp, "YaneSDK");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool BishopFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
|
bool BishopFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
|
||||||
{
|
{
|
||||||
auto text = reinterpret_cast<LPWSTR>(data);
|
auto text = reinterpret_cast<LPWSTR>(data);
|
||||||
|
@ -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 InsertYaneSDKHook(); // YaneSDK: arc/evimage.dat
|
||||||
bool InsertBishopHook(); // Bishop: *.bsa
|
bool InsertBishopHook(); // Bishop: *.bsa
|
||||||
bool InsertCodeXHook(); // codeX RScript: *.xfl
|
bool InsertCodeXHook(); // codeX RScript: *.xfl
|
||||||
bool InsertDxLibHook(); // DxLib: *.bcx
|
bool InsertDxLibHook(); // DxLib: *.bcx
|
||||||
|
@ -380,6 +380,10 @@ bool DetermineEngineByFile3()
|
|||||||
|
|
||||||
bool DetermineEngineByFile4()
|
bool DetermineEngineByFile4()
|
||||||
{
|
{
|
||||||
|
if (Util::CheckFile(L"arc/evimage.dat")) {
|
||||||
|
if (InsertYaneSDKHook())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (Util::CheckFile(L"*.bsa")) {
|
if (Util::CheckFile(L"*.bsa")) {
|
||||||
if (InsertBishopHook())
|
if (InsertBishopHook())
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user