Improved for another VNs

This commit is contained in:
Blu3train 2023-08-17 19:46:34 +02:00
parent cb7b5ac9ee
commit cdd38a9598
3 changed files with 91 additions and 2 deletions

View File

@ -5653,8 +5653,92 @@ bool InsertAtelierGSHook2()
return true;
}
bool AtelierGS3Filter(LPVOID data, DWORD *size, HookParam *, BYTE)
{
auto text = reinterpret_cast<LPSTR>(data);
auto len = reinterpret_cast<size_t *>(size);
static std::string prevText;
if (!*len)
return false;
text[*len] = '\0'; // clean text
if (!prevText.compare(text))
return false;
prevText = text;
return true;
}
bool InsertAtelierGSHook3()
{
//by Blu3train
/*
* Sample games:
* https://vndb.org/v25951
*/
const BYTE bytes[] = {
0x0F, 0xBE, 0x04, 0x18, // movsx eax,byte ptr [eax+ebx] << hook here
0x50, // push eax
0xE8, XX4, // call GAME_SYS.EXE+1886BA
0x83, 0xC4, 0x04, // add esp,04
0xC7, 0x45, 0xE8, 0x00, 0x00, 0x00, 0x00 // mov [ebp-18],00000000
};
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
if (!addr) {
ConsoleOutput("vnreng:Atelier KAGUYA GAME_SYS3: pattern not found");
return false;
}
HookParam hp = {};
hp.address = addr;
hp.offset = pusha_eax_off -4;
hp.index = 0;
hp.filter_fun = AtelierGS3Filter;
hp.type = NO_CONTEXT | USING_STRING;
ConsoleOutput("vnreng: INSERT Atelier KAGUYA GAME_SYS3");
NewHook(hp, "Atelier KAGUYA GS3");
return true;
}
bool InsertAtelierGSHooks()
{return InsertAtelierGSHook1() || InsertAtelierGSHook2();}
{return InsertAtelierGSHook1() || InsertAtelierGSHook2() || InsertAtelierGSHook3();}
bool InsertAtelierADV10Hook()
{
//by Blu3train
/*
* Sample games:
* https://vndb.org/v2890
*/
const BYTE bytes[] = {
0x50, // push eax << hook here
0xFF, 0x15, XX4, // call dword ptr [ADV10.EXE+58268]
0x3B, 0x86, XX4, // cmp eax,[esi+00008880]
0x7F, 0x17, // jg ADV10.EXE+1671C
0x8B, 0x86, XX4 // mov eax,[esi+00008884]
};
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
if (!addr) {
ConsoleOutput("vnreng:Atelier KAGUYA ADV10: pattern not found");
return false;
}
HookParam hp = {};
hp.address = addr;
hp.offset = pusha_eax_off -4;
hp.index = 0;
hp.filter_fun = AtelierGS3Filter;
hp.type = NO_CONTEXT | USING_STRING;
ConsoleOutput("vnreng: INSERT Atelier KAGUYA ADV10");
ConsoleOutput("vnreng: doesn't work with instant text speed");
NewHook(hp, "Atelier KAGUYA ADV10");
return true;
}
/********************************************************************************************
CIRCUS hook:

View File

@ -165,7 +165,8 @@ void InsertRealliveHook(); // RealLive: RealLive*.exe
void InsertStuffScriptHook(); // Stuff: *.mpk
bool InsertTinkerBellHook(); // TinkerBell: arc00.dat
bool InsertWaffleHook(); // WAFFLE: cg.pak
bool InsertAtelierGSHooks(); // Atelier GAME_SYS: game_sys.exe, resource string
bool InsertAtelierGSHooks(); // Atelier GAME_SYS: game_sys.exe, resource string
bool InsertAtelierADV10Hook(); // Atelier ADV10: ADV10.EXE, resource string
// CIRCUS: avdata/
bool InsertCircusHook1();

View File

@ -203,6 +203,10 @@ bool DetermineEngineByFile1()
if (InsertAtelierGSHooks() )
return true;
}
if (Util::CheckFile(L"ADV10.EXE") && Util::SearchResourceString(L"KaGuYa")) {
if (InsertAtelierADV10Hook() )
return true;
}
if (Util::CheckFile(L"Check.mdx")) { // jichi 4/1/2014: AUGame
InsertTencoHook();
return true;