diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Common/Network/GameNetworkManager.cpp index 490d0e0d..5b94e250 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/GameNetworkManager.cpp @@ -66,7 +66,7 @@ void CGameNetworkManager::Initialise() ServerStoppedCreate( false ); ServerReadyCreate( false ); int flagIndexSize = LevelRenderer::getGlobalChunkCount() / (Level::maxBuildHeight / 16); // dividing here by number of renderer chunks in one column -#ifdef _XBOX +#if !defined(_DISABLE_XBLIVE) && defined _XBOX s_pPlatformNetworkManager = new CPlatformNetworkManagerXbox(); #elif !defined(DISABLE_PSN) && defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ s_pPlatformNetworkManager = new CPlatformNetworkManagerSony(); diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.h b/Minecraft.Client/Common/Network/GameNetworkManager.h index 0e85c59c..91fb6bf6 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.h +++ b/Minecraft.Client/Common/Network/GameNetworkManager.h @@ -1,10 +1,12 @@ #pragma once using namespace std; #include +#ifndef _DISABLE_XBLIVE #include +#endif #include "..\..\..\Minecraft.World\C4JThread.h" #include "NetworkPlayerInterface.h" -#ifdef _XBOX +#if defined _XBOX && !defined _DISABLE_XBLIVE #include "..\..\Xbox\Network\PlatformNetworkManagerXbox.h" #elif !defined DISABLE_PSN && defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ #include "..\..\Common\Network\Sony\PlatformNetworkManagerSony.h" @@ -30,7 +32,7 @@ const int NON_QNET_SENDDATA_ACK_REQUIRED = 1; class CGameNetworkManager { -#ifdef _XBOX +#if defined _XBOX && !defined _DISABLE_XBLIVE friend class CPlatformNetworkManagerXbox; #elif !defined DISABLE_PSN && defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ friend class CPlatformNetworkManagerSony; diff --git a/Minecraft.Client/Common/Network/IQNet.h b/Minecraft.Client/Common/Network/IQNet.h new file mode 100644 index 00000000..d5e3de7d --- /dev/null +++ b/Minecraft.Client/Common/Network/IQNet.h @@ -0,0 +1,94 @@ + +#pragma once + +const int QNET_GETSENDQUEUESIZE_SECONDARY_TYPE = 0; +const int QNET_GETSENDQUEUESIZE_MESSAGES = 0; +const int QNET_GETSENDQUEUESIZE_BYTES = 0; + +const int QNET_SENDDATA_LOW_PRIORITY = 0; +const int QNET_SENDDATA_SECONDARY = 0; + +const int QNET_SENDDATA_RELIABLE = 0; +const int QNET_SENDDATA_SEQUENTIAL = 0; + +#define QNET_E_SESSION_FULL 0 +#define QNET_USER_MASK_USER0 1 +#define QNET_USER_MASK_USER1 2 +#define QNET_USER_MASK_USER2 4 +#define QNET_USER_MASK_USER3 8 + +typedef enum _QNET_STATE +{ + QNET_STATE_IDLE, + QNET_STATE_SESSION_HOSTING, + QNET_STATE_SESSION_JOINING, + QNET_STATE_GAME_LOBBY, + QNET_STATE_SESSION_REGISTERING, + QNET_STATE_SESSION_STARTING, + QNET_STATE_GAME_PLAY, + QNET_STATE_SESSION_ENDING, + QNET_STATE_SESSION_LEAVING, + QNET_STATE_SESSION_DELETING +} QNET_STATE, * PQNET_STATE; + +class IQNetPlayer +{ +public: + BYTE GetSmallId(); + void SendData(IQNetPlayer *player, const void *pvData, DWORD dwDataSize, DWORD dwFlags); + bool IsSameSystem(IQNetPlayer *player); + DWORD GetSendQueueSize( IQNetPlayer *player, DWORD dwFlags ); + DWORD GetCurrentRtt(); + bool IsHost(); + bool IsGuest(); + bool IsLocal(); + PlayerUID GetXuid(); + LPCWSTR GetGamertag(); + int GetSessionIndex(); + bool IsTalking(); + bool IsMutedByLocalUser(DWORD dwUserIndex); + bool HasVoice(); + bool HasCamera(); + int GetUserIndex(); + void SetCustomDataValue(ULONG_PTR ulpCustomDataValue); + ULONG_PTR GetCustomDataValue(); + + BYTE m_smallId; + bool m_isRemote; + bool m_isHostPlayer; + wchar_t m_gamertag[32]; +private: + ULONG_PTR m_customData; +}; + +void Win64_SetupRemoteQNetPlayer(IQNetPlayer *player, BYTE smallId, bool isHost, bool isLocal); + +class IQNetCallbacks +{ +}; + +class IQNetGameSearch +{ +}; + +class IQNet +{ +public: + HRESULT AddLocalPlayerByUserIndex(DWORD dwUserIndex); + IQNetPlayer *GetHostPlayer(); + IQNetPlayer *GetLocalPlayerByUserIndex(DWORD dwUserIndex); + IQNetPlayer *GetPlayerByIndex(DWORD dwPlayerIndex); + IQNetPlayer *GetPlayerBySmallId(BYTE SmallId); + IQNetPlayer *GetPlayerByXuid(PlayerUID xuid); + DWORD GetPlayerCount(); + QNET_STATE GetState(); + bool IsHost(); + HRESULT JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO *pInviteInfo); + void HostGame(); + void ClientJoinGame(); + void EndGame(); + + static IQNetPlayer m_player[MINECRAFT_NET_MAX_PLAYERS]; + static DWORD s_playerCount; + static bool s_isHosting; +}; \ No newline at end of file diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h b/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h index d14e5fbf..97cbcabf 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h @@ -1,7 +1,11 @@ #pragma once using namespace std; #include +#ifndef _DISABLE_XBLIVE #include +#else +#include "IQNet.h" +#endif #include "..\..\..\Minecraft.World\C4JThread.h" #include "NetworkPlayerInterface.h" #include "SessionInfo.h" diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 21b26b7c..9ced020a 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -5,7 +5,7 @@ #include "..\..\Xbox\Network\NetworkPlayerXbox.h" // TODO - stub version of this? #include "..\..\Minecraft.h" #include "..\..\User.h" -#if defined _WINDOWS64 || defined __PS3__ +#if defined _WINDOWS64 || defined __PS3__ || defined _XBOX #include "..\..\Common\Network\WinsockNetLayer.h" #endif diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h index 10215a01..1cfce001 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h @@ -23,11 +23,7 @@ public: virtual bool RemoveLocalPlayerByUserIndex( int userIndex ); virtual INetworkPlayer *GetLocalPlayerByUserIndex( int userIndex ); virtual INetworkPlayer *GetPlayerByIndex(int playerIndex); -#ifdef __PS3 - virtual INetworkPlayer * GetPlayerByXuid(PlayerUID* xuid) -#else virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid); -#endif virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId); virtual bool ShouldMessageForFullSession(); diff --git a/Minecraft.Client/Common/Network/SessionInfo.h b/Minecraft.Client/Common/Network/SessionInfo.h index d029973d..9d32245c 100644 --- a/Minecraft.Client/Common/Network/SessionInfo.h +++ b/Minecraft.Client/Common/Network/SessionInfo.h @@ -6,7 +6,7 @@ // A struct that we store in the QoS data when we are hosting the session. Max size 1020 bytes. -#ifdef _XBOX +#if defined _XBOX && !defined _DISABLE_XBLIVE typedef struct _GameSessionData { unsigned short netVersion; // 2 bytes diff --git a/Minecraft.Client/Common/Network/WinsockNetLayer.cpp b/Minecraft.Client/Common/Network/WinsockNetLayer.cpp index 42d5859a..9b75a8df 100644 --- a/Minecraft.Client/Common/Network/WinsockNetLayer.cpp +++ b/Minecraft.Client/Common/Network/WinsockNetLayer.cpp @@ -4,7 +4,7 @@ #include "..\..\Common\Network\PlatformNetworkManagerStub.h" #include "..\..\..\Minecraft.World\Socket.h" -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX SOCKET WinsockNetLayer::s_listenSocket = INVALID_SOCKET; SOCKET WinsockNetLayer::s_hostConnectionSocket = INVALID_SOCKET; SOCKET WinsockNetLayer::s_advertiseSock = INVALID_SOCKET; @@ -61,7 +61,7 @@ char g_Win64MultiplayerIP[256] = "127.0.0.1"; bool WinsockNetLayer::Initialize() { if (s_initialized) return true; -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX WSADATA wsaData; int result = WSAStartup(MAKEWORD(2, 2), &wsaData); if (result != 0) @@ -106,7 +106,7 @@ void WinsockNetLayer::Shutdown() s_active = false; s_connected = false; -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (s_listenSocket != INVALID_SOCKET) { closesocket(s_listenSocket); @@ -137,7 +137,7 @@ void WinsockNetLayer::Shutdown() for (size_t i = 0; i < s_connections.size(); i++) { s_connections[i].active = false; -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (s_connections[i].tcpSocket != INVALID_SOCKET) #elif defined __PS3__ if (s_connections[i].tcpSocket >= 0) @@ -219,6 +219,18 @@ bool WinsockNetLayer::HostGame(int port) freeaddrinfo(result); return false; } +#elif defined _XBOX + struct sockaddr_in addr = {}; + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = htonl(INADDR_ANY); + addr.sin_port = htons((WORD)port); + + s_listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (s_listenSocket == INVALID_SOCKET) + { + app.DebugPrintf("socket() failed: %d\n", WSAGetLastError()); + return false; + } #elif defined __PS3__ struct sockaddr_in addr = {}; addr.sin_family = AF_INET; @@ -247,6 +259,24 @@ bool WinsockNetLayer::HostGame(int port) return false; } + iResult = listen(s_listenSocket, SOMAXCONN); + if (iResult == SOCKET_ERROR) + { + app.DebugPrintf("listen() failed: %d\n", WSAGetLastError()); + closesocket(s_listenSocket); + s_listenSocket = INVALID_SOCKET; + return false; + } +#elif defined _XBOX + iResult = ::bind(s_listenSocket, (struct sockaddr*)&addr, sizeof(addr)); + if (iResult == SOCKET_ERROR) + { + app.DebugPrintf("bind() failed: %d\n", WSAGetLastError()); + closesocket(s_listenSocket); + s_listenSocket = INVALID_SOCKET; + return false; + } + iResult = listen(s_listenSocket, SOMAXCONN); if (iResult == SOCKET_ERROR) { @@ -330,6 +360,51 @@ bool WinsockNetLayer::JoinGame(const char *ip, int port) s_hostConnectionSocket = INVALID_SOCKET; return false; } +#elif defined _XBOX + XNDNS *pDns = NULL; + int iResult = XNetDnsLookup(ip, NULL, &pDns); + if (iResult != 0 || pDns == NULL) + { + app.DebugPrintf("XNetDnsLookup failed for %s - %d\n", ip, iResult); + return false; + } + + while (pDns->iStatus == WSAEINPROGRESS) + { + Sleep(10); + } + + if (pDns->iStatus != 0 || pDns->cina == 0) + { + app.DebugPrintf("pDns->iStatus failed for %s - %d\n", ip, iResult); + XNetDnsRelease(pDns); + return false; + } + + struct sockaddr_in addr = {}; + addr.sin_family = AF_INET; + addr.sin_port = htons((WORD)port); + addr.sin_addr = pDns->aina[0]; + XNetDnsRelease(pDns); + + s_hostConnectionSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (s_hostConnectionSocket == INVALID_SOCKET) + { + app.DebugPrintf("socket() failed: %d\n", WSAGetLastError()); + return false; + } + + int noDelay = 1; + setsockopt(s_hostConnectionSocket, IPPROTO_TCP, TCP_NODELAY, (const char *)&noDelay, sizeof(noDelay)); + + iResult = connect(s_hostConnectionSocket, (struct sockaddr*)&addr, sizeof(addr)); + if (iResult == SOCKET_ERROR) + { + app.DebugPrintf("connect() to %s:%d failed: %d\n", ip, port, WSAGetLastError()); + closesocket(s_hostConnectionSocket); + s_hostConnectionSocket = INVALID_SOCKET; + return false; + } #elif defined __PS3__ struct sockaddr_in addr = {}; @@ -388,7 +463,7 @@ bool WinsockNetLayer::JoinGame(const char *ip, int port) bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void *data, int dataSize) { -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (sock == INVALID_SOCKET || dataSize <= 0) return false; #elif defined __PS3__ if (sock < 0 || dataSize <= 0) return false; @@ -407,7 +482,7 @@ bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void *data, int dataSize) while (totalSent < toSend) { int sent = send(sock, (const char *)header + totalSent, toSend - totalSent, 0); -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (sent == SOCKET_ERROR || sent == 0) #elif defined __PS3__ if (sent < 0 || sent == 0) @@ -424,7 +499,7 @@ bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void *data, int dataSize) { int sent = send(sock, (const char *)data + totalSent, dataSize - totalSent, 0); -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (sent == SOCKET_ERROR || sent == 0) #elif defined __PS3__ if (sent < 0 || sent == 0) @@ -447,7 +522,7 @@ bool WinsockNetLayer::SendToSmallId(BYTE targetSmallId, const void *data, int da if (s_isHost) { SOCKET sock = GetSocketForSmallId(targetSmallId); -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (sock == INVALID_SOCKET) return false; #elif defined __PS3__ if (sock < 0) return false; @@ -473,7 +548,7 @@ SOCKET WinsockNetLayer::GetSocketForSmallId(BYTE smallId) } } LeaveCriticalSection(&s_connectionsLock); -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX return INVALID_SOCKET; #elif defined __PS3__ return -1; @@ -518,7 +593,7 @@ int WinsockNetLayer::AcceptThreadProc(LPVOID param) while (s_active) { SOCKET clientSocket = accept(s_listenSocket, NULL, NULL); -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (clientSocket == INVALID_SOCKET) { if (s_active) @@ -698,7 +773,7 @@ int WinsockNetLayer::ClientRecvThreadProc(LPVOID param) { BYTE *recvBuf = new BYTE[WIN64_NET_RECV_BUFFER_SIZE]; -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX while (s_active && s_hostConnectionSocket != INVALID_SOCKET) #elif defined __PS3__ while (s_active && s_hostConnectionSocket >= 0) @@ -755,7 +830,7 @@ bool WinsockNetLayer::StartAdvertising(int gamePort, const wchar_t *hostName, un LeaveCriticalSection(&s_advertiseLock); s_advertiseSock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (s_advertiseSock == INVALID_SOCKET) { app.DebugPrintf("Win64 LAN: Failed to create advertise socket: %d\n", WSAGetLastError()); @@ -842,7 +917,7 @@ int WinsockNetLayer::AdvertiseThreadProc(LPVOID param) int sent = sendto(s_advertiseSock, (const char *)&data, sizeof(data), 0, (struct sockaddr *)&broadcastAddr, sizeof(broadcastAddr)); -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (sent == SOCKET_ERROR && s_advertising) { app.DebugPrintf("Win64 LAN: Broadcast sendto failed: %d\n", WSAGetLastError()); @@ -866,7 +941,7 @@ bool WinsockNetLayer::StartDiscovery() if (!s_initialized) return false; s_discoverySock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (s_discoverySock == INVALID_SOCKET) { app.DebugPrintf("Win64 LAN: Failed to create discovery socket: %d\n", WSAGetLastError()); @@ -892,7 +967,7 @@ bool WinsockNetLayer::StartDiscovery() bindAddr.sin_port = htons(WIN64_LAN_DISCOVERY_PORT); bindAddr.sin_addr.s_addr = INADDR_ANY; -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (::bind(s_discoverySock, (struct sockaddr *)&bindAddr, sizeof(bindAddr)) == SOCKET_ERROR) { app.DebugPrintf("Win64 LAN: Discovery bind failed: %d\n", WSAGetLastError()); @@ -924,7 +999,7 @@ void WinsockNetLayer::StopDiscovery() { s_discovering = false; -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (s_discoverySock != INVALID_SOCKET) { closesocket(s_discoverySock); @@ -967,7 +1042,7 @@ int WinsockNetLayer::DiscoveryThreadProc(LPVOID param) while (s_discovering) { struct sockaddr_in senderAddr; -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX int senderLen = sizeof(senderAddr); #elif defined __PS3__ socklen_t senderLen = sizeof(senderAddr); @@ -1003,7 +1078,14 @@ int WinsockNetLayer::DiscoveryThreadProc(LPVOID param) continue; char senderIP[64]; +#if defined _XBOX + unsigned char *ipBytes = (unsigned char *)&senderAddr.sin_addr; + sprintf_s(senderIP, sizeof(senderIP), "%d.%d.%d.%d", + ipBytes[0], ipBytes[1], ipBytes[2], ipBytes[3]); + +#else inet_ntop(AF_INET, &senderAddr.sin_addr, senderIP, sizeof(senderIP)); +#endif DWORD now = GetTickCount(); diff --git a/Minecraft.Client/Common/Network/WinsockNetLayer.h b/Minecraft.Client/Common/Network/WinsockNetLayer.h index 45704a35..4ed26bc1 100644 --- a/Minecraft.Client/Common/Network/WinsockNetLayer.h +++ b/Minecraft.Client/Common/Network/WinsockNetLayer.h @@ -3,6 +3,9 @@ #if defined _WINDOWS64 #include #include +#elif defined _XBOX +#include +#include #elif defined __PS3__ #include #include diff --git a/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp b/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp index 30c0f1b0..03c325a8 100644 --- a/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp @@ -1105,6 +1105,7 @@ void CScene_Leaderboards::CopyLeaderboardEntry(PXUSER_STATS_ROW statsRow, Leader } //Is the player +#ifndef _DISABLE_XBLIVE if( statsRow->xuid == ((XboxLeaderboardManager*)LeaderboardManager::Instance())->GetMyXUID() ) { leaderboardEntry->m_bPlayer = true; @@ -1143,6 +1144,7 @@ void CScene_Leaderboards::CopyLeaderboardEntry(PXUSER_STATS_ROW statsRow, Leader } } } +#endif } void CScene_Leaderboards::SetLeaderboardHeader() diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp index bbfa243b..1d59730a 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp @@ -37,6 +37,7 @@ HRESULT CScene_MultiGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled // 4J-PB - don't delete this - it's part of the joinload structure //delete initData; +#ifndef _DISABLE_XBLIVE for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { if( m_selectedSession->data.players[i] != NULL ) @@ -59,6 +60,7 @@ HRESULT CScene_MultiGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled break; } } +#endif unsigned int uiGameHostSettings = m_selectedSession->data.m_uiGameHostSettings; switch(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_Difficulty)) @@ -185,12 +187,14 @@ HRESULT CScene_MultiGameInfo::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHan rfHandled = TRUE; break; case VK_PAD_Y: +#ifndef _DISABLE_XBLIVE if(m_selectedSession != NULL && playersList.TreeHasFocus() && playersList.GetItemCount() > 0) { PlayerUID xuid = m_selectedSession->data.players[playersList.GetCurSel()]; if( xuid != INVALID_XUID ) hr = XShowGamerCardUI(ProfileManager.GetLockedProfile(), xuid); } +#endif break; } @@ -351,6 +355,7 @@ HRESULT CScene_MultiGameInfo::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) { if ( pTimer->nId == UPDATE_PLAYERS_TIMER_ID) { +#ifndef _DISABLE_XBLIVE PlayerUID selectedPlayerXUID = m_selectedSession->data.players[playersList.GetCurSel()]; bool success = g_NetworkManager.GetGameSessionInfo(m_iPad, m_selectedSession->sessionId,m_selectedSession); @@ -384,6 +389,7 @@ HRESULT CScene_MultiGameInfo::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) } playersList.SetCurSel(selectedIndex); } +#endif } return S_OK; diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.h b/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.h index 9664640b..a0dfcd80 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.h +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.h @@ -1,7 +1,9 @@ #pragma once using namespace std; #include +#ifndef _DISABLE_XBLIVE #include +#endif #include "..\Media\xuiscene_multi_gameinfo.h" class FriendSessionInfo; diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp index 73f25da5..1c4f3f21 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp @@ -648,9 +648,11 @@ HRESULT CScene_MultiGameJoinLoad::OnKeyDown(XUIMessageInput* pInputData, BOOL& r DWORD nIndex = m_pGamesList->GetCurSel(); FriendSessionInfo *pSelectedSession = currentSessions.at( nIndex ); +#ifndef _DISABLE_XBLIVE PlayerUID xuid = pSelectedSession->data.hostPlayerUID; if( xuid != INVALID_XUID ) hr = XShowGamerCardUI(ProfileManager.GetLockedProfile(), xuid); +#endif CXuiSceneBase::PlayUISFX(eSFX_Press); } else if(DoesSavesListHaveFocus()) diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index d8d4ca0b..3696c6ff 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -28,6 +28,13 @@ #include "PSVita\Social\SocialManager.h" #include "PSVita\Sentient\DynamicConfigurations.h" #include +#elif defined _XBOX +#include "Xbox\Sentient\SentientManager.h" +#include "Common\Network\WinsockNetLayer.h" +#include "StatsCounter.h" +#include "Xbox\Social\SocialManager.h" +#include "Xbox\Sentient\DynamicConfigurations.h"x +#include "Common\Network\IQNet.h" #else #include "Orbis\Sentient\SentientManager.h" #include "StatsCounter.h" @@ -36,6 +43,7 @@ #include #endif +#ifndef _DISABLE_XBLIVE #if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) #ifdef _WINDOWS64 //C4JStorage StorageManager; @@ -189,133 +197,6 @@ D3DXVECTOR3::D3DXVECTOR3() {} D3DXVECTOR3::D3DXVECTOR3(float x,float y,float z) : x(x), y(y), z(z) {} D3DXVECTOR3& D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& add ) { x += add.x; y += add.y; z += add.z; return *this; } -BYTE IQNetPlayer::GetSmallId() { return m_smallId; } -void IQNetPlayer::SendData(IQNetPlayer *player, const void *pvData, DWORD dwDataSize, DWORD dwFlags) -{ - if (WinsockNetLayer::IsActive()) - { - WinsockNetLayer::SendToSmallId(player->m_smallId, pvData, dwDataSize); - } -} -bool IQNetPlayer::IsSameSystem(IQNetPlayer *player) { return (this == player) || (!m_isRemote && !player->m_isRemote); } -DWORD IQNetPlayer::GetSendQueueSize( IQNetPlayer *player, DWORD dwFlags ) { return 0; } -DWORD IQNetPlayer::GetCurrentRtt() { return 0; } -bool IQNetPlayer::IsHost() { return m_isHostPlayer; } -bool IQNetPlayer::IsGuest() { return false; } -bool IQNetPlayer::IsLocal() { return !m_isRemote; } -PlayerUID IQNetPlayer::GetXuid() { return (PlayerUID)(0xe000d45248242f2e + m_smallId); } -LPCWSTR IQNetPlayer::GetGamertag() { return m_gamertag; } -int IQNetPlayer::GetSessionIndex() { return m_smallId; } -bool IQNetPlayer::IsTalking() { return false; } -bool IQNetPlayer::IsMutedByLocalUser(DWORD dwUserIndex) { return false; } -bool IQNetPlayer::HasVoice() { return false; } -bool IQNetPlayer::HasCamera() { return false; } -int IQNetPlayer::GetUserIndex() { return this - &IQNet::m_player[0]; } -void IQNetPlayer::SetCustomDataValue(ULONG_PTR ulpCustomDataValue) { - m_customData = ulpCustomDataValue; -} -ULONG_PTR IQNetPlayer::GetCustomDataValue() { - return m_customData; -} - -IQNetPlayer IQNet::m_player[MINECRAFT_NET_MAX_PLAYERS]; -DWORD IQNet::s_playerCount = 1; -bool IQNet::s_isHosting = true; - -QNET_STATE _iQNetStubState = QNET_STATE_IDLE; - -void Win64_SetupRemoteQNetPlayer(IQNetPlayer *player, BYTE smallId, bool isHost, bool isLocal) -{ - player->m_smallId = smallId; - player->m_isRemote = !isLocal; - player->m_isHostPlayer = isHost; - swprintf(player->m_gamertag, 32, L"Player%d", smallId); - if (smallId >= IQNet::s_playerCount) - IQNet::s_playerCount = smallId + 1; -} - -HRESULT IQNet::AddLocalPlayerByUserIndex(DWORD dwUserIndex){ return S_OK; } -IQNetPlayer *IQNet::GetHostPlayer() { return &m_player[0]; } -IQNetPlayer *IQNet::GetLocalPlayerByUserIndex(DWORD dwUserIndex) -{ - if (s_isHosting) - { - if (dwUserIndex < MINECRAFT_NET_MAX_PLAYERS && !m_player[dwUserIndex].m_isRemote) - return &m_player[dwUserIndex]; - return NULL; - } - if (dwUserIndex != 0) - return NULL; - for (DWORD i = 0; i < s_playerCount; i++) - { - if (!m_player[i].m_isRemote) - return &m_player[i]; - } - return NULL; -} -static bool Win64_IsActivePlayer(IQNetPlayer *p, DWORD index) -{ - if (index == 0) return true; - return (p->GetCustomDataValue() != 0); -} - -IQNetPlayer *IQNet::GetPlayerByIndex(DWORD dwPlayerIndex) -{ - DWORD found = 0; - for (DWORD i = 0; i < s_playerCount; i++) - { - if (Win64_IsActivePlayer(&m_player[i], i)) - { - if (found == dwPlayerIndex) return &m_player[i]; - found++; - } - } - return &m_player[0]; -} -IQNetPlayer *IQNet::GetPlayerBySmallId(BYTE SmallId) -{ - for (DWORD i = 0; i < s_playerCount; i++) - { - if (m_player[i].m_smallId == SmallId && Win64_IsActivePlayer(&m_player[i], i)) return &m_player[i]; - } - return NULL; -} -IQNetPlayer *IQNet::GetPlayerByXuid(PlayerUID xuid) -{ - for (DWORD i = 0; i < s_playerCount; i++) - { - if (Win64_IsActivePlayer(&m_player[i], i) && m_player[i].GetXuid() == xuid) return &m_player[i]; - } - return &m_player[0]; -} -DWORD IQNet::GetPlayerCount() -{ - DWORD count = 0; - for (DWORD i = 0; i < s_playerCount; i++) - { - if (Win64_IsActivePlayer(&m_player[i], i)) count++; - } - return count; -} -QNET_STATE IQNet::GetState() { return _iQNetStubState; } -bool IQNet::IsHost() { return s_isHosting; } -HRESULT IQNet::JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO *pInviteInfo) { return S_OK; } -void IQNet::HostGame() { _iQNetStubState = QNET_STATE_SESSION_STARTING; s_isHosting = true; } -void IQNet::ClientJoinGame() { _iQNetStubState = QNET_STATE_SESSION_STARTING; s_isHosting = false; } -void IQNet::EndGame() -{ - _iQNetStubState = QNET_STATE_IDLE; - s_isHosting = false; - s_playerCount = 1; - for (int i = 1; i < MINECRAFT_NET_MAX_PLAYERS; i++) - { - m_player[i].m_smallId = 0; - m_player[i].m_isRemote = false; - m_player[i].m_isHostPlayer = false; - m_player[i].m_gamertag[0] = 0; - m_player[i].SetCustomDataValue(0); - } -} DWORD MinecraftDynamicConfigurations::GetTrialTime() { return DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; } void XSetThreadProcessor(HANDLE a, int b) {} @@ -537,6 +418,135 @@ void C_4JProfile::Initialise( DWORD dwTitleID, } } #endif +#endif // DISABLE_XBLIVE +BYTE IQNetPlayer::GetSmallId() { return m_smallId; } +void IQNetPlayer::SendData(IQNetPlayer *player, const void *pvData, DWORD dwDataSize, DWORD dwFlags) +{ + if (WinsockNetLayer::IsActive()) + { + WinsockNetLayer::SendToSmallId(player->m_smallId, pvData, dwDataSize); + } +} +bool IQNetPlayer::IsSameSystem(IQNetPlayer *player) { return (this == player) || (!m_isRemote && !player->m_isRemote); } +DWORD IQNetPlayer::GetSendQueueSize( IQNetPlayer *player, DWORD dwFlags ) { return 0; } +DWORD IQNetPlayer::GetCurrentRtt() { return 0; } +bool IQNetPlayer::IsHost() { return m_isHostPlayer; } +bool IQNetPlayer::IsGuest() { return false; } +bool IQNetPlayer::IsLocal() { return !m_isRemote; } +PlayerUID IQNetPlayer::GetXuid() { return (PlayerUID)(0xe000d45248242f2e + m_smallId); } +LPCWSTR IQNetPlayer::GetGamertag() { return m_gamertag; } +int IQNetPlayer::GetSessionIndex() { return m_smallId; } +bool IQNetPlayer::IsTalking() { return false; } +bool IQNetPlayer::IsMutedByLocalUser(DWORD dwUserIndex) { return false; } +bool IQNetPlayer::HasVoice() { return false; } +bool IQNetPlayer::HasCamera() { return false; } +int IQNetPlayer::GetUserIndex() { return this - &IQNet::m_player[0]; } +void IQNetPlayer::SetCustomDataValue(ULONG_PTR ulpCustomDataValue) { + m_customData = ulpCustomDataValue; +} +ULONG_PTR IQNetPlayer::GetCustomDataValue() { + return m_customData; +} + +IQNetPlayer IQNet::m_player[MINECRAFT_NET_MAX_PLAYERS]; +DWORD IQNet::s_playerCount = 1; +bool IQNet::s_isHosting = true; + +QNET_STATE _iQNetStubState = QNET_STATE_IDLE; + +void Win64_SetupRemoteQNetPlayer(IQNetPlayer *player, BYTE smallId, bool isHost, bool isLocal) +{ + player->m_smallId = smallId; + player->m_isRemote = !isLocal; + player->m_isHostPlayer = isHost; + swprintf(player->m_gamertag, 32, L"Player%d", smallId); + if (smallId >= IQNet::s_playerCount) + IQNet::s_playerCount = smallId + 1; +} + +HRESULT IQNet::AddLocalPlayerByUserIndex(DWORD dwUserIndex){ return S_OK; } +IQNetPlayer *IQNet::GetHostPlayer() { return &m_player[0]; } +IQNetPlayer *IQNet::GetLocalPlayerByUserIndex(DWORD dwUserIndex) +{ + if (s_isHosting) + { + if (dwUserIndex < MINECRAFT_NET_MAX_PLAYERS && !m_player[dwUserIndex].m_isRemote) + return &m_player[dwUserIndex]; + return NULL; + } + if (dwUserIndex != 0) + return NULL; + for (DWORD i = 0; i < s_playerCount; i++) + { + if (!m_player[i].m_isRemote) + return &m_player[i]; + } + return NULL; +} +static bool Win64_IsActivePlayer(IQNetPlayer *p, DWORD index) +{ + if (index == 0) return true; + return (p->GetCustomDataValue() != 0); +} + +IQNetPlayer *IQNet::GetPlayerByIndex(DWORD dwPlayerIndex) +{ + DWORD found = 0; + for (DWORD i = 0; i < s_playerCount; i++) + { + if (Win64_IsActivePlayer(&m_player[i], i)) + { + if (found == dwPlayerIndex) return &m_player[i]; + found++; + } + } + return &m_player[0]; +} +IQNetPlayer *IQNet::GetPlayerBySmallId(BYTE SmallId) +{ + for (DWORD i = 0; i < s_playerCount; i++) + { + if (m_player[i].m_smallId == SmallId && Win64_IsActivePlayer(&m_player[i], i)) return &m_player[i]; + } + return NULL; +} +IQNetPlayer *IQNet::GetPlayerByXuid(PlayerUID xuid) +{ + for (DWORD i = 0; i < s_playerCount; i++) + { + if (Win64_IsActivePlayer(&m_player[i], i) && m_player[i].GetXuid() == xuid) return &m_player[i]; + } + return &m_player[0]; +} +DWORD IQNet::GetPlayerCount() +{ + DWORD count = 0; + for (DWORD i = 0; i < s_playerCount; i++) + { + if (Win64_IsActivePlayer(&m_player[i], i)) count++; + } + return count; +} +QNET_STATE IQNet::GetState() { return _iQNetStubState; } +bool IQNet::IsHost() { return s_isHosting; } +HRESULT IQNet::JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO *pInviteInfo) { return S_OK; } +void IQNet::HostGame() { _iQNetStubState = QNET_STATE_SESSION_STARTING; s_isHosting = true; } +void IQNet::ClientJoinGame() { _iQNetStubState = QNET_STATE_SESSION_STARTING; s_isHosting = false; } +void IQNet::EndGame() +{ + _iQNetStubState = QNET_STATE_IDLE; + s_isHosting = false; + s_playerCount = 1; + for (int i = 1; i < MINECRAFT_NET_MAX_PLAYERS; i++) + { + m_player[i].m_smallId = 0; + m_player[i].m_isRemote = false; + m_player[i].m_isHostPlayer = false; + m_player[i].m_gamertag[0] = 0; + m_player[i].SetCustomDataValue(0); + } +} +#ifndef _DISABLE_XBLIVE #if defined _WINDOWS64 || (defined(__PS3__) && defined(DISABLE_PSN)) void C_4JProfile::SetTrialTextStringTable(CXuiStringTable *pStringTable,int iAccept,int iReject) {} void C_4JProfile::SetTrialAwardText(eAwardType AwardType,int iTitle,int iText) {} @@ -757,4 +767,5 @@ void StatsCounter::WipeLeaderboards() {} #ifdef __PS3__ bool C_4JProfile::IsFullVersion() { return true; } +#endif #endif \ No newline at end of file diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index 32e33b88..98190241 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -1,4 +1,4 @@ - + @@ -988,7 +988,7 @@ false $(OutDir)$(ProjectName).pch MultiThreaded - _ITERATOR_DEBUG_LEVEL=0;NDEBUG;_XBOX;%(PreprocessorDefinitions) + _DISABLE_XBLIVE;_ITERATOR_DEBUG_LEVEL=0;NDEBUG;_XBOX;%(PreprocessorDefinitions) $(ProjectDir);%(AdditionalIncludeDirectories) true true @@ -3190,6 +3190,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUXML Designer + @@ -5103,6 +5104,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + @@ -5111,7 +5113,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - true + false true true true @@ -18982,7 +18984,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - true + false true true false @@ -19982,7 +19984,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - false + true false true true @@ -20092,6 +20094,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true true @@ -25273,7 +25276,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - true + false true true true @@ -29969,7 +29972,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU true - true + false true true true @@ -34037,7 +34040,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - true + false true true true @@ -34369,7 +34372,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - false + true false true true @@ -34478,6 +34481,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true true diff --git a/Minecraft.Client/Minecraft.Client.vcxproj.filters b/Minecraft.Client/Minecraft.Client.vcxproj.filters index 681c8a46..949aa288 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj.filters +++ b/Minecraft.Client/Minecraft.Client.vcxproj.filters @@ -726,6 +726,9 @@ {889a84db-3009-4a7c-8234-4bf93d412690} + + {a86cfe95-eafc-414e-8ba4-190ff049fde4} + @@ -890,6 +893,7 @@ + @@ -3778,6 +3782,9 @@ Common\Source Files\Network + + Common\Source Files\Network + diff --git a/Minecraft.Client/PendingConnection.cpp b/Minecraft.Client/PendingConnection.cpp index b841ab84..873763e0 100644 --- a/Minecraft.Client/PendingConnection.cpp +++ b/Minecraft.Client/PendingConnection.cpp @@ -171,26 +171,26 @@ void PendingConnection::handleLogin(shared_ptr packet) { vector > &pl = server->getPlayers()->players; - for (unsigned int i = 0; i < pl.size(); i++) - { - if (pl[i] != NULL && pl[i]->name == name) - { - nameTaken = true; - break; - } + for (unsigned int i = 0; i < pl.size(); i++) + { + if (pl[i] != NULL && pl[i]->name == name) + { + nameTaken = true; + break; + } } - if (nameTaken) - { - app.DebugPrintf("Rejecting duplicate name: %ls\n", name.c_str()); - - // to do: replace this with a dedicated duplicate name - // message - disconnect(DisconnectPacket::eDisconnect_Banned); - } - else - { - handleAcceptedLogin(packet); + if (nameTaken) + { + app.DebugPrintf("Rejecting duplicate name: %ls\n", name.c_str()); + + // to do: replace this with a dedicated duplicate name + // message + disconnect(DisconnectPacket::eDisconnect_Banned); + } + else + { + handleAcceptedLogin(packet); } } //else diff --git a/Minecraft.Client/TrackedEntity.cpp b/Minecraft.Client/TrackedEntity.cpp index ae823c33..ef7c4a78 100644 --- a/Minecraft.Client/TrackedEntity.cpp +++ b/Minecraft.Client/TrackedEntity.cpp @@ -19,7 +19,9 @@ #include "PlayerList.h" #include "EntityTracker.h" #include "PlayerChunkMap.h" +#ifndef _DISABLE_XBLIVE #include +#endif TrackedEntity::TrackedEntity(shared_ptr e, int range, int updateInterval, bool trackDelta) { diff --git a/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.h b/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.h index 47e0be33..449eeb58 100644 --- a/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.h +++ b/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.h @@ -1,7 +1,9 @@ #pragma once using namespace std; #include +#ifndef _DISABLE_XBLIVE #include +#endif #include "..\..\..\Minecraft.World\C4JThread.h" #include "..\..\Common\Network\NetworkPlayerInterface.h" #include "..\..\Common\Network\PlatformNetworkManagerInterface.h" diff --git a/Minecraft.Client/Xbox/Xbox_Minecraft.cpp b/Minecraft.Client/Xbox/Xbox_Minecraft.cpp index 364854d8..1db73176 100644 --- a/Minecraft.Client/Xbox/Xbox_Minecraft.cpp +++ b/Minecraft.Client/Xbox/Xbox_Minecraft.cpp @@ -24,7 +24,11 @@ #include "..\..\Minecraft.Client\StatsCounter.h" #include "..\ConnectScreen.h" #include "Social\SocialManager.h" -#include "Leaderboards\XboxLeaderboardManager.h" +#ifndef _DISABLE_XBLIVE + #include "Leaderboards\XboxLeaderboardManager.h" +#else + #include "..\Windows64\Leaderboards\WindowsLeaderboardManager.h" +#endif #include "..\Common\XUI\XUI_Scene_Container.h" #include "..\..\Minecraft.Client\Tesselator.h" #include "..\..\Minecraft.Client\Options.h" diff --git a/Minecraft.Client/stdafx.h b/Minecraft.Client/stdafx.h index ea82b21c..e5fb0b50 100644 --- a/Minecraft.Client/stdafx.h +++ b/Minecraft.Client/stdafx.h @@ -101,10 +101,17 @@ using namespace DirectX; #include #include #include +#ifdef _DISABLE_XBLIVE +typedef ULONGLONG PlayerUID; +typedef ULONGLONG SessionID; +typedef PlayerUID GameSessionUID; +class INVITE_INFO; +#else typedef XINVITE_INFO INVITE_INFO; typedef XUID PlayerUID; typedef XNKID SessionID; typedef XUID GameSessionUID; +#endif // _DISABLE_XBLIVE #define HRESULT_SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) #include "..\Minecraft.Client\xbox\network\extra.h" @@ -231,7 +238,11 @@ typedef XUID GameSessionUID; #include "Xbox\GameConfig\Minecraft.spa.h" #include "XboxMedia\4J_strings.h" #include "Xbox\XML\ATGXmlParser.h" +#ifndef _DISABLE_XBLIVE #include "Xbox\Leaderboards\XboxLeaderboardManager.h" +#else + #include "Windows64\Leaderboards\WindowsLeaderboardManager.h" +#endif #include "Xbox\Social\SocialManager.h" #include "Xbox\Audio\SoundEngine.h" #include "Xbox\Xbox_UIController.h" @@ -292,7 +303,7 @@ typedef XUID GameSessionUID; #include "PSVita\Iggy\include\iggy.h" #include "PSVita\Iggy\gdraw\gdraw_psp2.h" #include "PSVita\PSVita_UIController.h" -#else +#elif !defined _XBOX #include "Orbis\Sentient\MinecraftTelemetry.h" #include "OrbisMedia\strings.h" #include "Orbis\Orbis_App.h" @@ -349,4 +360,4 @@ typedef XUID GameSessionUID; #define OutputDebugStringW BREAKTHECOMPILE #endif -void MemSect(int sect); +void MemSect(int sect); \ No newline at end of file diff --git a/Minecraft.World/Connection.cpp b/Minecraft.World/Connection.cpp index 32c706ed..f37f0f1d 100644 --- a/Minecraft.World/Connection.cpp +++ b/Minecraft.World/Connection.cpp @@ -255,7 +255,7 @@ bool Connection::writeTick() // 4J Stu - Changed this so that rather than writing to the network stream through a buffered stream we want to: // a) Only push whole "game" packets to QNet, rather than amalgamated chunks of data that may include many packets, and partial packets // b) To be able to change the priority and queue of a packet if required -#ifdef _XBOX +#if defined _XBOX && !defined _DISABLE_XBLIVE int flags = QNET_SENDDATA_LOW_PRIORITY | QNET_SENDDATA_SECONDARY; #else int flags = NON_QNET_SENDDATA_ACK_REQUIRED; diff --git a/Minecraft.World/Minecraft.World.vcxproj b/Minecraft.World/Minecraft.World.vcxproj index 300cecf8..274964cb 100644 --- a/Minecraft.World/Minecraft.World.vcxproj +++ b/Minecraft.World/Minecraft.World.vcxproj @@ -589,6 +589,7 @@ $(OutDir)$(ProjectName).lib + $(Xbox360TechPreviewInclude);$(XDKInstallDir)\include\xbox; $(OutDir)$(ProjectName).lib @@ -884,7 +885,7 @@ false $(OutDir)$(ProjectName).pch MultiThreaded - _ITERATOR_DEBUG_LEVEL=0;NDEBUG;_XBOX;_LIB;%(PreprocessorDefinitions) + _DISABLE_XBLIVE;_ITERATOR_DEBUG_LEVEL=0;NDEBUG;_XBOX;_LIB;%(PreprocessorDefinitions) true false false @@ -2589,7 +2590,9 @@ - + + false + diff --git a/Minecraft.World/PlayerInfoPacket.cpp b/Minecraft.World/PlayerInfoPacket.cpp index a26b1fff..591172e0 100644 --- a/Minecraft.World/PlayerInfoPacket.cpp +++ b/Minecraft.World/PlayerInfoPacket.cpp @@ -2,7 +2,9 @@ #include "net.minecraft.world.entity.player.h" #include "..\Minecraft.Client\ServerPlayer.h" #include "..\Minecraft.Client\PlayerConnection.h" +#ifndef _DISABLE_XBLIVE #include +#endif #include "PacketListener.h" #include "InputOutputStream.h" #include "PlayerInfoPacket.h" diff --git a/Minecraft.World/Socket.cpp b/Minecraft.World/Socket.cpp index cecc030e..fc98101a 100644 --- a/Minecraft.World/Socket.cpp +++ b/Minecraft.World/Socket.cpp @@ -500,7 +500,7 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b, unsigned int return; } -#ifdef _XBOX +#if defined _XBOX && !defined _DISABLE_XBLIVE bool lowPriority = ( ( flags & QNET_SENDDATA_LOW_PRIORITY ) == QNET_SENDDATA_LOW_PRIORITY ); bool requireAck = lowPriority; #else diff --git a/Minecraft.World/Socket.h b/Minecraft.World/Socket.h index beb7e9d9..dc1c227c 100644 --- a/Minecraft.World/Socket.h +++ b/Minecraft.World/Socket.h @@ -1,7 +1,9 @@ #pragma once #include #include +#ifndef _DISABLE_XBLIVE #include +#endif #include "InputStream.h" #include "OutputStream.h" diff --git a/Minecraft.World/stdafx.h b/Minecraft.World/stdafx.h index 9ded13bc..96e206ec 100644 --- a/Minecraft.World/stdafx.h +++ b/Minecraft.World/stdafx.h @@ -53,10 +53,17 @@ using namespace DirectX; #include #include #include +#ifdef _DISABLE_XBLIVE +typedef ULONGLONG PlayerUID; +typedef ULONGLONG SessionID; +typedef PlayerUID GameSessionUID; +class INVITE_INFO; +#else typedef XINVITE_INFO INVITE_INFO; typedef XUID PlayerUID; typedef XNKID SessionID; typedef XUID GameSessionUID; +#endif // _DISABLE_XBLIVE #endif #ifdef __PS3__