Results 1 to 5 of 5
  1. #1
    Helper's Avatar
    Join Date
    Jan 2007
    Gender
    male
    Posts
    114
    Reputation
    10
    Thanks
    3,545

    eastl::deque Reverse Engineered

    EASTL does not come with the deque class by default (at least in the latest release), so it is implemented below:

    Code:
        template< typename T, unsigned int A > class DequeIterator
        {
        public:
            T*                        mpCurrent;                    //0000
            T*                        mpBegin;                    //0004
            T*                        mpEnd;                        //0008
            T**                        mpCurrentArrayPtr;            //000C
    
            DequeIterator<T,A> operator ++ ()
            {
                ++mpCurrent;
    
                if( mpCurrent == mpEnd )
                {
                    ++mpCurrentArrayPtr;
    
                    mpBegin = *mpCurrentArrayPtr;
                    mpEnd = *mpCurrentArrayPtr + A;
                    mpCurrent = mpBegin;
                }
    
                return (*this);
            }
        }; //sizeof() == 0x10
    
        template< typename T, unsigned int A > class DequeBase
        {
        public:
            T**                        mpPtrArray;                    //0000
            int                        mnPtrArraySize;                //0004
            DequeIterator< T, A >    mItBegin;                    //0008
            DequeIterator< T, A >    mItEnd;                        //0018
            unsigned char            pad[4];                        //0028
        }; //sizeof() == 0x2C
    
    
        template< typename T, unsigned int A > class deque : public DequeBase< T, A >
        {
        public:
    
            T* operator [] ( unsigned int n )
            {
                unsigned int m = n + mItBegin.mpCurrent - mItBegin.mpBegin;
                unsigned int i = ( ( signed int )( m + 0x1000000 ) ) / A - ( sizeof( T ) * 0x10000 );
                unsigned int b = m - A * ( ( signed int )( m + 0x1000000 ) ) / A - ( sizeof( T ) * 0x10000 );
    
                return &this->mItBegin.mpCurrentArrayPtr[i][b];
            }
    
            bool empty()
            {
                return this->mItBegin.mpCurrent == this->mItEnd.mpCurrent;
            }
    
            void begin( eastl::DequeIterator< T, A >* result )
            {
                result->mpCurrent = mItBegin.mpCurrent;
                result->mpBegin = mItBegin.mpBegin;
                result->mpEnd = mItBegin.mpEnd;
                result->mpCurrentArrayPtr = mItBegin.mpCurrentArrayPtr;
            }
    
            void end( eastl::DequeIterator< T, A >* result )
            {
                result->mpCurrent = mItEnd.mpCurrent;
                result->mpBegin = mItEnd.mpBegin;
                result->mpEnd = mItEnd.mpEnd;
                result->mpCurrentArrayPtr = mItEnd.mpCurrentArrayPtr;
            }
    
            unsigned int size()
            {
                return 
                    mItEnd.mpCurrent -
                    mItEnd.mpBegin +
                    ( ( mItEnd.mpCurrentArrayPtr - mItBegin.mpCurrentArrayPtr ) << 6 ) +
                    mItBegin.mpEnd -
                    mItBegin.mpCurrent -
                    A;
            }
    
            T* front()
            {
                return mItBegin.mpCurrent;
            }
    
            void clear()
            {
                if( mItBegin.mpCurrentArrayPtr != mItEnd.mpCurrentArrayPtr && mItEnd.mpBegin )
                {
                    delete[] mItEnd.mpBegin;
                }
    
                for( T** i = ( T** )( mItBegin.mpCurrentArrayPtr + 1 );  i < mItEnd.mpCurrentArrayPtr; ++i )
                {
                    if( *i )
                    {
                        delete[] *i;
                    }
                }
    
                mItEnd.mpCurrent = mItBegin.mpCurrent;
                mItEnd.mpBegin = mItBegin.mpBegin;
                mItEnd.mpEnd = mItBegin.mpEnd;
                mItEnd.mpCurrentArrayPtr = mItBegin.mpCurrentArrayPtr;
            }
        }; //sizeof() == 0x2C
    Credits: s0beit

  2. The Following User Says Thank You to Helper For This Useful Post:

    Fogest (10-09-2011)

  3. #2
    bullpop's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    Sweden
    Posts
    3,695
    Reputation
    287
    Thanks
    2,168
    My Mood
    Psychedelic
    what does this code do?
    MPGH Member Since 10/17/2010
    Battlefield Minion Since 01/22/2014 till - 08/27/2014
    APB Minion since 11/12/2011 till 4/16/2012

  4. #3
    -BF3-'s Avatar
    Join Date
    Sep 2011
    Gender
    male
    Location
    Beside that Tank
    Posts
    101
    Reputation
    10
    Thanks
    2
    My Mood
    Tired
    ^ ^ lol xDDD

  5. #4
    Joltz's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Michigan
    Posts
    42
    Reputation
    10
    Thanks
    3
    My Mood
    Amused
    I would wrap it in [code] so there isn't smiley faces in it.

  6. #5
    Helper's Avatar
    Join Date
    Jan 2007
    Gender
    male
    Posts
    114
    Reputation
    10
    Thanks
    3,545
    Quote Originally Posted by Joltz View Post
    I would wrap it in [code] so there isn't smiley faces in it.
    Good idea.

  7. The Following User Says Thank You to Helper For This Useful Post:

    Fogest (10-09-2011)

Similar Threads

  1. [Assembly Tutorial] 40 Reverse Engineering
    By radnomguywfq3 in forum Programming Tutorials
    Replies: 22
    Last Post: 04-19-2016, 08:49 PM
  2. [Help] VIP REVERSE ENGINEERING
    By scar-l in forum CrossFire Hacks & Cheats
    Replies: 7
    Last Post: 03-06-2010, 12:54 PM
  3. "fuk u lol 2"s aimbot - reverse engineered
    By NeverBorn in forum Combat Arms Hacks & Cheats
    Replies: 29
    Last Post: 06-13-2009, 10:26 PM
  4. Replies: 0
    Last Post: 10-18-2008, 07:06 PM
  5. Reverse Engineering!
    By Jeckels in forum WarRock - International Hacks
    Replies: 13
    Last Post: 11-06-2007, 10:45 PM