[C#][3.3.5][BlackMagic] [Help] How to read result bytes of TraceLine? menu

User Tag List

Results 1 to 2 of 2
  1. #1
    Borg333's Avatar Member Authenticator enabled
    Reputation
    2
    Join Date
    Dec 2013
    Posts
    22
    Thanks G/R
    5/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C#][3.3.5][BlackMagic] [Help] How to read result bytes of TraceLine?

    Hello Ownedcore!

    I have some problem with getting asm execute result of getting TraceLine, the code seems to be correct but i have error on reading result:

    Code:
    public static bool TraceLine(Vector3 start, Vector3 end, uint flags)
            {
                uint tracelineCodecave = BlackMagic.AllocateMemory(40);
                try
                {
                    Console.WriteLine("start: " + start);
                    Console.WriteLine("end: " + end);
                    Console.WriteLine("flags: " + flags);
    
                    IntPtr distancePointer = (IntPtr)tracelineCodecave;
                    IntPtr startPointer = IntPtr.Add(distancePointer, 0x4);
                    IntPtr endPointer = IntPtr.Add(startPointer, 0xC);
                    IntPtr resultPointer = IntPtr.Add(endPointer, 0xC);
    
                    Console.WriteLine("distancePointer: " + distancePointer);
                    Console.WriteLine("startPointer: " + startPointer);
                    Console.WriteLine("endPointer: " + endPointer);
                    Console.WriteLine("resultPointer: " + resultPointer);
                    {
                        string[] asm = new string[]
                        {
                                "PUSH 0",
                                $"PUSH {flags}",
                                $"PUSH {distancePointer}",
                                $"PUSH {resultPointer}",
                                $"PUSH {endPointer}",
                                $"PUSH {startPointer}",
                                $"CALL {World.TraceLine}",
                                "ADD ESP, 0x18",
                                "RETN",
                        };
                        byte[] returnBytes = Hook.InjectAndExecute(asm, true, out bool suc);
                        bool ret = BlackMagic.ReadInt((uint)resultPointer) > 0;
                        Console.WriteLine("InjectAndExecute suc: " + suc);
                        Console.WriteLine("ret: " + ret);
                        Console.WriteLine("returnBytes: " + returnBytes);
                        return ret;
                    }
                }
                finally
                {
                    BlackMagic.FreeMemory(tracelineCodecave);
                }
                return false;
            }

    Code:
    Vector3 start = new Vector3(pX, pY, pZ);
    Vector3 end = new Vector3(kX, kY, kZ);
    
    Func.TraceLine(start, end, 0x00100171);
    From console:
    Code:
    start: <-9086,989* 354,253* 93,28503>
    end: <-9101,831* 349,9462* 93,14945>
    flags: 1048945
    distancePointer: 367853568
    startPointer: 367853572
    endPointer: 367853584
    resultPointer: 367853596
    returnAdress:367591424
    dwAddress:28672
    Tried to fixed it but without success. I would appreciate any hint.

    These ads disappear when you log in.

  2. #2
    Borg333's Avatar Member Authenticator enabled
    Reputation
    2
    Join Date
    Dec 2013
    Posts
    22
    Thanks G/R
    5/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fixed, added before string[] asm
    Code:
    (float, Vector3, Vector3) tledited= (1.0f, start, end);
    and
    Code:
    Write(distancePointer, tledited);
    if we have something differently of 28672, thats target is out of LoS

  3. Thanks Hazzbazzy (1 members gave Thanks to Borg333 for this useful post)

Similar Threads

  1. Replies: 2
    Last Post: 10-20-2020, 10:38 AM
  2. [Help]How to get current hitpoints of my role with no error
    By AGPS in forum Diablo 3 Memory Editing
    Replies: 2
    Last Post: 09-28-2012, 11:52 AM
  3. [Help]how to get the buff of mount(bird or dragon..) ?
    By j121780im in forum WoW Memory Editing
    Replies: 10
    Last Post: 03-02-2009, 09:03 AM
  4. [help]How to geth few parts of db
    By Respawn in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 03-28-2008, 07:29 PM
  5. Plz help: How to change character list layout?????/
    By srpskagarda in forum World of Warcraft General
    Replies: 3
    Last Post: 03-08-2007, 07:09 PM
All times are GMT -5. The time now is 03:48 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2022 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2022 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search