This commit is contained in:
恍兮惚兮 2024-12-03 12:50:02 +08:00
parent 1a7ac03dcf
commit a415e9c221
3 changed files with 140 additions and 65 deletions

View File

@ -14,13 +14,16 @@ bool InsertCircusHook1() // jichi 10/2/2013: Change return type to bool
{ {
for (DWORD i = processStartAddress + 0x1000; i < processStopAddress - 4; i++) for (DWORD i = processStartAddress + 0x1000; i < processStopAddress - 4; i++)
if (*(WORD *)i == 0xa3c) // cmp al, 0xA; je if (*(WORD *)i == 0xa3c) // cmp al, 0xA; je
for (DWORD j = i; j < i + 0x100; j++) { for (DWORD j = i; j < i + 0x100; j++)
{
BYTE c = *(BYTE *)j; BYTE c = *(BYTE *)j;
if (c == 0xc3) if (c == 0xc3)
break; break;
if (c == 0xe8) { if (c == 0xe8)
{
DWORD k = *(DWORD *)(j + 1) + j + 5; DWORD k = *(DWORD *)(j + 1) + j + 5;
if (k > processStartAddress && k < processStopAddress) { if (k > processStartAddress && k < processStopAddress)
{
HookParam hp; HookParam hp;
hp.address = k; hp.address = k;
hp.offset = get_stack(3); hp.offset = get_stack(3);
@ -38,7 +41,8 @@ bool InsertCircusHook1() // jichi 10/2/2013: Change return type to bool
ConsoleOutput("CIRCUS1: failed"); ConsoleOutput("CIRCUS1: failed");
return false; return false;
} }
namespace{ namespace
{
// C.D.C.D.2シーディーシーディー2 // C.D.C.D.2シーディーシーディー2
// https://vndb.org/v947 // https://vndb.org/v947
bool circus12() bool circus12()
@ -62,12 +66,13 @@ namespace{
0x75, XX, 0x75, XX,
0xE9, XX4, 0xE9, XX4,
0x3C, 0x66, 0x3C, 0x66,
0x75,XX 0x75, XX};
};
auto addr = MemDbg::findBytes(sig, sizeof(sig), processStartAddress, processStopAddress); auto addr = MemDbg::findBytes(sig, sizeof(sig), processStartAddress, processStopAddress);
if(!addr)return false; if (!addr)
return false;
addr = MemDbg::findEnclosingAlignedFunction(addr, 0x40); addr = MemDbg::findEnclosingAlignedFunction(addr, 0x40);
if(!addr)return false; if (!addr)
return false;
HookParam hp; HookParam hp;
hp.address = addr; hp.address = addr;
hp.offset = get_stack(2); hp.offset = get_stack(2);
@ -76,7 +81,57 @@ namespace{
return NewHook(hp, "Circus1"); return NewHook(hp, "Circus1");
} }
} }
bool Circus1::attach_function() { bool Circus1::attach_function()
{
return InsertCircusHook1() | circus12(); return InsertCircusHook1() | circus12();
} }
bool Circus_old::attach_function()
{
//[041213][CIRCUS]最終試験くじら
auto call = finddllfunctioncall((DWORD)GetGlyphOutlineA, processStartAddress, processStopAddress);
if (!call)
return false;
auto func = MemDbg::findEnclosingAlignedFunction(call);
if (!func)
return false;
BYTE sig[] = {
/*
.text:0041D1CD cmp edi, 8140h
.text:0041D1D3 jz loc_41D2D9
.text:0041D1D9 cmp edi, 20h ; ' '
.text:0041D1DC jz loc_41D2E1*/
/*
if ( v14 == 33088 )
{
gm.gmCellIncX = psizl.cx;
goto LABEL_46;
}
if ( v14 == 32 )
goto LABEL_46;
if ( v43 == v14 )
goto LABEL_44;
sub_41DC00(0);
v15 = pvBuffer;
if ( GetGlyphOutlineA(hdc, v14, 6u, &gm, cjBuffer, pvBuffer, &mat2) != -1 )*/
0x81, 0xFF, 0x40, 0x81, 0x00, 0x00,
0x0F, 0x84, XX4,
0x83, 0xFF, 0x20,
0x0F, 0x84, XX4
};
if (!MemDbg::findBytes(sig, sizeof(sig), func, call))
return false;
auto refs = findxref_reverse_checkcallop(func, processStartAddress, processStopAddress, 0xe8);
if (refs.size() == 3)
{
func = MemDbg::findEnclosingAlignedFunction(refs[0]);
}
HookParam hp;
hp.address = func;
hp.offset = get_stack(4);
hp.split = get_stack(1);
hp.type = USING_STRING | USING_SPLIT;
return NewHook(hp, "Circus");
}

View File

@ -1,11 +1,30 @@
class Circus1:public ENGINE{ class Circus1 : public ENGINE
{
public: public:
Circus1(){ Circus1()
{
check_by = CHECK_BY::FILE; check_by = CHECK_BY::FILE;
check_by_target = L"AdvData\\DAT\\NAMES.DAT"; check_by_target = L"AdvData\\DAT\\NAMES.DAT";
}; };
bool attach_function(); bool attach_function();
}; };
class Circus_old : public ENGINE
{
public:
Circus_old()
{
check_by = CHECK_BY::CUSTOM;
check_by_target = []()
{
//[041213][CIRCUS]最終試験くじら
auto _ = {L"Pack/Bg.pak", L"Pack/Bustup.pak", L"Pack/Cg.pak", L"Pack/Movie*.pak", L"Pack/Script.pak", L"Pack/Sound.pak", L"Pack/System.pak", L"Pack/Thumbnail.pak"};
auto checkfile = std::all_of(_.begin(), _.end(), Util::CheckFile);
return checkfile && Util::SearchResourceString(L"Circus");
};
};
bool attach_function();
};

View File

@ -216,6 +216,7 @@ std::vector<ENGINE *> check_engines()
new Wolf, new Wolf,
new Circus1, new Circus1,
new Circus2, new Circus2,
new Circus_old,
new Cotopha, new Cotopha,
new Artemis, new Artemis,
new CatSystem, new CatSystem,