diff --git a/Minecraft.Client/Common/UI/UIScene_FriendMenu.cpp b/Minecraft.Client/Common/UI/UIScene_FriendMenu.cpp index c0505e9a..82851c12 100644 --- a/Minecraft.Client/Common/UI/UIScene_FriendMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FriendMenu.cpp @@ -134,6 +134,7 @@ void UIScene_FriendMenu::startJoin(bool skipBlockedCheck) #ifdef _WINDOWS64 m_joinSession.data.hostIP[0] = 0; m_joinSession.data.hostPort = 0; + m_joinSession.isFriendGame = true; wcsncpy_s(m_joinSession.data.hostName, XUSER_NAME_SIZE, m_data.name.c_str(), _TRUNCATE); m_joinSession.data.playerCount = static_cast(game != nullptr ? game->playerCount : 1); m_joinSession.data.maxPlayers = static_cast(game != nullptr ? game->maxPlayers : 8); diff --git a/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.cpp b/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.cpp index b0db7e84..83f0a598 100644 --- a/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.cpp +++ b/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.cpp @@ -391,7 +391,7 @@ bool Win64_GetJoinAddress(std::string& host, int& port) { } int CPlatformNetworkManagerWindows::GetHostedPort() const { - return (m_isHost && !m_isLeaving && m_listenSocket != INVALID_SOCKET) ? static_cast(m_gamePort) : 0; + return (m_isHost && m_isOnlineHost && !m_isLeaving && m_listenSocket != INVALID_SOCKET) ? static_cast(m_gamePort) : 0; } bool CPlatformNetworkManagerWindows::GetJoinAddress(std::string& host, int& port) const { @@ -421,6 +421,7 @@ static bool ResolveFriendSession(FriendSessionInfo* session) { bool CPlatformNetworkManagerWindows::Initialise(CGameNetworkManager* pGameNetworkManager, int flagIndexSize) { s_windowsNetworkManager = this; m_joinPort = 0; + m_isOnlineHost = false; m_gameNetworkManager = pGameNetworkManager; m_flagIndexSize = flagIndexSize; @@ -865,6 +866,7 @@ bool CPlatformNetworkManagerWindows::IsAddingPlayer() { return false; } void CPlatformNetworkManagerWindows::HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots, unsigned char privateSlots) { SetLocalGame(true); + m_isOnlineHost = bOnlineGame && !g_Win64DedicatedServer; SetPrivateGame(bIsPrivate); m_isLeaving = false; diff --git a/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.h b/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.h index d09a5291..153daf5d 100644 --- a/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.h +++ b/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.h @@ -104,6 +104,7 @@ private: SOCKET m_listenSocket; std::string m_joinHost; int m_joinPort; + bool m_isOnlineHost; SOCKET m_discoverySocket; unsigned short m_gamePort; sockaddr_in m_hostAddress; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 8f977a96..278758b9 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -392,7 +392,7 @@ static void Win64_TickOnlinePresence() Win64_ToUtf8(iconPath.c_str())); } - bool hosting = !g_Win64DedicatedServer && g_NetworkManager.IsHost() && !g_NetworkManager.IsLocalGame() && + bool hosting = !g_Win64DedicatedServer && g_NetworkManager.IsHost() && g_NetworkManager.IsInGameplay() && Win64_GetHostedGamePort() > 0 && SocialOnlineService::IsLinked() && !MinecraftServer::serverHalted();