Merge remote-tracking branch 'Blu3train/SilkysHook'

This commit is contained in:
Chenx221 2024-09-05 12:15:37 +08:00
commit 2beaeb85f7
3 changed files with 48 additions and 2 deletions

View File

@ -13942,6 +13942,52 @@ bool InsertSilkysHook()
return true;
}
bool Silkys2Filter(LPVOID data, DWORD *size, HookParam *, BYTE)
{
auto text = reinterpret_cast<LPWSTR>(data);
auto len = reinterpret_cast<size_t *>(size);
WideStringCharReplacer(text, len, L"\\i", 2, L'\'');
return true;
}
bool InsertSilkys2Hook()
{
//by Blu3train
/*
* Sample games:
* https://vndb.org/r89173
*/
const BYTE bytes[] = {
0x75, 0x10, // jne doukyuusei.exe+A5F7E
0x56, // push esi
0x57, // push edi
0xE8, XX4 // call doukyuusei.exe+A6120 << hook here
};
enum { addr_offset = sizeof(bytes) - 5 };
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
if (!addr) {
ConsoleOutput("vnreng:Silkys2: pattern not found");
return false;
}
HookParam hp = {};
hp.address = addr + addr_offset;
hp.offset = pusha_edi_off -4;
hp.index = 0;
hp.filter_fun = Silkys2Filter;
hp.type = USING_UNICODE | USING_STRING | NO_CONTEXT;
ConsoleOutput("vnreng: INSERT Silkys2");
NewHook(hp, "Silkys2");
return true;
}
bool InsertSilkysHooks()
{ return InsertSilkysHook() || InsertSilkys2Hook();}
/** jichi 6/1/2014 Eushully
* Insert to the last GetTextExtentPoint32A
*

View File

@ -141,7 +141,7 @@ bool InsertElfHook(); // elf: Silky.exe
bool InsertScenarioPlayerHook();// sol-fa-soft: *.iar && *.sec5
bool InsertSiglusHook(); // SiglusEngine: SiglusEngine.exe
bool InsertSideBHook(); // SideB: Copyright side-B
bool InsertSilkysHook(); // SilkysPlus
bool InsertSilkysHooks(); // SilkysPlus
bool InsertSyuntadaHook(); // Syuntada: dSoh.dat
bool InsertSystem43Hook(); // System43@AliceSoft: AliceStart.ini
bool InsertSystemAoiHook(); // SystemAoi: *.vfs

View File

@ -164,7 +164,7 @@ bool DetermineEngineByFile1()
// jichi 6/9/2015: Skip Silkys Sakura
if ( // Almost the same as Silkys except mes.arc is replaced by Script.arc
Util::CheckFile(L"data.arc") && Util::CheckFile(L"effect.arc") && Util::CheckFile(L"Script.arc")) {
InsertSilkysHook();
InsertSilkysHooks();
return true;
}
if (Util::CheckFile(L"data\\pack\\*.cpz")) {