S4 Player Ids Names etc.

07/10/2016 22:22 Decrypted#1
Before it rots on my harddrive.
Code:
#define S4DefaultCharLen 16
struct SCharName
{
    char m_acData[S4DefaultCharLen];
    uint32_t m_iLen;
    char* getName()
    {
        if (m_iLen < S4DefaultCharLen )
        {
            return (char*)&m_acData[0];
        }
        else
        {
            return *(char**)&m_acData[0];
        }
    }
};
class CPlayer
{
    public:
        char        m_acUnk1[72];
        uint32_t    m_iPlayerID;
        uint32_t    m_iSessionID;
        SCharName   m_oName;
};

class CPlayerHolder
{
    public:
        CPlayer* getPlayer(uint32_t i_iPlayerID)
        {
            if (!i_iPlayerID)
                return nullptr;

            auto vcall = (CPlayer*(__thiscall*)(CPlayerHolder* i_pThisPtr, uint32_t i_iPlayerID, uint32_t iii))(g_iS4Base + 0x759070);
            return vcall(this, i_iPlayerID, 0);
        }
        char* getPlayerName(uint32_t i_iPlayerID)
        {
            if (!i_iPlayerID)
                return nullptr;

            auto vcall = (CPlayer*(__thiscall*)(CPlayerHolder* i_pThisPtr, uint32_t i_iPlayerID, uint32_t iii))(g_iS4Base + 0x759070);
            CPlayer* a_pPlayer = vcall(this, i_iPlayerID, 0);

            return a_pPlayer->m_oName.getName();
        }
};
Code:
class CTeamManager
{
    public:
        enum ERoomTeam : uint8_t
        {
            ETeamNeutral = 0,
            ETeamAlpha = 1,
            ETeamBeta = 2
        };
    public:
        uint32_t getTeamPlayerAmount(ERoomTeam i_bTeam)
        {
            auto vcall = (uint32_t(__thiscall*)(CTeamManager* i_pThisPtr, uint32_t i_iTeam))(g_iS4Base + 0xCF3110);
            return vcall(this, i_bTeam);
        }
        uint32_t getPlayerID(ERoomTeam i_bTeam, uint32_t i_iIndex)
        {
            struct SRet
            {
                uint32_t m_iPlayerID;
                uint32_t res2;
            };
    
            auto vcall = (SRet(__thiscall*)(CTeamManager* i_pThisPtr, uint32_t i_iTeam, uint32_t i_iIndex))(g_iS4Base + 0xCF32D0);
            return vcall(this, i_bTeam, i_iIndex).m_iPlayerID;
        }
};
Code:
class CRoom
{
    public:
        uint8_t       m_acUnknownData1[0x10];
        CTeamManager* m_pTeamManager;
};
Code:
class CGame
{
    public:
        uint8_t       m_acUnknownData1[0x0000012C];
        CRoom*        m_pRoom;
};
07/10/2016 22:36 gοd#2
gj, well done.
07/10/2016 23:14 RingleRangleRob#3
Ah the good old stuff which got used by kick vote system ( and more ofc. )..

Code:
s4client.exe+4C97E0 - push ebp
But why you use CGameManager->CRoom and not CGameManager->CTeamManager->CTeam .. and then the vector like Ant.'s open source

Edit : class CPlayer != CActor ?? :confused:
07/11/2016 02:17 Decrypted#4
Quote:
Originally Posted by Sycode' View Post
Ah the good old stuff which got used by kick vote system ( and more ofc. )..

Code:
s4client.exe+4C97E0 - push ebp
But why you use CGameManager->CRoom and not CGameManager->CTeamManager->CTeam .. and then the vector like Ant.'s open source

Edit : class CPlayer != CActor ?? :confused:
Didnīt noticed that ant already released it ^^
Edit:
As far as i can see there are some differences between the Actor class and Player class.
07/11/2016 07:42 ▒ Ant.#5
This is complete cancer code. I've already published this and much more, you're using excess addresses for functions that you don't even need. Also, SCharName, are you kidding me? You've never heard of std::string?

Quote:
Originally Posted by Decrypted View Post
Get on my reversing and c++ style ;)
This is hardly C++ worthy, please don't quote me and claim you know what you're doing with this garbage.


OnTopic: There is no such thing as "CPlayer", merely CActor. Perhaps you're looking at another derivation of the IActor class which is why you notice "differences."

#TeachByFlame