Ejemplo n.º 1
0
    public override void Enable(GameContext ctx)
    {
        int off = GetOffset(ctx, "Terraria.Entity", "position");
        var ass = AssemblySnippet.FromCode(
            new AssemblyCode[] {
            Instruction.Create("pushad"),
            Instruction.Create($"cmp byte ptr [{ctx.MapFullScreen_Address}],0"),
            Instruction.Create("je _rwualfna"),
            Instruction.Create($"cmp byte ptr [{ctx.MouseRight_Address}],0"),
            Instruction.Create("je _rwualfna"),
            Instruction.Create($"cmp byte ptr [{ctx.MouseRightRelease_Address}],0"),
            Instruction.Create("je _rwualfna"),
            AssemblySnippet.FromCode(
                new AssemblyCode[] {
                Instruction.Create($"mov byte ptr [{ctx.MapFullScreen_Address}],0"),
                Instruction.Create($"mov byte ptr [{ctx.MouseRightRelease_Address}],0"),
                AssemblySnippet.FromClrCall(
                    ctx.GameModuleHelper.GetFunctionAddress("Terraria.Main", "get_LocalPlayer"), false, null, null, null, Array.Empty <object>()),
                Instruction.Create("mov ebx,eax"),
                Instruction.Create("push eax"),
                Instruction.Create("mov dword ptr [esp],2"),
                Instruction.Create($"fild dword ptr [{ctx.ScreenWidth_Address}]"),
                Instruction.Create("fild dword ptr [esp]"),
                Instruction.Create("fdivp"),
                Instruction.Create($"fild dword ptr [{ctx.MouseX_Address}]"),
                Instruction.Create("fsubp"),
                Instruction.Create($"fld dword ptr [{ctx.MapFullScreenScale_Address}]"),
                Instruction.Create("fdivp"),
                Instruction.Create($"fld dword ptr [{ctx.MapFullscreenPos_Address + 4}]"),
                Instruction.Create("fsubrp"),
                Instruction.Create("mov dword ptr [esp],16"),
                Instruction.Create("fild dword ptr [esp]"),
                Instruction.Create("fmulp"),
                Instruction.Create($"fstp dword ptr [ebx+{off}]"),
                Instruction.Create("mov dword ptr [esp],2"),
                Instruction.Create($"fild dword ptr [{ctx.ScreenHeight_Address}]"),
                Instruction.Create("fild dword ptr [esp]"),
                Instruction.Create("fdivp"),
                Instruction.Create($"fild dword ptr [{ctx.MouseY_Address}]"),
                Instruction.Create("fsubp"),
                Instruction.Create($"fld dword ptr [{ctx.MapFullScreenScale_Address}]"),
                Instruction.Create("fdivp"),
                Instruction.Create($"fld dword ptr [{ctx.MapFullscreenPos_Address + 8}]"),
                Instruction.Create("fsubrp"),
                Instruction.Create("mov dword ptr [esp],16"),
                Instruction.Create("fild dword ptr [esp]"),
                Instruction.Create("fmulp"),
                Instruction.Create($"fstp dword ptr [ebx+{off + 0x4}]"),

                Instruction.Create("pop eax"),
            }),
            Instruction.Create("_rwualfna:"),
            Instruction.Create("popad")
        });
        HookParameters ps = new HookParameters(ctx.GameModuleHelper.GetFunctionAddress("Terraria.Main", "Update") + 5, 4096);

        InlineHook.Hook(ctx.HContext, ass, ps);
    }
Ejemplo n.º 2
0
    public override void Enable(GameContext ctx)
    {
        nuint a = ctx.GameModuleHelper["Terraria.Player", "GetItemGrabRange"];

        if (Read <byte>(ctx, a) == 0xE9)
        {
            return;
        }
        InlineHook.Hook(ctx.HContext, AssemblySnippet.FromASMCode(
                            "mov eax,1000\nret"),
                        new HookParameters(a, 4096, false, false));
        this.IsEnabled = true;
    }
