replace WinsockNetLayer with PlatformNetworkManagerWindows, implement external server stats

This commit is contained in:
DrPerkyLegit committed 2026-11-24 19:24:01 -05:00
1 parent 62b92d5c0b
commit f434aae3af
42 files changed
+2621 -3406

No files matched your search

@@ -42,7 +42,8 @@
#endif
#ifdef _WINDOWS64
#include "../../Windows64/Network/WinsockNetLayer.h"
#include "../../Windows64/Network/PlatformNetworkManagerWindows.h"
#include "../../Windows64/Network/NetworkPlayerWindows.h"
#include "../../Windows64/Windows64_Xuid.h"
#endif
@@ -79,6 +80,8 @@ void CGameNetworkManager::Initialise()
s_pPlatformNetworkManager = new CPlatformNetworkManagerSony();
#elif defined _DURANGO
s_pPlatformNetworkManager = new CPlatformNetworkManagerDurango();
#elif defined _WINDOWS64
s_pPlatformNetworkManager = new CPlatformNetworkManagerWindows();
#else
s_pPlatformNetworkManager = new CPlatformNetworkManagerStub();
#endif
@@ -808,7 +811,6 @@ void CGameNetworkManager::CancelJoinGame(LPVOID lpParam)
s_pPlatformNetworkManager->CancelJoinGame();
#endif
#ifdef _WINDOWS64
WinsockNetLayer::CancelJoinGame();
#endif
}
@@ -1577,18 +1579,20 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
int padIdx = pNetworkPlayer->GetUserIndex();
BYTE assignedSmallId = 0;
if (!WinsockNetLayer::JoinSplitScreen(padIdx, &assignedSmallId))
CPlatformNetworkManagerWindows* windowsNetworkManager = dynamic_cast<CPlatformNetworkManagerWindows*>(s_pPlatformNetworkManager);
if (windowsNetworkManager == nullptr || !windowsNetworkManager->JoinSplitScreen(padIdx, &assignedSmallId))
{
app.DebugPrintf("Split-screen pad %d: failed to open TCP to host\n", padIdx);
pMinecraft->connectionDisconnected(padIdx, DisconnectPacket::eDisconnect_ConnectionCreationFailed);
return;
}
// Update the local IQNetPlayer (at pad index) with the host-assigned smallId.
// The NetworkPlayerXbox created by NotifyPlayerJoined already points to
// m_player[padIdx], so we just set the smallId for network routing.
IQNet::m_player[padIdx].m_smallId = assignedSmallId;
IQNet::m_player[padIdx].m_resolvedXuid = Win64Xuid::DeriveXuidForPad(Win64Xuid::ResolvePersistentXuid(), padIdx);
NetworkPlayerWindows* windowsPlayer = dynamic_cast<NetworkPlayerWindows*>(pNetworkPlayer);
if (windowsPlayer != nullptr)
{
windowsPlayer->SetSmallId(assignedSmallId);
windowsPlayer->SetUID(Win64Xuid::DeriveXuidForPad(Win64Xuid::ResolvePersistentXuid(), padIdx));
}
// Network socket (not hostLocal) — data goes through TCP via GetLocalSocket
socket = new Socket(pNetworkPlayer, false, false);
@@ -2173,9 +2177,9 @@ int CGameNetworkManager::GetJoiningReadyPercentage()
}
#ifndef _XBOX
void CGameNetworkManager::FakeLocalPlayerJoined()
void CGameNetworkManager::FakeLocalPlayerJoined(bool fakeHost)
{
s_pPlatformNetworkManager->FakeLocalPlayerJoined();
s_pPlatformNetworkManager->FakeLocalPlayerJoined(fakeHost);
}
#endif