update lcemp networking

This commit is contained in:
2026-08-14 07:02:50 +03:00
parent 125819419f
commit 6853eab85f
51 changed files with 629 additions and 183 deletions
@@ -233,6 +233,8 @@ void CPlatformNetworkManagerStub::DoWork()
BYTE disconnectedSmallId;
while (NetworkSocketLayer::PopDisconnectedSmallId(&disconnectedSmallId))
{
if (disconnectedSmallId == 0) continue;
if (NetworkSocketLayer::IsSmallIdConnected(disconnectedSmallId)) continue;
IQNetPlayer *qnetPlayer = m_pIQNet->GetPlayerBySmallId(disconnectedSmallId);
if (qnetPlayer != NULL && qnetPlayer->m_smallId == disconnectedSmallId)
{
@@ -248,6 +250,16 @@ void CPlatformNetworkManagerStub::DoWork()
}
}
BYTE joinedSmallId;
while (NetworkSocketLayer::PopPendingJoinSmallId(&joinedSmallId))
{
IQNetPlayer *qnetPlayer = m_pIQNet->GetPlayerBySmallId(joinedSmallId);
if (qnetPlayer != NULL && qnetPlayer->m_smallId == joinedSmallId)
{
NotifyPlayerJoined(qnetPlayer);
}
}
for (int i = 1; i < MINECRAFT_NET_MAX_PLAYERS; i++)
{
IQNetPlayer *qp = &IQNet::m_player[i];
@@ -294,12 +306,27 @@ int CPlatformNetworkManagerStub::GetLocalPlayerMask(int playerIndex)
bool CPlatformNetworkManagerStub::AddLocalPlayerByUserIndex( int userIndex )
{
if (m_pIQNet->AddLocalPlayerByUserIndex(userIndex) != S_OK) return false;
NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(userIndex));
return ( m_pIQNet->AddLocalPlayerByUserIndex(userIndex) == S_OK );
return true;
}
bool CPlatformNetworkManagerStub::RemoveLocalPlayerByUserIndex( int userIndex )
{
if (userIndex > 0 && userIndex < XUSER_MAX_COUNT)
{
IQNetPlayer *qnetPlayer = m_pIQNet->GetLocalPlayerByUserIndex(userIndex);
if (qnetPlayer != NULL)
{
NotifyPlayerLeaving(qnetPlayer);
qnetPlayer->m_isRemote = true;
qnetPlayer->m_isHostPlayer = false;
qnetPlayer->m_gamertag[0] = 0;
qnetPlayer->SetCustomDataValue(0);
if (IQNet::s_playerCount > 1)
IQNet::s_playerCount--;
}
}
return true;
}
@@ -376,7 +403,11 @@ void CPlatformNetworkManagerStub::HostGame(int localUsersMask, bool bOnlineGame,
IQNet::m_player[0].m_smallId = 0;
IQNet::m_player[0].m_isRemote = false;
IQNet::m_player[0].m_isHostPlayer = true;
#ifdef _WINDOWS64
extern wchar_t g_Win64UsernameW[17];
wcscpy_s(IQNet::m_player[0].m_gamertag, 32, g_Win64UsernameW);
IQNet::s_playerCount = 1;
#endif
if (getNetworkPlayer(&IQNet::m_player[0]) == NULL)
NotifyPlayerJoined(&IQNet::m_player[0]);
@@ -854,6 +885,7 @@ bool CPlatformNetworkManagerStub::GetGameSessionInfo(int iPad, SessionID session
return true;
}
}
return false;
}
void CPlatformNetworkManagerStub::SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam )