IPB

Welcome Guest ( Log In | Register )

> rcbot_const_mstr_offset needs updating?
JRob
post Aug 26 2015, 12:52 AM
Post #1


Advanced Member
***

Group: Members
Posts: 52
Joined: 30-April 11
Member No.: 1,970



I tried playing around with rcbot again and it keeps crashing at

CTeamControlPointRound *CTeamControlPointMaster:: getCurrentRound ()

CBaseEntity *pent = m_ControlPointRounds[m_iCurrentRoundIndex];

So I took a look at what that was and apparently, CTeamControlPointRound is found through dark hackery and the magic number at rcbot_const_mstr_offset.

Can you update this? Or also tell people how to find these offsets?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topic
Replies
Nightc0re
post Aug 27 2015, 12:14 PM
Post #2


Advanced Member
***

Group: Moderator
Posts: 58
Joined: 10-July 15
From: Austria
Member No.: 2,397



QUOTE(Cheeseh @ Aug 27 2015, 01:39 AM) *
as far as I know there should be no problem with the offset right now

Regarding the offset bug, I was referring to the version 0.98.
I don't have tested the offset behaviour with 0.96 or a newer version than 0.98 smile.gif

QUOTE(Cheeseh @ Aug 27 2015, 01:39 AM) *
then add the offset between the start point and CUtlMap<int, CTeamControlPoint *> m_ControlPoints . which last time was 844
It's probably only moved by 4 bytes or in increments of 4

I usually debug this by running through a debugger -- changing the offset and vieweing the resulting CTeamControlPoint that I made to see if it makes sense, then just keep the offset like that
Don't have much time to explain more -- hope it's enough for now

I was using this little algorithm on the map "cp_dustbowl" to find the offset.

CODE

void CTeamFortress2Mod::updatePointMaster()
{
    if ( m_PointMasterResource.get() == NULL )
    {
        edict_t *pMaster = CClassInterface::FindEntityByClassnameNearest(Vector(0,0,0),"team_control_point_master",65535);

        if ( pMaster )
        {
            extern ConVar rcbot_const_point_master_offset;
            CBaseEntity *pent = pMaster->GetUnknown()->GetBaseEntity();
            unsigned long mempoint = ((unsigned long)pent)+rcbot_const_point_master_offset.GetInt();

            //m_PointMaster = (CTeamControlPointMaster*)mempoint;
            //m_PointMasterResource = pMaster;

            for (int i = 800; i < 900; ++i) {
                unsigned long mempoint = ((unsigned long)pent) + i;

                m_PointMaster = (CTeamControlPointMaster*)mempoint;
                m_PointMasterResource = pMaster;

                int idx = m_PointMaster->m_iCurrentRoundIndex;
                int size = m_PointMaster->m_ControlPointRounds.Size();

                // for cp_dustbowl
                if (idx >= 0 && size == 3) {
                    CBotGlobals::botMessage(NULL, 0, "rcbot_const_point_master_offset: %d", i);
                    break;
                }
            }
        }
    }

    if ( m_PointMaster != NULL )
    {
        m_pCurrentRound =  m_PointMaster->getCurrentRound();
    }
}


Using this method I got an offset of 864 for Linux, and 844 for Windows.
I retrieved this on 15th of July, 2015.

Have a nice day smile.gif
Best regards
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post Aug 27 2015, 01:27 PM
Post #3


Admin
*****

Group: Admin
Posts: 3,056
Joined: 11-September 03
From: uk
Member No.: 1



yep I'm guessing Linux one needs updating. Cheers
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
JRob
post Aug 27 2015, 07:02 PM
Post #4


Advanced Member
***

Group: Members
Posts: 52
Joined: 30-April 11
Member No.: 1,970



QUOTE(Cheeseh @ Aug 27 2015, 01:27 PM) *

yep I'm guessing Linux one needs updating. Cheers


Surely there's an automatic way to find these offsets? Or an easier way to get the data you need from this entity?

It seems horrible that after each update, we have to load up dustbowl and HOPE that nothing else happens early in the structure happens to be 3.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 20th April 2024 - 02:07 AM