diff --git a/texthook/engine/engine.cc b/texthook/engine/engine.cc index c2c7abc..6be9ce3 100644 --- a/texthook/engine/engine.cc +++ b/texthook/engine/engine.cc @@ -5583,6 +5583,44 @@ bool InsertAtelierHook() return false; //ConsoleOutput("Unknown Atelier KAGUYA engine."); } + +bool InsertAtelierKaguya2Hook() +{ + //by Blu3train + /* + * Sample games: + * https://vndb.org/v22713 + */ + const BYTE bytes[] = { + 0x51, // push ecx + 0x50, // push eax + 0xE8, XX4, // call Start.exe+114307 + 0x83, 0xC4, 0x08, // add esp,08 + 0x85, 0xC0, // test eax,eax + 0x78, 0xA1 // js Start.exe+48947 + }; + + ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR); + ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range); + if (!addr) { + ConsoleOutput("vnreng:Atelier KAGUYA2: pattern not found"); + return false; + } + + HookParam hp = {}; + hp.address = addr; + hp.offset = pusha_eax_off -4; + hp.index = 0; + hp.type = USING_STRING; + hp.filter_fun = NewLineCharToSpaceFilter; + ConsoleOutput("vnreng: INSERT Atelier KAGUYA2"); + NewHook(hp, "Atelier KAGUYA2"); + return true; +} + +bool InsertAtelierHooks() +{return InsertAtelierHook() || InsertAtelierKaguya2Hook();} + /******************************************************************************************** CIRCUS hook: Game folder contains advdata folder. Used by CIRCUS games. diff --git a/texthook/engine/engine.h b/texthook/engine/engine.h index 5e167b2..5778e0f 100644 --- a/texthook/engine/engine.h +++ b/texthook/engine/engine.h @@ -86,7 +86,7 @@ bool InsertAnex86Hook(); // Anex86: anex86.exe bool InsertAOSHook(); // AOS: *.aos bool InsertApricoTHook(); // Apricot: arc.a* bool InsertArtemisHook(); // Artemis Engine: *.pfs -bool InsertAtelierHook(); // Atelier Kaguya: message.dat +bool InsertAtelierHooks(); // Atelier Kaguya: message.dat bool InsertBGIHook(); // BGI: BGI.* bool InsertBaldrHook(); // Baldr Sky "Zero" bool InsertBootupHook(); // Bootup: Bootup.dat diff --git a/texthook/engine/match32.cc b/texthook/engine/match32.cc index fffc4c7..c12bfd2 100644 --- a/texthook/engine/match32.cc +++ b/texthook/engine/match32.cc @@ -196,7 +196,7 @@ bool DetermineEngineByFile1() return true; } if (Util::CheckFile(L"message.dat")) { - InsertAtelierHook(); + InsertAtelierHooks(); return true; } if (Util::CheckFile(L"Check.mdx")) { // jichi 4/1/2014: AUGame