2022-09-02 01:27:05 +08:00
|
|
|
#include "dispatch.h"
|
|
|
|
|
|
2022-09-01 16:56:37 +08:00
|
|
|
|
|
|
|
|
#define MAIN_OFFSET(offset) ((void *)((0x8048000) + (offset)))
|
|
|
|
|
#define SUBHOOK_INIT(func, addr) \
|
|
|
|
|
fn##func func = (fn##func)addr; \
|
|
|
|
|
FuncHook h##func
|
|
|
|
|
|
|
|
|
|
#define SUBHOOK_SETUP(func) h##func.Hook((void **)&func, (void *)_##func)
|
|
|
|
|
|
|
|
|
|
class Controller
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SINGLETON_DEFINE_S(Controller);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Controller();
|
2022-09-03 17:30:34 +08:00
|
|
|
~Controller();
|
2022-09-01 16:56:37 +08:00
|
|
|
public:
|
|
|
|
|
void init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2022-09-02 01:27:05 +08:00
|
|
|
|
|
|
|
|
static int hook_IPacketDispatcher_ParamBase_dispatch_template(int a1, int a2, int a3);
|
2022-09-01 16:56:37 +08:00
|
|
|
/**
|
|
|
|
|
* @brief hook修复镶嵌徽章
|
|
|
|
|
* @param pDispatcher_UseJewel
|
|
|
|
|
* @param pUser
|
|
|
|
|
* @param pBuf
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
static int hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* pUser, PacketBuf* pBuf);
|
|
|
|
|
|
2022-09-03 17:30:34 +08:00
|
|
|
//使用蜜蜡
|
|
|
|
|
static int hook_Dispatcher_ModItemAttr_dispatch_sig(Dispatcher_ModItemAttr* dis_mod, CUser* user, PacketBuf* pBuf);
|
|
|
|
|
|
|
|
|
|
|
2022-09-01 16:56:37 +08:00
|
|
|
/**
|
|
|
|
|
* @brief hook收包处理
|
|
|
|
|
* @param a1
|
|
|
|
|
* @param a2
|
|
|
|
|
* @param a3
|
|
|
|
|
* @param a4
|
|
|
|
|
* @param src
|
|
|
|
|
* @param a6
|
|
|
|
|
* @param a7
|
|
|
|
|
* @param a8
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2022-09-02 01:27:05 +08:00
|
|
|
static int hook_PacketDispatcher_doDispatch(PacketDispatcher* a1, CUser* a2, int a3, int packet_id, char* packet_src, int pecakt_len, int a7, int a8);
|
2022-09-01 16:56:37 +08:00
|
|
|
|
2022-09-03 17:30:34 +08:00
|
|
|
|
|
|
|
|
|
2022-09-01 16:56:37 +08:00
|
|
|
private:
|
2022-09-02 01:27:05 +08:00
|
|
|
using IPacketDispatcher_ParamBase_dispatch_template_Type = decltype(hook_IPacketDispatcher_ParamBase_dispatch_template);
|
|
|
|
|
IPacketDispatcher_ParamBase_dispatch_template_Type* old_IPacketDispatcher_ParamBase_dispatch_template;
|
|
|
|
|
|
2022-09-01 16:56:37 +08:00
|
|
|
using UseJewel_dispatch_sig_Type = decltype(hook_UseJewel_dispatch_sig);
|
|
|
|
|
UseJewel_dispatch_sig_Type* old_UseJewel_dispatch_sig;
|
|
|
|
|
|
2022-09-03 17:30:34 +08:00
|
|
|
using Dispatcher_ModItemAttr_dispatch_sig_Type = decltype(hook_Dispatcher_ModItemAttr_dispatch_sig);
|
|
|
|
|
Dispatcher_ModItemAttr_dispatch_sig_Type* old_Dispatcher_ModItemAttr_dispatch_sig;
|
|
|
|
|
|
2022-09-01 16:56:37 +08:00
|
|
|
using PacketDispatcher_doDispatch_Type = decltype(hook_PacketDispatcher_doDispatch);
|
|
|
|
|
PacketDispatcher_doDispatch_Type* old_PacketDispatcher_doDispatch;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2022-09-02 01:27:05 +08:00
|
|
|
FuncHook mhook_IPacketDispatcher_ParamBase_dispatch_template;
|
2022-09-01 16:56:37 +08:00
|
|
|
FuncHook mhook_UseJewel_dispatch_sig;
|
2022-09-03 17:30:34 +08:00
|
|
|
FuncHook mhook_Dispatcher_ModItemAttr_dispatch_sig;
|
2022-09-01 16:56:37 +08:00
|
|
|
FuncHook mhook_PacketDispatcher_doDispatch;
|
|
|
|
|
|
|
|
|
|
};
|