[WoW][3.2.0] Better Object Managment menu

User Tag List

Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 44
  1. #16
    flo8464's Avatar Active Member
    Reputation
    30
    Join Date
    Apr 2009
    Posts
    434
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a question: Is it really faster to check every object if it is still valid and check for every new object if it is not in the current list instead of just wiping the complete list and assign everything EnumObjects has to offer?
    Hey, it compiles! Ship it!

    [WoW][3.2.0] Better Object Managment
  2. #17
    zzgw's Avatar Member
    Reputation
    6
    Join Date
    Mar 2008
    Posts
    31
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by flo8464 View Post
    Just a question: Is it really faster to check every object if it is still valid and check for every new object if it is not in the current list instead of just wiping the complete list and assign everything EnumObjects has to offer?
    That depends on how much data you pull from each object with option 2). You might be better off with the n^2 iterations for 1) since the n is usually very small (<100) instead of n iterations for 2) but allocating a bunch of memory every step.
    Option 1) also makes persistance of references over frames easier, while with 2) you would probably need an additional lookup into a guid table in a bunch of places.
    In the end you should go with what you prefer though, since this part is probably not going to be a bottleneck.

  3. #18
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The reason I use the IsValid (and also invalidate -> revalidate each object) is so you can persist a single object instance through multiple frames. Obviously; once the object is created, it's memory location won't change (so that can quite possibly be optimized), however, I tend to keep a reference to an object for minutes/hours at a time. (Eg; a reference to a nearby NPC I'm following, etc.) It saves having the GC fighting with my bot to clean up the resources from constant new WoWObject() calls.

    Also; IsValid allows you to do quite a bit more. Such as; if (me.CurrentTarget.IsValid) instead of if (me.CurrentTarget != null). It's a personal thing; but I've found coding with the IsValid check is far 'cleaner' and avoids a lot of workaround that a null check would. (Not to mention, you completely avoid any possible nullrefs )

  4. #19
    flo8464's Avatar Active Member
    Reputation
    30
    Join Date
    Apr 2009
    Posts
    434
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but allocating a bunch of memory every step.
    Not really sure, but I think its possible to clear a std::vector without freeing the memory. At least with some other container formats it's possible. That would reduce allocations by a lot.

    Edit: Oh, didn't see your answer, Apoc. Thanks for clarification.
    Last edited by flo8464; 11-14-2009 at 05:04 PM.
    Hey, it compiles! Ship it!

  5. #20
    swayenvoy's Avatar Member
    Reputation
    1
    Join Date
    Jul 2008
    Posts
    19
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    nice post about getting objects, just got a question.
    I've updated the addresses to 3.2.2 with a pattern:

    Code:
    <Pattern desc="EnumVisibleObjects" pattern="\x55\x8B\xEC\xA1\x04\x11\x34\x01\x64\x8B\x0D\x2C\x00\x00\x00\x53\x56\x8B\x34\x81\x8B\x86\x08\x00\x00\x00\x05\xA8\x00\x00\x00\x8B\x40\x04\xA8\x01\x57\x75\x04" mask="xxxx????xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
    <Pattern desc="ClntObjMgrObjectPtr" pattern="\x55\x8B\xEC\x64\x8B\x0D\x2C\x00\x00\x00\xA1\x04\x11\x34\x01\x8B\x14\x81\x8B\x8A\x08\x00\x00\x00\x83\xEC\x08\x85\xC9\x74\x2D" mask="xxxxxxxxxxx????xxxxxxxxxxxxxxxx" />
    <Pattern desc="ClntObjMgrGetActivePlayer" pattern="\x64\x8B\x0D\x2C\x00\x00\x00\xA1\x04\x11\x34\x01\x8B\x14\x81\x8B\x8A\x08\x00\x00\x00\x85\xC9\x75\x05" mask="xxxxxxxx????xxxxxxxxxxxxx" />
    the result seems to be ok, the real addresses i get are:

    EnumVisibleObjects -> 004778D0
    ClntObjMgrGetActivePlayer -> 00476580
    ClntObjMgrObjectPtr -> 00477B50

    but whenever I make a call to EnumVisibleObjects i get an System.AccessViolationException with the "Message Attempted to read or write protected memory. This is often an indication that other memory is corrupt." I've tried several callbacks with no change. Anyone has an idea what to look for?

    best regards sway

  6. #21
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by swayenvoy View Post
    Hi,

    nice post about getting objects, just got a question.
    I've updated the addresses to 3.2.2 with a pattern:

    Code:
    <Pattern desc="EnumVisibleObjects" pattern="\x55\x8B\xEC\xA1\x04\x11\x34\x01\x64\x8B\x0D\x2C\x00\x00\x00\x53\x56\x8B\x34\x81\x8B\x86\x08\x00\x00\x00\x05\xA8\x00\x00\x00\x8B\x40\x04\xA8\x01\x57\x75\x04" mask="xxxx????xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
    <Pattern desc="ClntObjMgrObjectPtr" pattern="\x55\x8B\xEC\x64\x8B\x0D\x2C\x00\x00\x00\xA1\x04\x11\x34\x01\x8B\x14\x81\x8B\x8A\x08\x00\x00\x00\x83\xEC\x08\x85\xC9\x74\x2D" mask="xxxxxxxxxxx????xxxxxxxxxxxxxxxx" />
    <Pattern desc="ClntObjMgrGetActivePlayer" pattern="\x64\x8B\x0D\x2C\x00\x00\x00\xA1\x04\x11\x34\x01\x8B\x14\x81\x8B\x8A\x08\x00\x00\x00\x85\xC9\x75\x05" mask="xxxxxxxx????xxxxxxxxxxxxx" />
    the result seems to be ok, the real addresses i get are:

    EnumVisibleObjects -> 004778D0
    ClntObjMgrGetActivePlayer -> 00476580
    ClntObjMgrObjectPtr -> 00477B50

    but whenever I make a call to EnumVisibleObjects i get an System.AccessViolationException with the "Message Attempted to read or write protected memory. This is often an indication that other memory is corrupt." I've tried several callbacks with no change. Anyone has an idea what to look for?

    best regards sway
    Are we expected to hack your computer in order to look at your code? Or just debug it telepathically?

  7. #22
    swayenvoy's Avatar Member
    Reputation
    1
    Join Date
    Jul 2008
    Posts
    19
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Surly not Cypher

    Code:
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
            private delegate int EnumVisibleObjectsDelegate(IntPtr callback, int filter);
            /// <summary>
            /// Acts as the callback from WoW. This function will be called for each object
            /// during the enumeration. A GUID will be passed back that you can then use in the
            /// ClntObjMgrGetObjectPtr function to get the actual pointer.
            /// </summary>
            /// <param name="guid">A GUID to use.</param>
            /// <param name="filter">A filter for the object type.</param>
            /// <returns>
            /// Returns 0 when the enumeration should be stopped or
            /// 1 when the enumeration should continue.
            /// </returns>
            /// <remarks>
            /// If no objects are left to enumerate, the function will no longer be called.
            /// </remarks>
            [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
            private delegate int EnumObjectsCallbackDelegate(ulong guid, int filter);
            /// <summary>
            /// Returns a pointer to an object based on GUID, IntPtr.Zero if no object exists.
            /// </summary>
            /// <param name="guid">The GUID of the object.</param>
            /// <param name="filter">A filter for the object type.</param>
            /// <returns>An pointer to the actual object.</returns>
            /// <remarks>
            /// This function works from the object descriptor GUID (OBJECT_FIELD_GUID).
            /// Not the typical obj+0x32 GUID.
            /// </remarks>
            [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
            private delegate IntPtr ClntObjMgrGetObjectPtrDelegate(ulong guid, int filter);
            /// <summary>
            /// Retrives the GUID of the active player which can then be passed 
            /// to the ClntObjMgrGetObjectPtr function.
            /// </summary>
            /// <returns>The GUID of the active player.</returns>
            [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
            private delegate ulong ClntObjMgrGetActivePlayerDelegate();
    
            private readonly EnumObjectsCallbackDelegate _Callback;
            private readonly IntPtr _CallbackPtr;
            private readonly ClntObjMgrGetObjectPtrDelegate ClntObjMgrGetObjectPtrWow;
            private readonly ClntObjMgrGetActivePlayerDelegate ClntObjMgrGetActivePlayerWow;
            private readonly EnumVisibleObjectsDelegate EnumObjects;
            private readonly Dictionary<ulong, WowObject> _RealObjects = new Dictionary<ulong, WowObject>();
            private ulong _frameCounter = 1;
            public WowObject Me
            {
                get
                {
                    return _RealObjects[_PlayerGuid];
                }
            }
            private ulong _PlayerGuid = 0;
    
            public ObjectManager(Wow wow, TequilaSunrise.Core.TequilaSunrise sun)
            {
                _Sunrise = sun;
                _Wow = wow;
                
    
                _Callback = ObjectManager.EnumObjectsCallbackTest;
                _CallbackPtr = Marshal.GetFunctionPointerForDelegate(_Callback);
    
                _Sunrise.PatternManager.LoadFile(new FileInfo(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ObjectMgrPatterns.xml")), (uint)Process.GetCurrentProcess().Modules[0].BaseAddress, (uint)Process.GetCurrentProcess().Modules[0].ModuleMemorySize);
    
                ClntObjMgrGetActivePlayerWow = _Sunrise.MemoryManager.RegisterDelegate<ClntObjMgrGetActivePlayerDelegate>(_Sunrise.PatternManager["ClntObjMgrGetActivePlayer"]);
                ClntObjMgrGetObjectPtrWow = _Sunrise.MemoryManager.RegisterDelegate<ClntObjMgrGetObjectPtrDelegate>(_Sunrise.PatternManager["ClntObjMgrObjectPtr"]);
                EnumObjects = _Sunrise.MemoryManager.RegisterDelegate<EnumVisibleObjectsDelegate>(_Sunrise.PatternManager["EnumVisibleObjects"]);
    
                _Wow.Pulse += _Wow_Pulse;
            }
    
            private static int EnumObjectsCallbackTest(ulong guid, int filter)
            {
                return 1;
            }
    
            private int EnumObjectsCallbackHandler(ulong guid, int filter)
            {
                IntPtr objPtr = GetPtrByGuid(guid);
    
                if (!_RealObjects.ContainsKey(guid))
                {
                    WowObject tmp = new WowObject(objPtr);
    
                    switch (tmp.Type)
                    {
                        case Enums.WowObjectType.AllTypes:
    
                            break;
                        case Enums.WowObjectType.Object:
    
                            break;
                        case Enums.WowObjectType.Item:
    
                            break;
                        case Enums.WowObjectType.Container:
    
                            break;
                        case Enums.WowObjectType.Unit:
    
                            break;
                        case Enums.WowObjectType.Player:
    
                            break;
                        case Enums.WowObjectType.GameObject:
    
                            break;
                        case Enums.WowObjectType.DynamicObject:
    
                            break;
                        case Enums.WowObjectType.Corpse:
    
                            break;
                        case Enums.WowObjectType.AiGroup:
    
                            break;
                        case Enums.WowObjectType.AreaTrigger:
    
                            break;
                    }
    
                    _RealObjects.Add(guid, tmp);
                }
                else if (_RealObjects[guid] != objPtr)
                {
                    _RealObjects[guid].UpdateObjectPointer(objPtr);
                }
                return 1;
            }
    
            private void _Wow_Pulse(Microsoft.DirectX.Direct3D.Device DirectXDevice)
            {
                if (_PlayerGuid == 0)
                    _PlayerGuid = ClntObjMgrGetActivePlayerWow();
    
                foreach (WowObject value in _RealObjects.Values)
                {
                    value.UpdateObjectPointer(IntPtr.Zero);
                }
    
                EnumObjects(_CallbackPtr, 0); //here it gets ****ed up
    
                if (_frameCounter++ % 10 == 0)
                    RemoveInvalidEntries();
    
                OnPropertyChanged(new PropertyChangedEventArgs("Me"));
                OnCollectionChanged(new System.Collections.Specialized.NotifyCollectionChangedEventArgs(System.Collections.Specialized.NotifyCollectionChangedAction.Reset));
            }
    
            private void OnCollectionChanged(NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
            {
                //if (CollectionChanged != null)
                    //CollectionChanged(this, notifyCollectionChangedEventArgs);
            }
    
            private void OnPropertyChanged(PropertyChangedEventArgs propertyChangedEventArgs)
            {
                //if (PropertyChanged != null)
                    //PropertyChanged(this, propertyChangedEventArgs);
            }
    Delicios Copy & Pasta incoming

    Edit: I've found the Problem the CallbackDelegate is causing the Problem. Changed from: private delegate int EnumObjectsCallbackDelegate(ulong guid, int filter); to private delegate int EnumObjectsCallbackDelegate(int lowGuid, int hightGuid, int filter); and everything works now
    Last edited by swayenvoy; 11-21-2009 at 06:12 AM.

  8. #23
    Xarg0's Avatar Member
    Reputation
    61
    Join Date
    Jan 2008
    Posts
    389
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    doesn't that framecounter overflow if you don't resett it at some point or does the clr take care of that for you?
    I hacked 127.0.0.1

  9. #24
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Xarg0 View Post
    doesn't that framecounter overflow if you don't resett it at some point or does the clr take care of that for you?
    After 18,446,744,073,709,551,615 frames it will throw an overflow exception.
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  10. #25
    Xarg0's Avatar Member
    Reputation
    61
    Join Date
    Jan 2008
    Posts
    389
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Robske View Post
    After 18,446,744,073,709,551,615 frames it will throw an overflow exception.
    sounds like a serious bug to me, so you'd better resett that counter @18,446,744,073,709,551,610
    I hacked 127.0.0.1

  11. #26
    flo8464's Avatar Active Member
    Reputation
    30
    Join Date
    Apr 2009
    Posts
    434
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Btw, anyone ever tried storing objects in a database?

    Im trying SQLite at the moment, with a database kept completly in memory.

    Things like
    Code:
    GameObject fishingBobber = queryObject("SELECT * FROM objectlist WHERE displayId=" + FISHINGBOBBER_DID + " AND createdBy=" + Player.guid());
    (Pseudocode) seem more comfortable than implementing new list iterations for everything you have to look for.
    Hey, it compiles! Ship it!

  12. #27
    swayenvoy's Avatar Member
    Reputation
    1
    Join Date
    Jul 2008
    Posts
    19
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    At the moment i'm just playing around with the riped of code from apoc and do a little testing, and yes framecount will overflow^^

  13. #28
    flo8464's Avatar Active Member
    Reputation
    30
    Join Date
    Apr 2009
    Posts
    434
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by swayenvoy View Post
    At the moment i'm just playing around with the riped of code from apoc and do a little testing, and yes framecount will overflow^^
    After a few million years running with 50 fps.
    Hey, it compiles! Ship it!

  14. #29
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by flo8464 View Post
    Btw, anyone ever tried storing objects in a database?

    Im trying SQLite at the moment, with a database kept completly in memory.

    Things like
    Code:
    GameObject fishingBobber = queryObject("SELECT * FROM objectlist WHERE displayId=" + FISHINGBOBBER_DID + " AND createdBy=" + Player.guid());
    (Pseudocode) seem more comfortable than implementing new list iterations for everything you have to look for.

    If only .NET had such a feature They could call it Language INtegrated Query! That sure would be revolutionairy!

    It might even look something like this

    Code:
    var Bobber = (from foo in ObjectManager
                  where foo.DisplayId == FishingBobberId && foo.CreatedBy == Player.Guid
                  select foo).FirstOrDefault();
    LINQ
    Last edited by Robske; 11-21-2009 at 09:13 AM.
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  15. #30
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Robske View Post
    After 18,446,744,073,709,551,615 frames it will throw an overflow exception.
    ITS OVER NINE THOUSAND!!!!111oneoneone

    Originally Posted by Robske View Post

    If only .NET had such a feature They could call it Language INtegrated Query! That sure would be revolutionairy!

    It might even look something like this

    Code:
    var Bobber = (from foo in ObjectManager
                  where foo.DisplayId == FishingBobberId && foo.CreatedBy == Player.Guid
                  select foo).FirstOrDefault();
    LINQ
    C# and LINQ is the work of Satan.

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. [Source] WPF Wow Object manager
    By !@^^@! in forum WoW Memory Editing
    Replies: 11
    Last Post: 01-26-2010, 04:13 PM
  2. Object Manager
    By Shamun in forum WoW Memory Editing
    Replies: 11
    Last Post: 11-28-2008, 02:06 PM
  3. WoW Object Manager ?
    By discorly in forum WoW ME Questions and Requests
    Replies: 4
    Last Post: 07-28-2007, 06:34 PM
All times are GMT -5. The time now is 06:35 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