public override void Enable()
 {
     Config             = LoadConfig <Configs>() ?? PluginConfig.ChatTweaks.DisableChatAutoscroll ?? new Configs();
     scrollToBottomHook = Common.Hook <ScrollToBottomDelegate>("E8 ?? ?? ?? ?? 48 85 FF 75 0D", ScrollToBottomDetour);
     scrollToBottomHook?.Enable();
     base.Enable();
 }
    public static HookWrapper <T> Hook <T>(void *address, T detour) where T : Delegate
    {
        var h  = new Hook <T>(new IntPtr(address), detour);
        var wh = new HookWrapper <T>(h);

        HookList.Add(wh);
        return(wh);
    }
    public static HookWrapper <T> Hook <T>(string signature, T detour, int addressOffset = 0) where T : Delegate
    {
        var addr = Scanner.ScanText(signature);
        var h    = new Hook <T>(addr + addressOffset, detour);
        var wh   = new HookWrapper <T>(h);

        HookList.Add(wh);
        return(wh);
    }
Example #4
0
        public void Hooking()
        {
            GetAddress();
            DXGISwapChain_PresentHookPrimitive = new HookWrapper <DXGISwapChain_PresentDelegate>(
                _dxgiSwapChainVTblAddresses[(int)DXGISwapChainVTbl.Present], new DXGISwapChain_PresentDelegate(Present), this);

            DXGIdeviceContext_DrawIndexedPrimitive = new HookWrapper <DXGIdeviceContext_DrawIndexedDelegate>(
                _pContextVTablAddresses[(int)D3D11DeviceCONTEXTVTbl.DrawIndexed], new DXGIdeviceContext_DrawIndexedDelegate(DrawIndexed), this);
        }
Example #5
0
        public void Hooking()
        {
            var address = GetAddress();

            hookDrawIndexedPrimitive = new HookWrapper <DrawIndexedPrimitiveDelegate>(
                address[82], new DrawIndexedPrimitiveDelegate(DrawIndexedPrimitiveHook), this);

            hookPresent = new HookWrapper <PresentDelegate>(
                address[17], new PresentDelegate(PresentHook), this);
        }
Example #6
0
        public static HookWrapper <T> Hook <T>(IntPtr addr, T detour, bool enable = true) where T : Delegate
        {
            var h  = new Hook <T>(addr, detour);
            var wh = new HookWrapper <T>(h);

            if (enable)
            {
                wh.Enable();
            }
            HookList.Add(wh);
            return(wh);
        }
Example #7
0
        public static HookWrapper <T> Hook <T>(string signature, T detour, bool enable = true) where T : Delegate
        {
            var addr = Common.Scanner.ScanText(signature);
            var h    = new Hook <T>(addr, detour);
            var wh   = new HookWrapper <T>(h);

            if (enable)
            {
                wh.Enable();
            }
            HookList.Add(wh);
            return(wh);
        }
    public static HookWrapper <AddonOnUpdate> HookAfterAddonUpdate(IntPtr address, NoReturnAddonOnUpdate after)
    {
        Hook <AddonOnUpdate> hook = null;

        hook = new Hook <AddonOnUpdate>(address, (atkUnitBase, nums, strings) => {
            var retVal = hook.Original(atkUnitBase, nums, strings);
            try {
                after(atkUnitBase, nums, strings);
            } catch (Exception ex) {
                SimpleLog.Error(ex);
                hook.Disable();
            }
            return(retVal);
        });
        var wh = new HookWrapper <AddonOnUpdate>(hook);

        return(wh);
    }
Example #9
0
        public void Hooking()
        {
            var address = GetProcAddress();

            hookPresent = new HookWrapper<PresentDelegate>(
                address[140], new PresentDelegate(PresentHook), this);
            
            hookDrawInstanced = new HookWrapper<DrawInstancedDelegate>(
                address[84], new DrawInstancedDelegate(DrawInstancedHook), this);
            
            hookDrawIndexedInstanced = new HookWrapper<DrawIndexedInstancedDelegate>(
                address[85], new DrawIndexedInstancedDelegate(DrawIndexedInstancedHook), this);
            
            hookExecuteCommandLists = new HookWrapper<ExecuteCommandListsDelegate>(
                address[54], new ExecuteCommandListsDelegate(ExecuteCommandListsHook), this);
            
            hookSignalDelegate = new HookWrapper<SignalDelegate>(
                address[58], new SignalDelegate(SignalHook), this);
        }
Example #10
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            this.PluginInterface = pluginInterface;

            Client = new ClientInterface(pluginInterface.TargetModuleScanner, pluginInterface.Data); //
            UiHelper.Setup(pluginInterface.TargetModuleScanner);
            Common = new Common(pluginInterface);

            PluginInterface.UiBuilder.OnBuildUi     += this.BuildUI;
            PluginInterface.Framework.OnUpdateEvent += FrameworkOnUpdate;

            var addr = Common.Scanner.ScanText("48 85 C9 74 24 8B 81 ?? ?? ?? ?? A8 01 75 15 F3 0F 10 41 ?? 0F 2E C1 7A 02 74 09 83 C8 01 89 81 ?? ?? ?? ?? F3 0F 11 49 48 C3 ");

            addr = IntPtr.Add(addr, 0x5);
            resetMemberPositionHook = Common.Hook <ResetMemberPositionDelegate>(addr, ResetMemberPositionDetour);

            changeMemberWidthHook = Common.Hook <ChangeMemberWidthDelegate>("48 89 5C 24 ?? 56 48 83 EC 30 48 89 7C 24 ?? 41 8B F0 48 63 FA 4C 8D 44 24 ?? ", ChangeMemberWidthDetour);
            resetChocotimeHook    = Common.Hook <ResetChocoPositionDelegate>("0F BF C2 66 0F 6E C8 8B 81 ?? ?? ?? ?? 0F 5B C9 A8 01 75 15 F3 0F 10 41 ?? 0F 2E C1 7A 02 74 09 83 C8 01 89 81 ?? ?? ?? ?? F3 0F 11 49 48 C3", ResetChocoTimeDetour);

            SetupCommands();
        }
Example #11
0
 public override void Enable()
 {
     scrollToBottomHook = Common.Hook <ScrollToBottomDelegate>("E8 ?? ?? ?? ?? 48 85 FF 75 0D", ScrollToBottomDetour);
     base.Enable();
 }