This commit is contained in:
恍兮惚兮 2025-01-07 16:28:57 +08:00
parent bf3228c439
commit 0a77c9ce70
4 changed files with 135 additions and 24 deletions

View File

@ -1,19 +1,113 @@
#include"FrontWing.h"
#include "FrontWing.h"
bool FrontWing::attach_function() {
bool FrontWing::attach_function()
{
const BYTE bytes[] = {
//v55 = (int)(__CFADD__(v54 * v13, 0x80000000) + v54 * v13 + 0x80000000 + 0x80000000) >> 1;
0x05,0x00,0x00,0x00,0x80,0x15,0x00,0x00,0x00,0x80,0xD1,0xF8,0x85,0xC0
};
// v55 = (int)(__CFADD__(v54 * v13, 0x80000000) + v54 * v13 + 0x80000000 + 0x80000000) >> 1;
0x05, 0x00, 0x00, 0x00, 0x80, 0x15, 0x00, 0x00, 0x00, 0x80, 0xD1, 0xF8, 0x85, 0xC0};
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
if (addr == 0)return false;
addr=MemDbg::findEnclosingAlignedFunction(addr);
if(addr==0)return false;
if (!addr)
return false;
addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr)
return false;
HookParam hp;
hp.address = addr;
hp.offset=stackoffset(1);
hp.offset = stackoffset(1);
hp.type = USING_STRING;
return NewHook(hp, "FrontWing");
}
bool FrontWing2_attach_function()
{
const BYTE bytes[] = {
0x68, 0xb4, 0x00, 0x00, 0x00,
0x6a, 0x00,
0x8b, 0x55, 0x08,
0x81, 0xc2, XX4,
0x52,
0xe8, XX4,
0x83, 0xc4, 0x0c,
0x68, 0xb3, 0x00, 0x00, 0x00,
0x8b, 0x45, 0x08,
0x8b, 0x88, XX4,
0x03, 0x4d, 0xfc,
0x51,
0x8b, 0x55, 0x08,
0x81, 0xc2, XX4,
0x52,
0xe8, XX4};
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
if (!addr)
return false;
HookParam hp;
hp.address = addr + sizeof(bytes) - 5;
hp.offset = regoffset(ecx);
hp.type = USING_STRING;
hp.filter_fun = [](TextBuffer *buffer, HookParam *hp)
{
auto s = strSplit(buffer->strA(), "\n")[0];
auto ws = StringToWideString(s, 932).value();
ws = std::regex_replace(ws, std::wregex(LR"([\w\d]*\\[\w\d]*\\[\w\d_]*)"), L"");
ws = std::regex_replace(ws, std::wregex(LR"(\[rb,(.*?),(.*?)\])"), L"$1");
ws = std::regex_replace(ws, std::wregex(L",(.*?),(.*?)"), L"$1$2");
buffer->from(WideStringToString(ws, 932));
};
return NewHook(hp, "FrontWing");
}
bool FrontWing2_attach_function2()
{
const BYTE bytes[] = {
0x8b, 0x55, 0xf8,
0x03, 0x55, 0x10,
0x03, 0x55, XX,
0x8b, 0x45, 0x0c,
0x0f, 0xbe, 0x0c, 0x10,
0x83, 0xf9, 0x0d,
0x75, XX,
0x8b, 0x55, 0xf8,
0x03, 0x55, 0x10,
0x03, 0x55, XX,
0x8b, 0x45, 0x0c,
0x0f, 0xbe, 0x4c, 0x10, 0x01,
0x83, 0xf9, 0x0a,
0x75, XX,
0x8b, 0x55, 0xf8,
0x03, 0x55, 0x10,
0x03, 0x55, XX,
0x8b, 0x45, 0x0c,
0x0f, 0xbe, 0x4c, 0x10, 0x02,
0x83, 0xf9, 0x0d,
0x75, XX,
0x8b, 0x55, 0xf8,
0x03, 0x55, 0x10,
0x03, 0x55, XX,
0x8b, 0x45, 0x0c,
0x0f, 0xbe, 0x4c, 0x10, 0x03,
0x83, 0xf9, 0x0a,
0x74, XX};
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
if (!addr)
return false;
addr = MemDbg::findEnclosingAlignedFunction(addr);
if (!addr)
return false;
HookParam hp;
hp.address = addr;
hp.offset = stackoffset(2);
hp.type = USING_STRING;
hp.filter_fun = [](TextBuffer *buffer, HookParam *hp)
{
auto xx = buffer->viewA();
static std::string last;
if (xx == last)
return buffer->clear();
last = xx;
};
return NewHook(hp, "FrontWing");
}
bool FrontWing2::attach_function()
{
return FrontWing2_attach_function() || FrontWing2_attach_function2();
}

View File

@ -1,6 +1,6 @@
//https://vndb.org/v760
//魔界天使ジブリール
// https://vndb.org/v760
// 魔界天使ジブリール
/*
BLOCK "StringFileInfo"
{
@ -21,12 +21,25 @@ BLOCK "StringFileInfo"
}
}
*/
class FrontWing:public ENGINE{
public:
FrontWing(){
class FrontWing : public ENGINE
{
public:
FrontWing()
{
check_by=CHECK_BY::RESOURCE_STR;
check_by_target=L"FrontWing Co.,LTD.";
check_by = CHECK_BY::RESOURCE_STR;
check_by_target = L"FrontWing Co.,LTD.";
};
bool attach_function();
};
class FrontWing2 : public ENGINE
{
public:
FrontWing2()
{
//[071227][フロントウイング] タイムリープ
check_by = CHECK_BY::FILE_ALL;
check_by_target = check_by_list{L"MDT/*.dat", L"BGM.dat", L"CHIP.dat", L"ef.dat", L"Init.dat", L"SE.dat"};
};
bool attach_function();
};

View File

@ -430,5 +430,6 @@ std::vector<ENGINE *> check_engines()
new e_Erekiteru,
new H_do_C,
new Mink3,
new FrontWing2,
};
}

View File

@ -81,16 +81,18 @@ bool checkengine()
int current = 0;
for (auto m : engines)
{
std::unique_ptr<ENGINE> __m;
__m.reset(m);
current += 1;
bool matched = safematch(m);
bool attached = matched && safeattach(m);
// ConsoleOutput("Progress %d/%d, checked engine %s, %s",current,engines.size(),m->getenginename(),infomations[matched+attached]);
// ConsoleOutput("Progress %d/%d, %s",current,engines.size(),infomations[matched+attached]);
if (matched == false)
if (!matched)
continue;
ConsoleOutput(TR[MatchedEngine], m->getenginename());
bool attached = safeattach(m);
if (attached)
{
jittypedefault = m->jittype;
@ -100,6 +102,7 @@ bool checkengine()
spDefault.minAddress = 0;
spDefault.maxAddress = -1;
}
__m.release();
}
if (m->is_engine_certain)
{