/*
文件名:HackerClass.nut
路径:Dps_A/BaseClass/HackerClass/HackerClass.nut
创建日期:2024-09-22	11:33
文件用途:黑客类
*/
class _Hacker {
    HookTable = null;

    constructor() {
        HookTable = {};
    }

    function UnLoadHook(AddressStr) {
        Sq_DeHookFunc(HookTable[AddressStr]);
    }

    function LoadHook(AddressStr, ArgumentArr, EnterFunc, LeaveFunc) {
        //如果已经HOOK过 需要先卸载原来的HOOK
        if (HookTable.rawin(AddressStr)) {
            UnLoadHook(AddressStr);
            print("地址: " + AddressStr + " 已经装载了Hook,本次操作将会卸载之前的Hook在执行。")
        }

        local Controler = Sq_HookFunc(S_Ptr(AddressStr), ArgumentArr, EnterFunc, LeaveFunc);
        HookTable.rawset(AddressStr, Controler);
    }
}
//初始化Hacker
Haker <- _Hacker();