Silkys2 engine hook

This commit is contained in:
Blu3train 2023-11-10 19:30:51 +01:00
parent f3fbe04409
commit 7076dc0655
3 changed files with 48 additions and 2 deletions

View File

@ -12268,6 +12268,52 @@ bool InsertSilkysHook()
return true; 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 /** jichi 6/1/2014 Eushully
* Insert to the last GetTextExtentPoint32A * Insert to the last GetTextExtentPoint32A
* *

View File

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

View File

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