Improved for another VNs

This commit is contained in:
Blu3train 2023-08-12 18:02:47 +02:00
parent 8d56974075
commit cb7b5ac9ee
3 changed files with 53 additions and 16 deletions

View File

@ -5584,28 +5584,62 @@ bool InsertAtelierHook()
//ConsoleOutput("Unknown Atelier KAGUYA engine.");
}
bool InsertAtelierGSHook()
bool InsertAtelierGSHook1()
{
//by Blu3train
/*
* Sample games:
* https://vndb.org/v403
* https://vndb.org/v7655
*/
const BYTE bytes[] = {
0xC7, 0x44, 0x24, 0x34, XX4, // mov [esp+34],0000000F << hook here
0x89, 0x5C, 0x24, 0x30, // mov [esp+30],ebx
0x88, 0x5C, 0x24, 0x20, // mov [esp+20],bl
0x8D, 0x48, 0x01, // lea ecx,[eax+01]
0x8A, 0x10, // mov dl,[eax]
0x40, // inc eax
0x3A, 0xD3, // cmp dl,bl
0x75, 0xF9 // jne GAME_SYS.EXE+F0B5
0x53, // push ebx << hook here
0xFF, 0x15, XX4, // call dword ptr [GAME_SYS.EXE+E5074]
0x6A, 0x02, // push 02
0x6A, 0x02, // push 02
0x8D, 0xAE, XX4 // lea ebp,[esi+00000228]
};
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_SYS: pattern not found");
ConsoleOutput("vnreng:Atelier KAGUYA GAME_SYS1: pattern not found");
return false;
}
HookParam hp = {};
hp.address = addr;
hp.offset = pusha_ebp_off -4;
hp.index = 0;
hp.split = pusha_esp_off - 4;
hp.type = NO_CONTEXT | USING_STRING | USING_SPLIT;
ConsoleOutput("vnreng: INSERT Atelier KAGUYA GAME_SYS1");
NewHook(hp, "Atelier KAGUYA GS1");
return true;
}
bool InsertAtelierGSHook2()
{
//by Blu3train
/*
* Sample games:
* https://vndb.org/v403
* https://vndb.org/v1895
*/
const BYTE bytes[] = {
0xC7, 0x44, 0x24, XX, XX4, // mov [esp+34],0000000F << hook here
0x89, 0x5C, 0x24, XX, // mov [esp+30],ebx
0x88, 0x5C, 0x24, XX, // mov [esp+20],bl
0x8D, 0x48, 0x01, // lea ecx,[eax+01]
0x8A, 0x10 // mov dl,[eax]
// 0x40, // inc eax
// 0x3A, 0xD3, // cmp dl,bl
// 0x75, 0xF9 // jne GAME_SYS.EXE+F0B5
};
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_SYS2: pattern not found");
return false;
}
@ -5613,12 +5647,15 @@ bool InsertAtelierGSHook()
hp.address = addr;
hp.offset = pusha_eax_off -4;
hp.index = 0;
hp.type = USING_STRING | NO_CONTEXT;
ConsoleOutput("vnreng: INSERT Atelier KAGUYA GAME_SYS");
NewHook(hp, "Atelier KAGUYA GS");
hp.type = NO_CONTEXT | USING_STRING;
ConsoleOutput("vnreng: INSERT Atelier KAGUYA GAME_SYS2");
NewHook(hp, "Atelier KAGUYA GS2");
return true;
}
bool InsertAtelierGSHooks()
{return InsertAtelierGSHook1() || InsertAtelierGSHook2();}
/********************************************************************************************
CIRCUS hook:
Game folder contains advdata folder. Used by CIRCUS games.

View File

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

View File

@ -200,7 +200,7 @@ bool DetermineEngineByFile1()
return true;
}
if (Util::CheckFile(L"game_sys.exe") && Util::SearchResourceString(L"KaGuYa")) {
if (InsertAtelierGSHook() )
if (InsertAtelierGSHooks() )
return true;
}
if (Util::CheckFile(L"Check.mdx")) { // jichi 4/1/2014: AUGame