diff options
Diffstat (limited to 'Minecraft.Client/Common/Network/GameNetworkManager.cpp')
| -rw-r--r-- | Minecraft.Client/Common/Network/GameNetworkManager.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Common/Network/GameNetworkManager.cpp index 92ea8ad0..88db4911 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/GameNetworkManager.cpp @@ -41,6 +41,11 @@ #include "..\Minecraft.World\DurangoStats.h" #endif +#ifdef _WINDOWS64 +#include "..\..\Windows64\Network\WinsockNetLayer.h" +#include "..\..\Windows64\Windows64_Xuid.h" +#endif + // Global instance CGameNetworkManager g_NetworkManager; CPlatformNetworkManager *CGameNetworkManager::s_pPlatformNetworkManager; @@ -1501,6 +1506,45 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc } else { +#ifdef _WINDOWS64 + // Non-host split-screen: open a dedicated TCP connection for this pad + if (localPlayer && !g_NetworkManager.IsHost() && g_NetworkManager.IsInGameplay()) + { + int padIdx = pNetworkPlayer->GetUserIndex(); + BYTE assignedSmallId = 0; + + if (!WinsockNetLayer::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); + + // Network socket (not hostLocal) — data goes through TCP via GetLocalSocket + socket = new Socket(pNetworkPlayer, false, false); + pNetworkPlayer->SetSocket(socket); + + ClientConnection* connection = new ClientConnection(pMinecraft, socket, padIdx); + if (connection->createdOk) + { + connection->send(shared_ptr<PreLoginPacket>(new PreLoginPacket(pNetworkPlayer->GetOnlineName()))); + pMinecraft->addPendingLocalConnection(padIdx, connection); + } + else + { + pMinecraft->connectionDisconnected(padIdx, DisconnectPacket::eDisconnect_ConnectionCreationFailed); + delete connection; + } + return; + } +#endif + socket = new Socket( pNetworkPlayer, g_NetworkManager.IsHost(), g_NetworkManager.IsHost() && localPlayer ); pNetworkPlayer->SetSocket( socket ); |
