Wow Game Object VMT Problems menu

Shout-Out

User Tag List

Results 1 to 4 of 4
  1. #1
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wow Game Object VMT Problems

    I have my object manager up and running(well, Apoc's object manager). But anyways, I am having problems calling virtual methods to get, for example, the object's position. I'll attach a picture of my virtual methods that I'm getting from the object. They are correct. I'm calling them fine, but I don't know why I can't seem to get the Position function to work correctly. Is my Vector3 struct wrong?

    Code:
    [StructLayout(LayoutKind.Sequential)]
    private struct vec3
    {
           public float X, Y, Z;
    }
    It seems like the proper structure. To test the structure, I replaced the structure with a pointer to some allocated memory and read the values manually. I'm using a delegate that seems correct:

    Code:
    [UnmanagedFunctionPointer(CallingConvention.ThisCall)]
    private delegate void dGetObjectPosition(IntPtr pThis, IntPtr pLocation);
    Code:
    var _call = GetVMTFunction(BotGlobal.Instance.OffsetMgr["VMT__GetPosition"]);
    dGetObjectPosition callMe =     BotGlobal.Instance.Memory.RegisterDelegate<dGetObjectPosition>(_call);
    var ptr = Marshal.AllocHGlobal(12);
    callMe(BaseAddress, ptr);
    byte[] bts = BotGlobal.Instance.Memory.ReadBytes(ptr, 12);
    var ret = new Vector3(BitConverter.ToSingle(bts, 0), BitConverter.ToSingle(bts, 4), BitConverter.ToSingle(bts, 8));
    Marshal.FreeHGlobal(ptr);
    return ret;
    This is a listing of the virtual functions gathered from the local player object.

    VMT List

    My code to get the virtual function address is correct, as shows the picture I'm attaching. I feel like my error must lie in my vector structure or something. I always get a strange value for my location such as (0.0, 0.0, 0.999), which is nonsense. I'm using VMT index 11 and 12 for my testing.

    Any help?
    Last edited by lanman92; 06-12-2011 at 10:12 PM.

    Wow Game Object VMT Problems
  2. #2
    Aftiagouras's Avatar Member
    Reputation
    2
    Join Date
    Mar 2008
    Posts
    22
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can always declare your delegate like that:
    Code:
    [UnmanagedFunctionPointer(CallingConvention.ThisCall)]
    private delegate void dGetObjectPosition(IntPtr pThis, out vec3 pLocation);
    So you dont have to allocate memory and all that.
    And btw the address of that function is wowbase+0x1817B0.

  3. #3
    Jens's Avatar Contributor
    Reputation
    179
    Join Date
    Sep 2006
    Posts
    251
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Utilities
    Code:
            public IntPtr GetVMTFunction(IntPtr baseAddress, uint methodIndex)
            {
                return Read<IntPtr>(baseAddress, new IntPtr(methodIndex * 4));
            }
    
            public T RegisterDelegate<T>(IntPtr address) where T : class
            {
                return Marshal.GetDelegateForFunctionPointer(address, typeof(T)) as T;
            }
    Points
    Code:
        [StructLayout(LayoutKind.Sequential)]
        public struct WowPoint
        {
            public float X;
            public float Y;
            public float Z;
        }
    
        Point3D
    The function
    Code:
            [UnmanagedFunctionPointer(CallingConvention.ThisCall)]
            private delegate int GetPositionDelegate(IntPtr instance, out WowPoint position);
    
            private GetPositionDelegate _getPositionHandler;
    How to use it
    Code:
            public Point3D Position
            {
                get
                {
                    if (this._getPositionHandler == null)
                    {
                        this._getPositionHandler = AdvantageBase.Memory.RegisterDelegate<GetPositionDelegate>(AdvantageBase.Memory.GetVMTFunction(this, Addresses.VMTIndex.GetPosition));
                    }
    
                    WowPoint p;
                    this._getPositionHandler(this, out p);
    
                    return new Point3D(p.X, p.Y, p.Z);
                }
            }
    That is the way I am doing it.
    And if it hasn't changed (which i doubt it has) GetPosition is at index 12 in the object VMT.

    I remember i had some trouble with WowPoints as well, that is why i prefer to cast them to my own points, and make wrappers for all the functions that need WowPoints.
    Last edited by Jens; 06-13-2011 at 02:26 AM.

  4. #4
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To verify that my function call wasn't wrong, I read the offsets that the function would read if I called it. I'm getting retarded values. I must be overlooking something in my object manager, because the problem isn't in my code calling the virtual function. I'm getting a position that only has a Z value, and it changes when I rotate. I think I just found my problem. My code to load offsets from an xml file was reading in hex format, but I was writing my vmt offsets as decimal.... D'oh.

    Awesome. Well, thanks for the help anyway.
    Last edited by lanman92; 06-13-2011 at 12:29 PM.

Similar Threads

  1. [Two Questions] How do I make game objects + Repack problem
    By dude891 in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 04-01-2008, 08:51 AM
  2. WTS 1x WoW game CD Key
    By Battlemidge in forum Members Only Accounts And CD Keys Buy Sell
    Replies: 0
    Last Post: 02-05-2007, 05:46 PM
  3. WoW Game Stats
    By Solance in forum Community Chat
    Replies: 0
    Last Post: 11-30-2006, 02:12 AM
  4. WoW Game Card Generator?
    By Örpheus in forum World of Warcraft General
    Replies: 21
    Last Post: 11-05-2006, 12:45 AM
All times are GMT -5. The time now is 10:00 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search