This commit is contained in:
恍兮惚兮 2024-05-13 17:59:25 +08:00
parent e17343670b
commit 69de553d13
9 changed files with 28 additions and 8 deletions

View File

@ -1,7 +1,7 @@
#include"IronGameSystem.h"
bool InsertIGSDynamicHook(LPVOID addr, uintptr_t frame, uintptr_t stack)
bool InsertIGSDynamicHook(LPVOID addr, hook_stack* ,uintptr_t frame, uintptr_t stack)
{
if (addr != GetGlyphOutlineW)
return false;

View File

@ -57,7 +57,7 @@ Reallive hook:
* 012da884 83c4 08 add esp,0x8
* 012da887 85f6 test esi,esi
*/
static bool InsertRealliveDynamicHook(LPVOID addr, uintptr_t frame, uintptr_t stack)
static bool InsertRealliveDynamicHook(LPVOID addr, hook_stack*, uintptr_t frame, uintptr_t stack)
{
if (addr != ::GetGlyphOutlineA)
return false;

View File

@ -14,7 +14,7 @@ static void SpecialHookRyokucha(hook_stack* stack, HookParam *hp, uintptr_t *da
}
*len = 0;
}
bool InsertRyokuchaDynamicHook(LPVOID addr, uintptr_t frame, uintptr_t stack)
bool InsertRyokuchaDynamicHook(LPVOID addr, hook_stack*, uintptr_t frame, uintptr_t stack)
{
if (addr != ::GetGlyphOutlineA)
return false;

View File

@ -155,7 +155,7 @@ bool InsertShinaHook(int ver )
if (ver >= 50) {
//trigger_fun = StackSearchingTrigger<GetGlyphOutlineA, NULL>;
trigger_fun = [](LPVOID funcAddr, uintptr_t, uintptr_t stack)
trigger_fun = [](LPVOID funcAddr, hook_stack*, auto, uintptr_t stack)
{
bool ret = false;
if (funcAddr != GetGlyphOutlineA && funcAddr != GetTextExtentPoint32A) return false;

View File

@ -128,7 +128,7 @@ int GetSystemAoiVersion() // return result is cached
return ret;
}
bool InsertSystemAoiDynamicHook(LPVOID addr, uintptr_t frame, uintptr_t stack)
bool InsertSystemAoiDynamicHook(LPVOID addr, hook_stack*,uintptr_t frame, uintptr_t stack)
{
int version = GetSystemAoiVersion();
bool utf16 = true;

View File

@ -34,6 +34,26 @@ bool InsertTriangleHook()
bool Triangle::attach_function() {
trigger_fun=[](LPVOID addr, hook_stack* stack,auto,auto){
//Triangle やっぱり妹がすきっ!
if((DWORD)addr!=(DWORD)TextOutA)return false;
if(auto addr=MemDbg::findEnclosingAlignedFunction(stack->retaddr))
{
HookParam hp;
hp.address=addr;
hp.offset=get_stack(4);
hp.split=get_stack(1);
hp.type=USING_STRING|USING_SPLIT;
hp.hook_font=F_TextOutA;
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
//▼
auto s=std::string((char*)data,*len);
return s.find("\x81\xa5")==s.npos;
};
NewHook(hp,"Triangle2_TextOutA");
}
return true;
};
return InsertTriangleHook();
}

View File

@ -1,6 +1,6 @@
#include"Waffle.h"
bool InsertWaffleDynamicHook(LPVOID addr, uintptr_t frame, uintptr_t stack)
bool InsertWaffleDynamicHook(LPVOID addr, hook_stack*, uintptr_t frame, uintptr_t stack)
{
ConsoleOutput("WaffleDynamic:triggered");
if (addr != ::GetTextExtentPoint32A)

View File

@ -197,7 +197,7 @@ void TextHook::Send(uintptr_t lpDataBase)
#ifndef _WIN64
if (auto current_trigger_fun = trigger_fun.exchange(nullptr))
if (!current_trigger_fun(location, stack->ebp, stack->esp)) trigger_fun = current_trigger_fun;
if (!current_trigger_fun(location, stack, stack->ebp, stack->esp)) trigger_fun = current_trigger_fun;
#endif
if(hp.type&HOOK_RETURN){
hp.type&=~HOOK_RETURN;

View File

@ -17,7 +17,7 @@
* @return If success, which is reverted
*/
#ifndef _WIN64
inline std::atomic<bool (*)(LPVOID addr, uintptr_t ebp, uintptr_t esp)> trigger_fun = nullptr;
inline std::atomic<bool (*)(LPVOID addr, hook_stack* stack, uintptr_t ebp, uintptr_t esp)> trigger_fun = nullptr;
#endif
// jichi 9/25/2013: This class will be used by NtMapViewOfSectionfor
// interprocedure communication, where constructor/destructor will NOT work.