Fix party serverlist player count.

This commit is contained in:
momo5502 2016-01-02 20:30:19 +01:00
parent 1c0b9f6aa1
commit da5ad6fc61
4 changed files with 36 additions and 4 deletions

View File

@ -179,8 +179,9 @@ namespace Components
{
int clientCount = 0;
int maxclientCount = *Game::svs_numclients;
if (!maxclientCount) maxclientCount = Dvar::Var("sv_maxclients").Get<int>();
if (maxclientCount)
{
for (int i = 0; i < maxclientCount; i++)
{
if (Game::svs_clients[i].state >= 3)
@ -188,6 +189,13 @@ namespace Components
clientCount++;
}
}
}
else
{
//maxclientCount = Dvar::Var("sv_maxclients").Get<int>();
maxclientCount = Game::Party_GetMaxPlayers(*Game::partyIngame);
clientCount = Game::PartyHost_CountMembers((Game::PartyData_s*)0x1081C00);
}
// Ensure line break
data.append("\n");

View File

@ -79,6 +79,8 @@ namespace Game
PC_ReadTokenHandle_t PC_ReadTokenHandle = (PC_ReadTokenHandle_t)0x4D2060;
PC_SourceError_t PC_SourceError = (PC_SourceError_t)0x467A00;
Party_GetMaxPlayers_t Party_GetMaxPlayers = (Party_GetMaxPlayers_t)0x4F5D60;
PartyHost_CountMembers_t PartyHost_CountMembers = (PartyHost_CountMembers_t)0x497330;
PartyHost_GetMemberAddressBySlot_t PartyHost_GetMemberAddressBySlot = (PartyHost_GetMemberAddressBySlot_t)0x44E100;
Script_Alloc_t Script_Alloc = (Script_Alloc_t)0x422E70;
@ -120,6 +122,8 @@ namespace Game
XBlock** g_streamBlocks = (XBlock**)0x16E554C;
bool* g_lobbyCreateInProgress = (bool*)0x66C9BC2;
party_t** partyIngame = (party_t**)0x1081C00;
PartyData_s** partyData = (PartyData_s**)0x107E500;
void* ReallocateAssetPool(XAssetType type, unsigned int newSize)
{

View File

@ -178,6 +178,12 @@ namespace Game
typedef void(__cdecl * PC_SourceError_t)(int, const char*, ...);
extern PC_SourceError_t PC_SourceError;
typedef int(__cdecl * Party_GetMaxPlayers_t)(party_s* party);
extern Party_GetMaxPlayers_t Party_GetMaxPlayers;
typedef int(__cdecl * PartyHost_CountMembers_t)(PartyData_s* party);
extern PartyHost_CountMembers_t PartyHost_CountMembers;
typedef netadr_t *(__cdecl * PartyHost_GetMemberAddressBySlot_t)(int unk, void *party, const int slot);
extern PartyHost_GetMemberAddressBySlot_t PartyHost_GetMemberAddressBySlot;
@ -232,6 +238,8 @@ namespace Game
extern XBlock** g_streamBlocks;
extern bool* g_lobbyCreateInProgress;
extern party_t** partyIngame;
extern PartyData_s** partyData;
void* ReallocateAssetPool(XAssetType type, unsigned int newSize);
void Menu_FreeItemMemory(Game::itemDef_t* item);

View File

@ -943,4 +943,16 @@ namespace Game
char gameType[12];
char uiName[32];
};
typedef struct party_s
{
BYTE pad1[544];
int privateSlots;
int publicSlots;
} party_t;
typedef struct PartyData_s
{
DWORD unk;
} PartyData_t;
}