Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed Dec 9, 2024
1 parent 0872e76 commit f2315a7
Show file tree
Hide file tree
Showing 225 changed files with 1,565 additions and 1,686 deletions.
32 changes: 16 additions & 16 deletions cpp/LunaHook/LunaHook/engine32/5pb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ namespace

HookParam hp;
hp.address = addr + addr_offset;
hp.offset = get_reg(regs::edx);
hp.offset = regoffset(edx);
hp.type = USING_STRING;
ConsoleOutput("INSERT 5pb1");

Expand All @@ -169,10 +169,10 @@ namespace
}

// 001e9b15 8a10 mov dl,byte ptr ds:[eax] ; jichi: here, word by word
void SpecialHook5pb2(hook_stack *stack, HookParam *hp, TextBuffer *buffer, uintptr_t *split)
void SpecialHook5pb2(hook_context *context, HookParam *hp, TextBuffer *buffer, uintptr_t *split)
{
static DWORD lasttext;
DWORD text = stack->eax;
DWORD text = context->eax;
if (lasttext == text)
return;
BYTE c = *(BYTE *)text;
Expand Down Expand Up @@ -318,11 +318,11 @@ namespace
* 0026B2A5 CC INT3
* 0026B2A6 CC INT3
*/
void SpecialHook5pb3(hook_stack *stack, HookParam *hp, TextBuffer *buffer, uintptr_t *split)
void SpecialHook5pb3(hook_context *context, HookParam *hp, TextBuffer *buffer, uintptr_t *split)
{
int index = 0;
// Text in arg1, name in arg2
if (LPCSTR text = (LPCSTR)stack->stack[index + 1])
if (LPCSTR text = (LPCSTR)context->stack[index + 1])
if (*text)
{
if (index) // trim spaces in character name
Expand Down Expand Up @@ -394,7 +394,7 @@ bool Insert5pbHookex()
return false;
HookParam hp;
hp.address = addr;
hp.offset = get_reg(regs::ecx);
hp.offset = regoffset(ecx);
hp.type = CODEC_UTF16;

return NewHook(hp, "5pb");
Expand All @@ -410,8 +410,8 @@ bool InsertStuffScriptHook()
// );
HookParam hp;
hp.address = (DWORD)::GetTextExtentPoint32A;
hp.offset = get_stack(2); // arg2 lpString
hp.split = get_reg(regs::esp);
hp.offset = stackoffset(2); // arg2 lpString
hp.split = regoffset(esp);
hp.type = USING_STRING | USING_SPLIT;
ConsoleOutput("INSERT StuffScriptEngine");
return NewHook(hp, "StuffScriptEngine");
Expand Down Expand Up @@ -469,7 +469,7 @@ bool InsertStuffScript2Hook()

HookParam hp;
hp.address = addr + 0x11;
hp.offset = get_reg(regs::eax);
hp.offset = regoffset(eax);
hp.index = 0;
hp.type = USING_STRING | NO_CONTEXT;
hp.filter_fun = StuffScript2Filter;
Expand Down Expand Up @@ -520,7 +520,7 @@ bool InsertStuffScript3Hook()

HookParam hp = {};
hp.address = addr + 1;
hp.offset = get_reg(regs::ecx);
hp.offset = regoffset(ecx);
hp.type = USING_STRING | NO_CONTEXT;
hp.filter_fun = StuffScript3Filter;
NewHook(hp, "StuffScript3");
Expand Down Expand Up @@ -579,9 +579,9 @@ bool InsertKaleidoHook()

HookParam hp;
hp.address = addr + addr_offset;
hp.offset = get_reg(regs::esi);
hp.offset = regoffset(esi);
hp.index = 0;
hp.split = get_stack(3);
hp.split = stackoffset(3);
hp.split_index = 0;
hp.type = USING_STRING | USING_SPLIT;
hp.filter_fun = KaleidoFilter;
Expand All @@ -603,7 +603,7 @@ namespace
return false;
HookParam hp;
hp.address = addr;
hp.offset = get_stack(1);
hp.offset = stackoffset(1);
hp.type = USING_STRING | CODEC_UTF8 | EMBED_ABLE | EMBED_AFTER_NEW;
hp.lineSeparator = L"\\n";
return NewHook(hp, "5bp");
Expand Down Expand Up @@ -653,7 +653,7 @@ namespace

HookParam hp;
hp.address = addr;
hp.offset = get_stack(1);
hp.offset = stackoffset(1);
hp.type = USING_STRING | CODEC_UTF8;
hp.filter_fun = [](TextBuffer *buffer, HookParam *)
{
Expand Down Expand Up @@ -685,8 +685,8 @@ namespace
return false;
HookParam hp;
hp.address = addr;
hp.offset = get_stack(1);
hp.split = get_stack(2);
hp.offset = stackoffset(1);
hp.split = stackoffset(2);
hp.type = USING_SPLIT | USING_STRING | FULL_STRING | CODEC_UTF16 | EMBED_ABLE | EMBED_AFTER_NEW; // 中文显示不出来
hp.filter_fun = [](TextBuffer *buffer, HookParam *)
{
Expand Down
2 changes: 1 addition & 1 deletion cpp/LunaHook/LunaHook/engine32/A98SYS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bool A98SYS::attach_function()
return false;
HookParam hp;
hp.address = addr;
hp.offset = get_stack(1);
hp.offset = stackoffset(1);
hp.type = USING_STRING | EMBED_ABLE | EMBED_AFTER_NEW | EMBED_DYNA_SJIS;
hp.embed_hook_font = F_ExtTextOutA;

Expand Down
6 changes: 3 additions & 3 deletions cpp/LunaHook/LunaHook/engine32/AB2Try.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ namespace
return *(int *)a - *(int *)b;
}

void SpecialHookAB2Try(hook_stack *stack, HookParam *hp, TextBuffer *buffer, uintptr_t *split)
void SpecialHookAB2Try(hook_context *context, HookParam *hp, TextBuffer *buffer, uintptr_t *split)
{
// DWORD test = *(DWORD*)(esp_base - 0x10);
DWORD edx = stack->edx;
DWORD edx = context->edx;
if (edx != 0)
return;

// NSTRING *s = *(NSTRING **)(esp_base - 8);
if (const NSTRING *s = (NSTRING *)stack->eax)
if (const NSTRING *s = (NSTRING *)context->eax)
{
buffer->from(s->str, s->lenWithoutNull << 1);
//*split = 0;
Expand Down
2 changes: 1 addition & 1 deletion cpp/LunaHook/LunaHook/engine32/ACTGS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bool ACTGS::attach_function()
return false;
HookParam hp;
hp.address = addr;
hp.offset = get_stack(2);
hp.offset = stackoffset(2);
hp.type = USING_STRING;
hp.filter_fun = all_ascii_Filter;

Expand Down
2 changes: 1 addition & 1 deletion cpp/LunaHook/LunaHook/engine32/AGE_System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool AGE_System::attach_function()

HookParam hp;
hp.address = addr21;
hp.offset = get_stack(3);
hp.offset = stackoffset(3);
hp.type = USING_STRING | EMBED_ABLE | EMBED_DYNA_SJIS | EMBED_AFTER_NEW;
hp.embed_hook_font = F_GetGlyphOutlineA;
return NewHook(hp, "AGE_System");
Expand Down
4 changes: 2 additions & 2 deletions cpp/LunaHook/LunaHook/engine32/AGS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ bool InsertAGSHook()
continue;
HookParam hp;
hp.address = addr;
hp.offset = get_reg(regs::eax);
hp.offset = regoffset(eax);
hp.type = USING_STRING;
ConsoleOutput("INSERT HOOK_AGS %p", addr);

Expand Down Expand Up @@ -75,7 +75,7 @@ namespace
HookParam hp;
hp.address = funcaddr;
hp.type = DATA_INDIRECT;
hp.offset = get_stack(1);
hp.offset = stackoffset(1);
hp.index = 0;
return NewHook(hp, "AGS");
}
Expand Down
6 changes: 3 additions & 3 deletions cpp/LunaHook/LunaHook/engine32/AIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ bool InsertAIL2Hook()
HookParam hp;
hp.address = addr1;
hp.codepage = 932;
hp.offset = get_stack(3);
hp.offset = stackoffset(3);
hp.type = USING_STRING;
succ |= NewHook(hp, "AIL1");

Expand All @@ -48,7 +48,7 @@ bool InsertAIL2Hook()
hp = {};
hp.address = addr1;
hp.codepage = 932;
hp.offset = get_stack(4);
hp.offset = stackoffset(4);
hp.type = USING_STRING | USING_SPLIT;
hp.split_index = 0;
succ |= NewHook(hp, "AIL2");
Expand Down Expand Up @@ -90,7 +90,7 @@ bool AILold()
return false;
HookParam hp;
hp.address = addr1;
hp.offset = get_stack(3);
hp.offset = stackoffset(3);
hp.type = USING_STRING | EMBED_ABLE | EMBED_AFTER_NEW | EMBED_DYNA_SJIS;
hp.embed_hook_font = F_TextOutA;

Expand Down
34 changes: 17 additions & 17 deletions cpp/LunaHook/LunaHook/engine32/AOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ bool InsertAOS1Hook()

HookParam hp;
hp.address = addr;
hp.offset = get_stack(2);
hp.offset = stackoffset(2);
hp.type = DATA_INDIRECT;

ConsoleOutput("INSERT AOS1");
Expand Down Expand Up @@ -165,7 +165,7 @@ bool InsertAOS2Hook()

HookParam hp;
hp.address = addr;
hp.offset = get_stack(2);
hp.offset = stackoffset(2);
hp.type = DATA_INDIRECT;

ConsoleOutput("INSERT AOS2");
Expand Down Expand Up @@ -206,28 +206,28 @@ namespace
return addr;
}
}
regs mov_reg_ebpoffset(int reg)
int mov_reg_ebpoffset(int reg)
{
switch (reg)
{
case 0x4B:
return regs::ebx;
return regoffset(ebx);
case 0x48:
return regs::eax;
return regoffset(eax);
case 0x49:
return regs::ecx;
return regoffset(ecx);
case 0x4a:
return regs::edx;
return regoffset(edx);
case 0x4c:
return regs::ebp;
return regoffset(ebp);
case 0x4d:
return regs::esp;
return regoffset(esp);
case 0x4e:
return regs::esi;
return regoffset(esi);
case 0x4f:
return regs::edi;
return regoffset(edi);
default:
return regs::invalid;
return -1;
}
}
bool AOS_EX()
Expand Down Expand Up @@ -263,29 +263,29 @@ bool AOS_EX()
continue;
auto reg = mov_reg_ebpoffset(*(BYTE *)((BYTE *)addr + 5));
int off;
if (reg != regs::invalid)
if (reg != -1)
{
// usercall
off = get_reg(reg);
off = reg;
}
else if (((*(WORD *)addr)) == 0xec83)
{
// 姫様LOVEライフ!
// 也是usercall,但是第二个参数是栈上。
off = get_stack(1);
off = stackoffset(1);
}
else
{
// 螺旋遡行のディストピア -The infinite set of alternative version- 官方中文
BYTE sig[] = {0x89, 0x55, 0xFC};
if (MemDbg::findBytes(sig, sizeof(sig), addr, addr + 0x20))
{
off = get_reg(regs::edx);
off = regoffset(edx);
}
else
{
// cdecl;
off = get_stack(2);
off = stackoffset(2);
}
}
HookParam hp;
Expand Down
6 changes: 3 additions & 3 deletions cpp/LunaHook/LunaHook/engine32/AXL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bool InsertAXLHook()
return false;
HookParam hp;
hp.address = addr;
hp.offset = get_stack(4);
hp.offset = stackoffset(4);
hp.type = USING_STRING;

return NewHook(hp, "AXL");
Expand All @@ -36,8 +36,8 @@ namespace
return false;
HookParam hp;
hp.address = addr;
hp.offset = get_stack(1);
hp.split = get_reg(regs::eax);
hp.offset = stackoffset(1);
hp.split = regoffset(eax);
hp.type = USING_SPLIT;

return NewHook(hp, "TAILWIND");
Expand Down
2 changes: 1 addition & 1 deletion cpp/LunaHook/LunaHook/engine32/Abalone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bool AbaloneHook()
return false;
HookParam hp;
hp.address = addr + 4;
hp.offset = get_reg(regs::eax);
hp.offset = regoffset(eax);
hp.type = DATA_INDIRECT;
hp.index = 0;
return NewHook(hp, "AbaloneHook");
Expand Down
2 changes: 1 addition & 1 deletion cpp/LunaHook/LunaHook/engine32/Abel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ bool InsertAbelHook()
{
HookParam hp;
hp.address = j;
hp.offset = get_stack(1);
hp.offset = stackoffset(1);
hp.type = USING_STRING | NO_CONTEXT;
return NewHook(hp, "Abel");
}
Expand Down
10 changes: 5 additions & 5 deletions cpp/LunaHook/LunaHook/engine32/AdobeAir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ bool InsertAdobeAirHook()
HookParam hp;
hp.address = addr + addr_offset;
// hp.module = module;
hp.offset = get_reg(regs::edx);
hp.offset = regoffset(edx);
hp.split = 0xd8;
// hp.type = USING_SPLIT|MODULE_OFFSET|CODEC_UTF16|DATA_INDIRECT; // 0x5a;
hp.type = USING_SPLIT | CODEC_UTF16 | DATA_INDIRECT;
Expand Down Expand Up @@ -143,7 +143,7 @@ bool AdobeAIRhook2()
return false;
HookParam hp;
hp.address = addr + 3;
hp.offset = get_stack(1);
hp.offset = stackoffset(1);
hp.type = USING_STRING | CODEC_UTF16;

return NewHook(hp, "AdobeAIR");
Expand All @@ -165,8 +165,8 @@ bool InsertAIRNovelHook()
HookParam hp;
hp.address = func;
hp.type = CODEC_UTF16 | USING_STRING /*|USING_SPLIT|SPLIT_INDIRECT*/ | DATA_INDIRECT; // Artikash 12/14/2018: doesn't seem to be a good split anymore
hp.offset = get_stack(1);
hp.split = get_stack(1);
hp.offset = stackoffset(1);
hp.split = stackoffset(1);
hp.index = 0x8;
hp.split_index = 0x4;
// hp.filter_fun = [](void* str, DWORD* len, HookParam* hp, BYTE index) // removes some of the garbage threads
Expand Down Expand Up @@ -217,7 +217,7 @@ bool adobelair3()
HookParam hp;
hp.address = addr;
hp.type = CODEC_UTF8 | USING_STRING | NO_CONTEXT;
hp.offset = get_stack(1);
hp.offset = stackoffset(1);
hp.filter_fun = [](TextBuffer *buffer, HookParam *hp)
{
// 若当前还有5个字符,则这个句子会显示5次,然后substr(1,len-1),直到结束,总共显示5+4+3+2+1次
Expand Down
4 changes: 2 additions & 2 deletions cpp/LunaHook/LunaHook/engine32/AdobeFlash10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ bool InsertAdobeFlash10Hook()

HookParam hp;
hp.address = addr;
hp.offset = get_stack(1);
hp.offset = stackoffset(1);
// hp.length_offset = 2 * 4; // arg2 might be the length
hp.type = CODEC_UTF16 | USING_STRING;
hp.filter_fun = AdobeFlashFilter;
Expand Down Expand Up @@ -275,7 +275,7 @@ namespace

HookParam hp;
hp.address = addr;
hp.offset = get_stack(4);
hp.offset = stackoffset(4);
hp.type = CODEC_UTF16 | USING_STRING;
return NewHook(hp, "Adobe Flash 11");
}
Expand Down
Loading

0 comments on commit f2315a7

Please sign in to comment.