Skip to content
This repository has been archived by the owner on Nov 17, 2024. It is now read-only.

Commit

Permalink
Update Reallive.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed Sep 22, 2024
1 parent 7925680 commit 9501710
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions LunaHook/engine32/Reallive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,40 @@ namespace
return NewHook(hp, "RealLiveX");
}
}
namespace
{
// https://vndb.org/r1944
bool veryold()
{
HookParam hp;
hp.address = (DWORD)GetProcAddress(GetModuleHandleA("gdi32.dll"), "GetGlyphOutline");
hp.type = HOOK_RETURN;
hp.text_fun = [](hook_stack *stack, HookParam *hps, uintptr_t *data, uintptr_t *split, size_t *len)
{
hps->type = HOOK_EMPTY;
auto addr = findfuncstart(hps->address);
if (!addr)
return;
auto addrs = findxref_reverse_checkcallop(addr, processStartAddress, processStopAddress, 0xe8);
if (addrs.size() != 1)
return;
addr = addrs[0];
addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr)
return;
HookParam hp;
hp.address = addr;
hp.offset = get_stack(5);
hp.type = USING_CHAR | CODEC_ANSI_BE;
NewHook(hp, "RealLiveOld");
};
return NewHook(hp, "GetGlyphOutline");
}
}
bool Reallive::attach_function()
{
InsertRealliveHook();
InsertRlBabelHook() || clannad_en_steam();
InsertRlBabelHook() || clannad_en_steam() || veryold();
return true;
}

Expand Down Expand Up @@ -229,7 +259,7 @@ bool avg3216dattach_function2()
auto addr = MemDbg::findBytes(pattern2, sizeof(pattern2), processStartAddress, processStopAddress);
if (addr == 0)
return false;
addr = findfuncstart(addr, 0x200,true);
addr = findfuncstart(addr, 0x200, true);
if (addr == 0)
return false;
HookParam hp;
Expand Down

0 comments on commit 9501710

Please sign in to comment.