Ejemplo n.º 3
0
    public override void Enable(GameContext ctx)
    {
        int   offA = GetOffset(ctx, "Terraria.Player", "infoAccMechShowWires");
        int   offB = GetOffset(ctx, "Terraria.Player", "accJarOfSouls");
        nuint a    = Aobscan(
            ctx,
            $"88 96 {AobscanHelper.GetMByteCode(offA)} 88 96 {AobscanHelper.GetMByteCode(offB)}").FirstOrDefault();

        if (a == 0)
        {
            return;
        }
        InlineHook.Hook(ctx.HContext, AssemblySnippet.FromASMCode(
                            $"mov byte ptr [esi+{offA}],0x1"),
                        new HookParameters(a, 4096, false, false));
        this.IsEnabled = true;
    }
Ejemplo n.º 4
0
    public override void Enable(GameContext ctx)
    {
        int   offA = GetOffset(ctx, "Terraria.Player", "moveSpeed");
        int   offB = GetOffset(ctx, "Terraria.Player", "boneArmor");
        nuint a    = Aobscan(
            ctx,
            $"D9 E8 D9 9E {AobscanHelper.GetMByteCode(offA)} 88 96 {AobscanHelper.GetMByteCode(offB)}").FirstOrDefault();

        if (a == 0)
        {
            return;
        }
        InlineHook.Hook(ctx.HContext, AssemblySnippet.FromASMCode(
                            $"mov dword ptr [esi+{offA}],0x41A00000"),
                        new HookParameters(a, 0x1000, false, false));
        this.IsEnabled = true;
    }
Ejemplo n.º 5
0
    public override void Enable(GameContext ctx)
    {
        int   offA = GetOffset(ctx, "Terraria.Player", "slowFall");
        int   offB = GetOffset(ctx, "Terraria.Player", "findTreasure");
        nuint a    = Aobscan(
            ctx,
            $"88 96 {AobscanHelper.GetMByteCode(offA)} 88 96 {AobscanHelper.GetMByteCode(offB)}").FirstOrDefault();

        if (a == 0)
        {
            return;
        }
        InlineHook.Hook(ctx.HContext, AssemblySnippet.FromASMCode(
                            $"mov dword ptr [esi+{offA}],1"),
                        new HookParameters(a, 4096, false, false));
        this.IsEnabled = true;
    }
Ejemplo n.º 6
0
    public override void Enable(GameContext ctx)
    {
        nuint[] a = Aobscan(
            ctx,
            @"C7 ** ** ******** D9 07 D9 45 F0 DF F1 DD D8 7A").ToArray();
        if (!a.Any())
        {
            return;
        }
        InlineHook.Hook(ctx.HContext,
                        AssemblySnippet.FromASMCode(
                            @"mov dword ptr[ebp-0x10],0x3F800000
mov dword ptr[ebp-0x14],0x3F800000
mov dword ptr[ebp-0x18],0x3F800000"
                            ),
                        new HookParameters(a[0] + 7, 0x1000));
        this.IsEnabled = true;
    }
Ejemplo n.º 7
0
    public override void Enable(GameContext ctx)
    {
        nuint a = GetFunctionAddress(ctx, "Terraria.Player", "AddBuff");

        if (Read <byte>(ctx, a) == 0xE9)
        {
            return;
        }
        var player = ctx.MyPlayer;

        InlineHook.Hook(ctx.HContext,
                        AssemblySnippet.FromCode(
                            new AssemblyCode[] {
            (Instruction)$"pushad",
            (Instruction)$"mov ebx,{ctx.Debuff.BaseAddress}",
            (Instruction)$"cmp byte ptr [ebx+edx+8],0",
            (Instruction)$"je end",
            (Instruction)$"popad",
            (Instruction)$"ret 8",
            (Instruction)$"end:",
            (Instruction)$"popad",
        }), new HookParameters(a, 0x1000));
        this.IsEnabled = true;
    }
Ejemplo n.º 8
0
    public override void Enable(GameContext ctx)
    {
        nuint a = AobscanASM(
            ctx,
            @"push 0
push 0
push 0x49
push 1
push 0
push 0
push 0
push 0").FirstOrDefault();

        if (a == 0)
        {
            return;
        }
        a += 2 * 5;
        InlineHook.Hook(ctx.HContext,
                        AssemblySnippet.FromASMCode(
                            "mov dword ptr [esp+8],3332"),
                        new HookParameters(a, 4096, false, false));
        this.IsEnabled = true;
    }