Merge remote-tracking branch 'Blu3train/SysdHook'
This commit is contained in:
commit
f73e6f0b2b
@ -23712,6 +23712,61 @@ bool InsertNamcoPS2Hook()
|
|||||||
}
|
}
|
||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
|
bool SysdFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
|
||||||
|
{
|
||||||
|
auto text = reinterpret_cast<LPSTR>(data);
|
||||||
|
auto len = reinterpret_cast<size_t *>(size);
|
||||||
|
|
||||||
|
if (text[0] == '\x81' && text[1] == '\x40') {
|
||||||
|
*len -= 2;
|
||||||
|
::memmove(text, text + 2, *len);
|
||||||
|
}
|
||||||
|
while (text[*len-1] == '\n') {
|
||||||
|
(*len)--;
|
||||||
|
text[*len] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool InsertSysdHook() {
|
||||||
|
//by Blu3train
|
||||||
|
/*
|
||||||
|
* Sample games:
|
||||||
|
* https://vndb.org/v2069
|
||||||
|
*/
|
||||||
|
const BYTE bytes[] = {
|
||||||
|
0xC1, 0xE9, 0x02, // shr ecx,02 <- hook here
|
||||||
|
0xF3, 0xA5, // repe movsd
|
||||||
|
0x8B, 0xCA, // mov ecx,edx
|
||||||
|
0x83, 0xE1, 0x03, // and ecx,03
|
||||||
|
0xF3, 0xA4, // repe movsb
|
||||||
|
0x5F, // pop edi
|
||||||
|
0xB8, 0x01, 0x00, 0x00, 0x00 // mov eax,00000001
|
||||||
|
};
|
||||||
|
|
||||||
|
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
|
||||||
|
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
|
||||||
|
if (!addr) {
|
||||||
|
ConsoleOutput("vnreng:Sysd: pattern not found");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
HookParam hp = {};
|
||||||
|
hp.address = addr;
|
||||||
|
hp.offset = pusha_esi_off -4;
|
||||||
|
hp.index = 0;
|
||||||
|
hp.padding = 0x12;
|
||||||
|
hp.split = 0x2 * 4; //arg 2
|
||||||
|
hp.split_index = 0;
|
||||||
|
hp.type = USING_STRING | NO_CONTEXT | USING_SPLIT;
|
||||||
|
hp.filter_fun = SysdFilter;
|
||||||
|
ConsoleOutput("vnreng: INSERT Sysd");
|
||||||
|
NewHook(hp, "Sysd");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool InsertKissHook() {
|
bool InsertKissHook() {
|
||||||
//by Blu3train
|
//by Blu3train
|
||||||
/*
|
/*
|
||||||
|
@ -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 InsertSysdHook(); // Sysd: sysd.ini
|
||||||
bool InsertKissHook(); // Kiss: GameData/*.arc
|
bool InsertKissHook(); // Kiss: GameData/*.arc
|
||||||
bool InsertKidHook(); // Kid: resource string
|
bool InsertKidHook(); // Kid: resource string
|
||||||
bool InsertISMscriptHooks(); // ISM script Engine: ism.dll
|
bool InsertISMscriptHooks(); // ISM script Engine: ism.dll
|
||||||
|
@ -380,6 +380,10 @@ bool DetermineEngineByFile3()
|
|||||||
|
|
||||||
bool DetermineEngineByFile4()
|
bool DetermineEngineByFile4()
|
||||||
{
|
{
|
||||||
|
if (Util::CheckFile(L"sysd.ini")) {
|
||||||
|
if (InsertSysdHook())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (Util::CheckFile(L"GameData/*.arc")) {
|
if (Util::CheckFile(L"GameData/*.arc")) {
|
||||||
if (InsertKissHook())
|
if (InsertKissHook())
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user