Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions texthook/engine/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17073,6 +17073,56 @@ bool NoAsciiFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
return false;
}

bool Anim3Filter(LPVOID data, DWORD *size, HookParam *, BYTE)
{
auto text = reinterpret_cast<LPSTR>(data);
auto len = reinterpret_cast<size_t *>(size);

StringFilterBetween(text, len, "\x81\x40", 2, "@m", 2); // @r(2,はと)
StringFilterBetween(text, len, "\x81\x40", 2, "@n", 2); // @r(2,はと)
StringCharReplacer(text, len, "@b", 2, ' ');
StringCharReplacer(text, len, "\x81\x42", 2, '.');
StringCharReplacer(text, len, "\x81\x48", 2, '?');
StringCharReplacer(text, len, "\x81\x49", 2, '!');

return true;
}

bool InsertAnim3Hook()
{
//mod by Blu3train
/*
* Sample games:
* https://vndb.org/v17427
* https://vndb.org/v18837
*/
const BYTE bytes[] = {
0xCC, // int 3
0x55, // push ebp << hook here
0x8B, 0xEC, // mov ebp,esp
0x81, 0xEC, XX4, // sub esp,00000830
0xA1, XX4, // mov eax,[musu_mama.exe+A91F0]
0x33, 0xC5, // xor eax,ebp
0x89, 0x45, 0xE8 // mov [ebp-18],eax
};
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
if (!addr) {
ConsoleOutput("vnreng:Anim3: pattern not found");
return false;
}

HookParam hp = {};
hp.address = addr + 1;
hp.offset = pusha_edx_off - 4;
hp.type = USING_STRING;
hp.filter_fun = Anim3Filter;
ConsoleOutput("vnreng: INSERT Anim3");
NewHook(hp, "Anim3");

return true;
}

bool InsertMonoHooks()
{
HMODULE h = ::GetModuleHandleA("mono.dll");
Expand Down
3 changes: 3 additions & 0 deletions texthook/engine/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ bool InsertWaffleHook(); // WAFFLE: cg.pak
bool InsertCircusHook1();
bool InsertCircusHook2();

// Anim engines
bool InsertAnim3Hook();

} // namespace Engine

// EOF
4 changes: 4 additions & 0 deletions texthook/engine/match32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ bool DetermineEngineByFile4()
return true;
}

if (Util::CheckFile(L"voice\\*.pck")) {
return /*InsertAnimHook() || InsertAnim2Hook() ||*/ InsertAnim3Hook();
}

// jichi 11/22/2015: 凍京NECRO 体験版
// Jazzinghen 23/05/2020: Add check for 凍京NECRO
// ResEdit shows multiple potential strings:
Expand Down