diff --git a/Minecraft.Client/Common/App_structs.h b/Minecraft.Client/Common/App_structs.h index 2adec86f..2ad696ee 100644 --- a/Minecraft.Client/Common/App_structs.h +++ b/Minecraft.Client/Common/App_structs.h @@ -162,7 +162,7 @@ MOJANG_DATA; typedef struct { eDLCContentType eDLCType; -#if !defined(DISABLE_PSN) && defined( __PS3__) || defined(__ORBIS__) || defined (__PSVITA__) +#if !defined(DISABLE_PSN) && (defined( __PS3__) || defined(__ORBIS__) || defined (__PSVITA__)) char chImageURL[256];//SCE_NP_COMMERCE2_URL_LEN #else diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 9625d75c..fb407878 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -6769,7 +6769,7 @@ wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon) #endif } -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)) unordered_map CMinecraftApp::MojangData; unordered_map CMinecraftApp::DLCTextures_PackID; unordered_map CMinecraftApp::DLCInfo; @@ -6780,7 +6780,7 @@ unordered_map CMinecraftApp::DLCTextures_PackID; // for mash-up //unordered_map CMinecraftApp::DLCInfo_Trial; // full offerid, dlc_info unordered_map CMinecraftApp::DLCInfo_Full; // full offerid, dlc_info unordered_map CMinecraftApp::DLCInfo_SkinName; // skin name, full offer id -#elif defined(DISABLE_PSN) && defined(__PS3__) +#elif defined(DISABLE_PSN) unordered_map CMinecraftApp::MojangData; unordered_map CMinecraftApp::DLCTextures_PackID; unordered_map CMinecraftApp::DLCInfo_Trial; @@ -7060,7 +7060,7 @@ HRESULT CMinecraftApp::RegisterDLCData(char *pchDLCName, unsigned int uiSortInde -#if !defined(DISABLE_PSN) && defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal) { AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); @@ -7328,7 +7328,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName) return NULL; } -#elif !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) +#elif !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)) #else DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full) @@ -9439,7 +9439,7 @@ byteArray CMinecraftApp::getArchiveFile(const wstring &filename) // DLC -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)) int CMinecraftApp::GetDLCInfoCount() { return (int)DLCInfo.size(); diff --git a/Minecraft.Client/Common/Consoles_App.h b/Minecraft.Client/Common/Consoles_App.h index 3bae77c3..a4dfd835 100644 --- a/Minecraft.Client/Common/Consoles_App.h +++ b/Minecraft.Client/Common/Consoles_App.h @@ -594,7 +594,7 @@ public: MOJANG_DATA *GetMojangDataForXuid(PlayerUID xuid); static HRESULT RegisterConfigValues(WCHAR *pType, int iValue); -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) HRESULT RegisterDLCData(char *pchDLCName, unsigned int uiSortIndex, char *pchImageURL); bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal); DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial); @@ -631,7 +631,7 @@ private: std::vector vDLCCredits; -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)) static unordered_map MojangData; static unordered_map DLCTextures_PackID; // for mash-up packs & texture packs static unordered_map DLCInfo; @@ -642,7 +642,7 @@ private: //static unordered_map DLCInfo_Trial; // full offerid, dlc_info static unordered_map DLCInfo_Full; // full offerid, dlc_info static unordered_map DLCInfo_SkinName; // skin name, full offer id -#elif defined(DISABLE_PSN) && defined(__PS3__) +#elif defined(DISABLE_PSN) static unordered_map MojangData; static unordered_map DLCTextures_PackID; // for mash-up packs & texture packs static unordered_map DLCInfo_Trial; // full offerid, dlc_info @@ -778,7 +778,7 @@ public: void ClearTMSPPFilesRetrieved(); unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote=false); int GetDLCInfoTexturesOffersCount(); -#if !defined(DISABLE_PSN) && defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) DLC_INFO *GetDLCInfo(int iIndex); DLC_INFO *GetDLCInfo(char *); DLC_INFO *GetDLCInfoFromTPackID(int iTPID); diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Common/Network/GameNetworkManager.cpp index 86257604..53ea7a0e 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/GameNetworkManager.cpp @@ -68,7 +68,7 @@ void CGameNetworkManager::Initialise() int flagIndexSize = LevelRenderer::getGlobalChunkCount() / (Level::maxBuildHeight / 16); // dividing here by number of renderer chunks in one column #if !defined(_DISABLE_XBLIVE) && defined _XBOX s_pPlatformNetworkManager = new CPlatformNetworkManagerXbox(); -#elif !defined(DISABLE_PSN) && defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ +#elif !defined(DISABLE_PSN) && (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__) s_pPlatformNetworkManager = new CPlatformNetworkManagerSony(); #elif defined _DURANGO s_pPlatformNetworkManager = new CPlatformNetworkManagerDurango(); @@ -801,7 +801,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__PSVITA__)) ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,NULL,NULL); #elif defined(__ORBIS__) ProfileManager.GetChatAndContentRestrictions(iPad,false,NULL,&noUGC,NULL); @@ -1815,7 +1815,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * #endif if( !g_NetworkManager.IsInSession() ) { -#if !defined(DISABLE_PSN) && defined (__PS3__) || defined (__PSVITA__) +#if !defined(DISABLE_PSN) && (defined (__PS3__) || defined (__PSVITA__)) // PS3 is more complicated here - we need to make sure that the player is online. If they are then we can do the same as the xbox, if not we need to try and get them online and then, if they do sign in, go down the same path // Determine why they're not "signed in live" @@ -1965,7 +1965,7 @@ void CGameNetworkManager::HandleDisconnect(bool bLostRoomOnly) if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && g_NetworkManager.IsInSession() ) { m_bLastDisconnectWasLostRoomOnly = bLostRoomOnly; -#if !defined(DISABLE_PSN) && defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ +#if !defined(DISABLE_PSN) && (defined __PS3__ || defined __PSVITA__ || defined __ORBIS__) m_bSignedOutofPSN=bPSNSignout; #endif app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected); diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.h b/Minecraft.Client/Common/Network/GameNetworkManager.h index 91fb6bf6..8aeeb3d3 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.h +++ b/Minecraft.Client/Common/Network/GameNetworkManager.h @@ -8,7 +8,7 @@ using namespace std; #include "NetworkPlayerInterface.h" #if defined _XBOX && !defined _DISABLE_XBLIVE #include "..\..\Xbox\Network\PlatformNetworkManagerXbox.h" -#elif !defined DISABLE_PSN && defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ +#elif !defined DISABLE_PSN && (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__) #include "..\..\Common\Network\Sony\PlatformNetworkManagerSony.h" #elif defined _DURANGO #include "..\..\Durango\Network\PlatformNetworkManagerDurango.h" @@ -34,7 +34,7 @@ class CGameNetworkManager { #if defined _XBOX && !defined _DISABLE_XBLIVE friend class CPlatformNetworkManagerXbox; -#elif !defined DISABLE_PSN && defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ +#elif !defined DISABLE_PSN && (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__) friend class CPlatformNetworkManagerSony; #elif defined _DURANGO friend class CPlatformNetworkManagerDurango; diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 0a234252..e517cdb6 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -5,9 +5,7 @@ #include "..\..\Xbox\Network\NetworkPlayerXbox.h" // TODO - stub version of this? #include "..\..\Minecraft.h" #include "..\..\User.h" -#if defined _WINDOWS64 || defined __PS3__ || defined _XBOX #include "..\..\Common\Network\WinsockNetLayer.h" -#endif CPlatformNetworkManagerStub *g_pPlatformNetworkManager; @@ -770,8 +768,13 @@ void CPlatformNetworkManagerStub::SearchForGames() } } +#ifdef __ORBIS__ + SceNetInAddr ip_addr = {}; + sceNetInetPton(SCE_NET_AF_INET, lanSessions[i].hostIP, &ip_addr); + info->sessionId = (ULONGLONG)((uint64_t)ip_addr.s_addr | ((uint64_t)lanSessions[i].hostPort << 32)); +#else info->sessionId = (ULONGLONG)((unsigned __int64)inet_addr(lanSessions[i].hostIP) | ((unsigned __int64)lanSessions[i].hostPort << 32)); - +#endif friendsSessions[0].push_back(info); } diff --git a/Minecraft.Client/Common/Network/SessionInfo.h b/Minecraft.Client/Common/Network/SessionInfo.h index 4d494b9d..b48ecbae 100644 --- a/Minecraft.Client/Common/Network/SessionInfo.h +++ b/Minecraft.Client/Common/Network/SessionInfo.h @@ -32,7 +32,7 @@ typedef struct _GameSessionData subTexturePackId = 0; } } GameSessionData; -#elif (defined __PS3__ && !defined DISABLE_PSN) || defined __ORBIS__ || defined(__PSVITA__) +#elif !defined DISABLE_PSN && (defined __PS3__ || defined __ORBIS__ || defined(__PSVITA__)) typedef struct _GameSessionData { unsigned short netVersion; // 2 bytes @@ -114,7 +114,7 @@ public: SessionID sessionId; #ifdef _XBOX XSESSION_SEARCHRESULT searchResult; -#elif (defined __PS3__ && !defined DISABLE_PSN) || defined(__ORBIS__) || defined (__PSVITA__) +#elif !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)) SQRNetworkManager::SessionSearchResult searchResult; #elif defined(_DURANGO) DQRNetworkManager::SessionSearchResult searchResult; diff --git a/Minecraft.Client/Common/Network/WinsockNetLayer.cpp b/Minecraft.Client/Common/Network/WinsockNetLayer.cpp index 9a653a47..725d2de7 100644 --- a/Minecraft.Client/Common/Network/WinsockNetLayer.cpp +++ b/Minecraft.Client/Common/Network/WinsockNetLayer.cpp @@ -9,15 +9,22 @@ SOCKET WinsockNetLayer::s_listenSocket = INVALID_SOCKET; SOCKET WinsockNetLayer::s_hostConnectionSocket = INVALID_SOCKET; SOCKET WinsockNetLayer::s_advertiseSock = INVALID_SOCKET; SOCKET WinsockNetLayer::s_discoverySock = INVALID_SOCKET; -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ SOCKET WinsockNetLayer::s_listenSocket = -1; SOCKET WinsockNetLayer::s_hostConnectionSocket = -1; SOCKET WinsockNetLayer::s_advertiseSock = -1; SOCKET WinsockNetLayer::s_discoverySock = -1; +#if defined __PS3__ int closesocket(int s) { return socketclose(s); }; +void terminate_networking() { cellNetCtlTerm(); sys_net_finalize_network(); }; +#elif defined __ORBIS__ +int closesocket(int s) { return sceNetSocketClose(s); }; +int socketclose(int s) { return sceNetSocketClose(s); }; +void terminate_networking() {}; void WSACleanup() {}; #endif +#endif C4JThread* WinsockNetLayer::s_acceptThread = NULL; C4JThread* WinsockNetLayer::s_clientRecvThread = NULL; @@ -118,7 +125,7 @@ void WinsockNetLayer::Shutdown() closesocket(s_hostConnectionSocket); s_hostConnectionSocket = INVALID_SOCKET; } -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (s_listenSocket >= 0) { socketclose(s_listenSocket); @@ -139,7 +146,7 @@ void WinsockNetLayer::Shutdown() s_connections[i].active = false; #if defined _WINDOWS64 || defined _XBOX if (s_connections[i].tcpSocket != INVALID_SOCKET) -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (s_connections[i].tcpSocket >= 0) #endif { @@ -231,7 +238,7 @@ bool WinsockNetLayer::HostGame(int port) app.DebugPrintf("socket() failed: %d\n", WSAGetLastError()); return false; } -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ struct sockaddr_in addr = {}; addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(INADDR_ANY); @@ -285,7 +292,7 @@ bool WinsockNetLayer::HostGame(int port) s_listenSocket = INVALID_SOCKET; return false; } -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ iResult = ::bind(s_listenSocket, (struct sockaddr*)&addr, sizeof(addr)); if (iResult < 0) { @@ -539,7 +546,7 @@ bool WinsockNetLayer::JoinGame(const char *ip, int port) connected = true; break; } -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (s_hostConnectionSocket != -1) { socketclose(s_hostConnectionSocket); @@ -551,12 +558,20 @@ bool WinsockNetLayer::JoinGame(const char *ip, int port) addr.sin_family = AF_INET; addr.sin_port = htons((uint16_t)port); +#if defined(__PS3__) addr.sin_addr.s_addr = inet_addr(ip); if (addr.sin_addr.s_addr == INADDR_NONE) { app.DebugPrintf("inet_addr failed for %s:%d\n", ip, port); return false; } +#elif defined(__ORBIS__) + if (sceNetInetPton(SCE_NET_AF_INET, ip, &addr.sin_addr.s_addr) <= 0) + { + app.DebugPrintf("inet_addr failed for %s:%d\n", ip, port); + return false; + } +#endif bool connected = false; BYTE assignedSmallId = 0; @@ -575,14 +590,24 @@ bool WinsockNetLayer::JoinGame(const char *ip, int port) setsockopt(s_hostConnectionSocket, IPPROTO_TCP, TCP_NODELAY, (const char *)&noDelay, sizeof(noDelay)); int nonBlocking = 1; +#ifdef __PS3__ setsockopt(s_hostConnectionSocket, SOL_SOCKET, SO_NBIO, &nonBlocking, sizeof(nonBlocking)); +#elif defined(__ORBIS__) + setsockopt(s_hostConnectionSocket, SOL_SOCKET, SCE_NET_SO_NBIO, &nonBlocking, sizeof(nonBlocking)); +#endif iResult = connect(s_hostConnectionSocket, (struct sockaddr*)&addr, sizeof(addr)); if (iResult < 0) { +#if defined(__PS3__) int err = sys_net_errno; if (err == SYS_NET_EINPROGRESS) { +#elif defined(__ORBIS__) + int err = sce_net_errno; + if (err == SCE_NET_EINPROGRESS) + { +#endif fd_set writeFds, exceptFds; FD_ZERO(&writeFds); FD_ZERO(&exceptFds); @@ -593,7 +618,11 @@ bool WinsockNetLayer::JoinGame(const char *ip, int port) tv.tv_sec = connectTimeoutMs / 1000; tv.tv_usec = (connectTimeoutMs % 1000) * 1000; +#if defined(__PS3__) int selectResult = socketselect(s_hostConnectionSocket + 1, NULL, &writeFds, &exceptFds, &tv); +#elif defined(__ORBIS__) + int selectResult = select(s_hostConnectionSocket + 1, NULL, &writeFds, &exceptFds, &tv); +#endif if (selectResult <= 0 || FD_ISSET(s_hostConnectionSocket, &exceptFds)) { app.DebugPrintf("connect() to %s:%d timed out or failed (attempt %d/%d)\n", ip, port, attempt + 1, maxAttempts); @@ -623,7 +652,11 @@ bool WinsockNetLayer::JoinGame(const char *ip, int port) } int blocking = 0; +#ifdef __PS3__ setsockopt(s_hostConnectionSocket, SOL_SOCKET, SO_NBIO, &blocking, sizeof(blocking)); +#elif defined(__ORBIS__) + setsockopt(s_hostConnectionSocket, SOL_SOCKET, SCE_NET_SO_NBIO, &blocking, sizeof(blocking)); +#endif DWORD recvTimeout = 3000; setsockopt(s_hostConnectionSocket, SOL_SOCKET, SO_RCVTIMEO, (const char *)&recvTimeout, sizeof(recvTimeout)); @@ -675,7 +708,7 @@ bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void *data, int dataSize) { #if defined _WINDOWS64 || defined _XBOX if (sock == INVALID_SOCKET || dataSize <= 0) return false; -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (sock < 0 || dataSize <= 0) return false; #endif @@ -694,7 +727,7 @@ bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void *data, int dataSize) int sent = send(sock, (const char *)header + totalSent, toSend - totalSent, 0); #if defined _WINDOWS64 || defined _XBOX if (sent == SOCKET_ERROR || sent == 0) -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (sent < 0 || sent == 0) #endif { @@ -711,7 +744,7 @@ bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void *data, int dataSize) #if defined _WINDOWS64 || defined _XBOX if (sent == SOCKET_ERROR || sent == 0) -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (sent < 0 || sent == 0) #endif { @@ -734,7 +767,7 @@ bool WinsockNetLayer::SendToSmallId(BYTE targetSmallId, const void *data, int da SOCKET sock = GetSocketForSmallId(targetSmallId); #if defined _WINDOWS64 || defined _XBOX if (sock == INVALID_SOCKET) return false; -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (sock < 0) return false; #endif return SendOnSocket(sock, data, dataSize); @@ -760,7 +793,7 @@ SOCKET WinsockNetLayer::GetSocketForSmallId(BYTE smallId) LeaveCriticalSection(&s_connectionsLock); #if defined _WINDOWS64 || defined _XBOX return INVALID_SOCKET; -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ return -1; #endif } @@ -810,7 +843,7 @@ int WinsockNetLayer::AcceptThreadProc(LPVOID param) app.DebugPrintf("accept() failed: %d\n", WSAGetLastError()); break; } -#elif __PS3__ +#elif __PS3__ || defined __ORBIS__ if (clientSocket < 0) { if (s_active) @@ -1017,7 +1050,7 @@ int WinsockNetLayer::ClientRecvThreadProc(LPVOID param) #if defined _WINDOWS64 || defined _XBOX while (s_active && s_hostConnectionSocket != INVALID_SOCKET) -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ while (s_active && s_hostConnectionSocket >= 0) #endif { @@ -1082,7 +1115,7 @@ bool WinsockNetLayer::StartAdvertising(int gamePort, const wchar_t *hostName, un app.DebugPrintf("Win64 LAN: Failed to create advertise socket: %d\n", WSAGetLastError()); return false; } -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (s_advertiseSock < 0) { app.DebugPrintf("PS3 LAN: Failed to create advertise socket: %d\n", s_advertiseSock); @@ -1110,7 +1143,7 @@ void WinsockNetLayer::StopAdvertising() closesocket(s_advertiseSock); s_advertiseSock = INVALID_SOCKET; } -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (s_advertiseSock >= 0) { closesocket(s_advertiseSock); @@ -1180,7 +1213,7 @@ int WinsockNetLayer::AdvertiseThreadProc(LPVOID param) { app.DebugPrintf("Win64 LAN: Broadcast sendto failed: %d\n", WSAGetLastError()); } -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (sent < 0 && s_advertising) { app.DebugPrintf("PS3 LAN: Broadcast sendto failed: %d\n", sent); @@ -1205,13 +1238,12 @@ bool WinsockNetLayer::StartDiscovery() app.DebugPrintf("Win64 LAN: Failed to create discovery socket: %d\n", WSAGetLastError()); return false; } -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ app.DebugPrintf("Discovery socket: %d\n", s_discoverySock); if (s_discoverySock < 0) { app.DebugPrintf("PS3 LAN: Failed to create discovery socket: %d\n", s_discoverySock); - cellNetCtlTerm(); - sys_net_finalize_network(); + terminate_networking(); return false; } #endif @@ -1233,10 +1265,14 @@ bool WinsockNetLayer::StartDiscovery() s_discoverySock = INVALID_SOCKET; return false; } -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (::bind(s_discoverySock, (struct sockaddr *)&bindAddr, sizeof(bindAddr)) < 0) { +#if defined(__PS3__) app.DebugPrintf("PS3 LAN: Discovery bind failed: %d\n", sys_net_errno); +#elif defined(__ORBIS__) + app.DebugPrintf("PS3 LAN: Discovery bind failed: %d\n", sce_net_errno); +#endif socketclose(s_discoverySock); s_discoverySock = -1; return false; @@ -1263,7 +1299,7 @@ void WinsockNetLayer::StopDiscovery() closesocket(s_discoverySock); s_discoverySock = INVALID_SOCKET; } -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (s_discoverySock >= 0) { socketclose(s_discoverySock); @@ -1304,7 +1340,7 @@ int WinsockNetLayer::DiscoveryThreadProc(LPVOID param) struct sockaddr_in senderAddr; #if defined _WINDOWS64 || defined _XBOX int senderLen = sizeof(senderAddr); -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ socklen_t senderLen = sizeof(senderAddr); #endif @@ -1316,7 +1352,7 @@ int WinsockNetLayer::DiscoveryThreadProc(LPVOID param) { continue; } -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ if (recvLen < 0) { continue; diff --git a/Minecraft.Client/Common/Network/WinsockNetLayer.h b/Minecraft.Client/Common/Network/WinsockNetLayer.h index 20c31fc0..0ccb8025 100644 --- a/Minecraft.Client/Common/Network/WinsockNetLayer.h +++ b/Minecraft.Client/Common/Network/WinsockNetLayer.h @@ -7,12 +7,10 @@ #include #include #include -#elif defined __PS3__ +#elif defined __PS3__ || defined __ORBIS__ #include #include #include -#include -#include #include #include #include @@ -20,6 +18,11 @@ #include #endif +#ifdef __PS3__ +#include +#include +#endif + #include #include "..\..\Common\Network\NetworkPlayerInterface.h" @@ -34,7 +37,7 @@ #define WIN64_LAN_DISCOVERY_PORT 25566 #define WIN64_LAN_BROADCAST_MAGIC 0x4D434C4E -#ifdef __PS3__ +#if defined __PS3__ || defined __ORBIS__ typedef int SOCKET; #define INVALID_SOCKET -1 #endif diff --git a/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp b/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp index 8c2f712b..f811cd59 100644 --- a/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp @@ -54,7 +54,7 @@ void IUIScene_StartGame::HandleDLCMountingComplete() for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) { bTexturePackAlreadyListed=false; -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) char *pchName=app.GetDLCInfoTextures(i); pDLCInfo=app.GetDLCInfo(pchName); #elif defined _XBOX_ONE diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp index 42ef73f5..ce0b56a8 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp @@ -1392,17 +1392,21 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor return 0; } -#ifdef __ORBIS__ +#if defined(__ORBIS__) int UIScene_CreateWorldMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) { UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu *)pParam; pClass->m_bIgnoreInput = false; +#ifdef DISABLE_PSN + UIScene_CreateWorldMenu::StartGame_SignInReturned(pClass, true, iPad); +#else if(result==C4JStorage::EMessage_ResultAccept) { SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_CreateWorldMenu::StartGame_SignInReturned, pClass, false, iPad); } +#endif return 0; } diff --git a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp index c6211607..b55ee5fc 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp @@ -253,7 +253,7 @@ void UIScene_InGameInfoMenu::handleInput(int iPad, int key, bool repeat, bool pr } break; case ACTION_MENU_Y: -#if defined(__PS3__) || defined(__ORBIS__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__)) if(pressed && iPad == ProfileManager.GetPrimaryPad()) { #ifdef __PS3__ @@ -290,7 +290,7 @@ void UIScene_InGameInfoMenu::handleInput(int iPad, int key, bool repeat, bool pr { #ifdef __PSVITA__ PSVITA_STUBBED; -#else +#elif !defined(DISABLE_PSN) ProfileManager.ShowProfileCard(iPad,uid); #endif } diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp index 4892b0ab..86b3806b 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp @@ -59,7 +59,7 @@ void UIScene_JoinMenu::tick() m_buttonListPlayers.init(eControl_GamePlayers); -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__) for( int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++ ) { if( m_selectedSession->data.players[i] != NULL ) @@ -368,7 +368,7 @@ void UIScene_JoinMenu::checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, void UIScene_JoinMenu::StartSharedLaunchFlow() { -#if defined DISABLE_PSN && defined __PS3__ +#if defined DISABLE_PSN JoinGame(this); #else if(!app.IsLocalMultiplayerAvailable()) @@ -391,7 +391,7 @@ int UIScene_JoinMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int { UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)ui.GetSceneFromCallbackId((size_t)pParam); -#if defined DISABLE_PSN && defined __PS3__ +#if defined DISABLE_PSN JoinGame(pClass); return 0; #else @@ -496,7 +496,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) BOOL pccAllowed = TRUE; BOOL pccFriendsAllowed = TRUE; -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__PSVITA__)) if(isSignedInLive) { ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&noUGC,NULL,NULL); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp index 93bfe78a..cf5afce4 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp @@ -1784,17 +1784,20 @@ void UIScene_LoadMenu::handleGainFocus(bool navBack) } } -#ifdef __ORBIS__ +#if defined __ORBIS__ int UIScene_LoadMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu *)pParam; pClass->m_bIgnoreInput = false; +#ifdef DISABLE_PSN + UIScene_LoadMenu::StartGame_SignInReturned(pParam, true, iPad); +#else if(result==C4JStorage::EMessage_ResultAccept) { SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_LoadMenu::StartGame_SignInReturned, pClass, false, iPad); } - +#endif return 0; } diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index fd46e96c..39bba779 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -1013,7 +1013,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr #endif break; case ACTION_MENU_Y: -#if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__)) m_eAction = eAction_ViewInvites; if(pressed && iPad == ProfileManager.GetPrimaryPad()) { @@ -2414,6 +2414,7 @@ int UIScene_LoadOrJoinMenu::PSN_SignInReturned(void *pParam,bool bContinue, int // Check if we're signed in to LIVE if(ProfileManager.IsSignedInLive(iPad)) { +#ifndef DISABLE_PSN #if defined(__PS3__) int ret = sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, SYS_MEMORY_CONTAINER_ID_INVALID); app.DebugPrintf("sceNpBasicRecvMessageCustom return %d ( %08x )\n", ret, ret); @@ -2421,6 +2422,7 @@ int UIScene_LoadOrJoinMenu::PSN_SignInReturned(void *pParam,bool bContinue, int SQRNetworkManager_Vita::RecvInviteGUI(); #else SQRNetworkManager_Orbis::RecvInviteGUI(); +#endif #endif } break; diff --git a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp index eb2bd51b..93d15ead 100644 --- a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp @@ -409,7 +409,7 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, bool pressed case ACTION_MENU_Y: { -#if defined(__PS3__) || defined(__ORBIS__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__)) if(pressed && iPad == ProfileManager.GetPrimaryPad()) { #ifdef __ORBIS__ @@ -1340,6 +1340,7 @@ int UIScene_PauseMenu::ViewInvites_SignInReturned(void *pParam,bool bContinue, i // Check if we're signed in to LIVE if(ProfileManager.IsSignedInLive(iPad)) { +#ifndef DISABLE_PSN #ifdef __ORBIS__ SQRNetworkManager_Orbis::RecvInviteGUI(); #elif defined __PS3__ @@ -1347,6 +1348,7 @@ int UIScene_PauseMenu::ViewInvites_SignInReturned(void *pParam,bool bContinue, i app.DebugPrintf("sceNpBasicRecvMessageCustom return %d ( %08x )\n", ret, ret); #else // __PSVITA__ PSVITA_STUBBED; +#endif #endif } } diff --git a/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp b/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp index 5c27eee5..39706c80 100644 --- a/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp @@ -110,7 +110,7 @@ void UIScene_SaveMessage::handlePress(F64 controlId, F64 childId) m_bIgnoreInput=true; -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) // wait for the profile to be read - this has been kicked off earlier, so should be read by now addTimer(PROFILE_LOADED_TIMER_ID,PROFILE_LOADED_TIMER_TIME); #else @@ -126,7 +126,7 @@ void UIScene_SaveMessage::handleTimerComplete(int id) { case PROFILE_LOADED_TIMER_ID: { -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) C4JStorage::eOptionsCallback eStatus=app.GetOptionsCallbackStatus(0); switch(eStatus) @@ -141,13 +141,17 @@ void UIScene_SaveMessage::handleTimerComplete(int id) // set defaults - which has already been done killTimer(PROFILE_LOADED_TIMER_ID); ui.NavigateToHomeMenu(); +#ifndef DISABLE_PSN SQRNetworkManager::SafeToRespondToGameBootInvite(); +#endif app.SetOptionsCallbackStatus(0,C4JStorage::eOptions_Callback_Idle); break; case C4JStorage::eOptions_Callback_Read_CorruptDeleted: killTimer(PROFILE_LOADED_TIMER_ID); ui.NavigateToHomeMenu(); +#ifndef DISABLE_PSN SQRNetworkManager::SafeToRespondToGameBootInvite(); +#endif app.SetOptionsCallbackStatus(0,C4JStorage::eOptions_Callback_Idle); break; case C4JStorage::eOptions_Callback_Read_Corrupt: diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index 7fd06a49..151532a4 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -1518,7 +1518,8 @@ void UIScene_SkinSelectMenu::HandleDLCMountingComplete() void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) { // need to be signed in to live. get them to sign in to online -#if !defined(DISABLE_PSN) && defined(__PS3__) +#ifndef DISABLE_PSN +#if defined(__PS3__) SQRNetworkManager_PS3::AttemptPSNSignIn(NULL, this); #elif defined(__PSVITA__) @@ -1543,6 +1544,7 @@ void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) UINT uiIDA[1] = { IDS_CONFIRM_OK }; ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad ); +#endif #endif } diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index c999145d..cd8b4cd3 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -30,7 +30,6 @@ #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 @@ -43,6 +42,10 @@ #include #endif +#if defined(DISABLE_PSN) || defined(_DISABLE_XBLIVE) +#include "Common\Network\WinsockNetLayer.h" +#endif + #ifndef _DISABLE_XBLIVE #if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) #ifdef _WINDOWS64 @@ -178,9 +181,9 @@ void PIXSetMarkerDeprecated(int a, char *b, ...) {} bool IsEqualXUID(PlayerUID a, PlayerUID b) { -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) || defined(_DURANGO) || defined(_WINDOWS64) || defined(_XBOX) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) || defined(_DURANGO) || defined(_WINDOWS64) || defined(_XBOX)) return (a == b); -#elif defined(DISABLE_PSN) && defined(__PS3__) +#elif defined(DISABLE_PSN) return (a.XUID == b.XUID); #else return false; diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index f474fa65..b25f58bf 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -2044,7 +2044,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue Level2 Orbis\Iggy\include;$(ProjectDir);%(AdditionalIncludeDirectories) - SPLIT_SAVES;_LARGE_WORLDS;_EXTENDED_ACHIEVEMENTS + SPLIT_SAVES;_LARGE_WORLDS;_EXTENDED_ACHIEVEMENTS;DEBUG_MENUS_ENABLED ..\Minecraft.World\ORBIS_Release\Minecraft.World.a;Orbis\4JLibs\libs\4j_Render.a;Orbis\4JLibs\libs\4j_Input_r.a;Orbis\4JLibs\libs\4J_Storage_r.a;Orbis\4JLibs\libs\4J_Profile_r.a;Orbis\Iggy\lib\libiggy_orbis.a;Orbis\Miles\lib\mssorbis.a;Orbis\Miles\lib\binkaorbis.a;Common\Network\Sony\sceRemoteStorage\ps4\lib\sceRemoteStorage.a;-lSceGnmDriver_stub_weak;-lSceGnmx;-lSceGnm;-lSceGpuAddress;-lSceCes;-lSceVideoOut_stub_weak;-lScePad_stub_weak;-lScePngDec_stub_weak;-lScePngEnc_stub_weak;-lSceFios2_stub_weak;-lSceUlt_stub_weak;-lSceShaderBinary;-lSceUserService_stub_weak;-lSceSysmodule_stub_weak;-lSceImeDialog_stub_weak;-lScePosix_stub_weak;-lSceAudioOut_stub_weak;-lSceSaveData_stub_weak;-lSceRtc_stub_weak;-lSceSystemService_stub_weak;-lSceNetCtl_stub_weak;-lSceNpCommon_stub_weak;-lSceNpManager_stub_weak;-lSceNpToolkit;-lSceNpToolkitUtils;-lSceNpWebApi_stub_weak;-lSceNpAuth_stub_weak;-lSceNpTrophy_stub_weak;-lSceInvitationDialog_stub_weak;-lSceGameCustomDataDialog_stub_weak;-lSceNpCommerce_stub_weak;-lSceNet_stub_weak;-lSceHttp_stub_weak;-lSceSsl_stub_weak;-lSceNpMatching2_stub_weak;-lSceNpTus_stub_weak;-lSceNpUtility_stub_weak;-lSceNpScore_stub_weak;-lSceCommonDialog_stub_weak;-lSceNpSns_stub_weak;-lSceNpSnsFacebookDialog_stub_weak;-lSceRudp_stub_weak;-lSceAppContent_stub_weak;-lSceVoice_stub_weak;-lSceAudioIn_stub_weak;-lSceRemoteplay_stub_weak;-lSceSaveDataDialog_stub_weak;-lSceErrorDialog_stub_weak;-lSceMsgDialog_stub_weak;-lSceGameLiveStreaming_stub_weak;%(AdditionalDependencies) @@ -3854,7 +3854,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - true + false true true true @@ -3906,6 +3906,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse false true + true true @@ -4022,6 +4023,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse false false + true + true + true + true + true + true @@ -8383,6 +8390,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true true @@ -8458,13 +8471,13 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - false - false - false - false + true + true + true + true false - false - false + true + true true true true @@ -8521,6 +8534,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true true @@ -8554,6 +8573,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true true @@ -16429,13 +16454,13 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - true - true - true - true + false + false + false + false true - true - true + false + false true true true @@ -20918,7 +20943,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - true + false true true true @@ -20970,6 +20995,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse false true + true true @@ -21087,6 +21113,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse false false + true + true + true + true + true + true @@ -25476,13 +25508,13 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - false - false - false - false + true + true + true + true false - false - false + true + true true true true @@ -25539,6 +25571,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true true @@ -25572,6 +25610,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true true @@ -28796,13 +28840,13 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - true - true - true - true + false + false + false + false true - true - true + false + false true true true diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index ea9dedd6..7ec3330f 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -4984,12 +4984,16 @@ ColourTable *Minecraft::getColourTable() int Minecraft::MustSignInReturnedPSN(void *pParam, int iPad, C4JStorage::EMessageResult result) { Minecraft* pMinecraft = (Minecraft *)pParam; +#ifdef DISABLE_PSN + Minecraft::InGame_SignInReturned(pMinecraft, true, iPad); +#else if(result == C4JStorage::EMessage_ResultAccept) { SQRNetworkManager_Orbis::AttemptPSNSignIn(&Minecraft::InGame_SignInReturned, pMinecraft, false, iPad); } +#endif return 0; } #endif diff --git a/Minecraft.Client/Orbis/Orbis_App.cpp b/Minecraft.Client/Orbis/Orbis_App.cpp index 964796f2..7f81b331 100644 --- a/Minecraft.Client/Orbis/Orbis_App.cpp +++ b/Minecraft.Client/Orbis/Orbis_App.cpp @@ -550,7 +550,9 @@ void CConsoleMinecraftApp::CommerceTick() { SonyCommerce::ProductInfo *pProductInfo=&(pvProductList->at(j)); // just want the final 16 characters of the product id +#ifndef DISABLE_PSN RegisterDLCData(&pProductInfo->productId[20],0,pProductInfo->imageUrl); +#endif } iter++; } @@ -1068,7 +1070,9 @@ void CConsoleMinecraftApp::SystemServiceTick() { case SCE_SYSTEM_SERVICE_EVENT_GAME_CUSTOM_DATA: { +#ifndef DISABLE_PSN OrbisNPToolkit::getMessageData((SceNpGameCustomDataEventParam*)event.data.param); +#endif // Processing after invitation //SceNpSessionInvitationEventParam* pInvite = (SceNpSessionInvitationEventParam*)event.data.param; //SQRNetworkManager_Orbis::GetInviteDataAndProcess(pInvite); diff --git a/Minecraft.Client/Orbis/Orbis_Minecraft.cpp b/Minecraft.Client/Orbis/Orbis_Minecraft.cpp index b6224bd2..e1d5ffd5 100644 --- a/Minecraft.Client/Orbis/Orbis_Minecraft.cpp +++ b/Minecraft.Client/Orbis/Orbis_Minecraft.cpp @@ -39,8 +39,12 @@ #include "..\..\Minecraft.World\OldChunkStorage.h" #include "Leaderboards\OrbisLeaderboardManager.h" +#ifndef DISABLE_PSN #include "Network/Orbis_NPToolkit.h" #include "Orbis\Network\SonyVoiceChat_Orbis.h" +#else +#include "..\..\Minecraft.Client\Common\Network\WinsockNetLayer.h" +#endif #define THEME_NAME "584111F70AAAAAAA" #define THEME_FILESIZE 2797568 @@ -702,7 +706,9 @@ void RegisterAwardsWithProfileManager() // Rich Presence init - number of presences, number of contexts //printf("Rich presence strings are hard coded on PS3 for now, must change this!\n"); ProfileManager.RichPresenceInit(4,1); +#ifndef DISABLE_PSN ProfileManager.SetRichPresenceSettingFn(SQRNetworkManager_Orbis::SetRichPresence); +#endif char *pchRichPresenceString; pchRichPresenceString=(char *)AddRichPresenceString(IDS_RICHPRESENCE_GAMESTATE); @@ -949,7 +955,9 @@ int main(int argc, const char *argv[] ) #endif app.InitTime(); +#ifndef DISABLE_PSN NPToolkit.init(); +#endif // Set the number of possible joypad layouts that the user can switch between, and the number of actions InputManager.Initialise(1,5,MINECRAFT_ACTION_MAX, ACTION_MAX_MENU); @@ -1198,7 +1206,9 @@ int main(int argc, const char *argv[] ) while (TRUE) { +#ifndef DISABLE_PSN SonyVoiceChat_Orbis::tick(); +#endif RenderManager.StartFrame(); #if 0 if(pMinecraft->soundEngine->isStreamingWavebankReady() && diff --git a/Minecraft.Client/Orbis/Orbis_PlayerUID.cpp b/Minecraft.Client/Orbis/Orbis_PlayerUID.cpp index e139e0fa..1a5efb43 100644 --- a/Minecraft.Client/Orbis/Orbis_PlayerUID.cpp +++ b/Minecraft.Client/Orbis/Orbis_PlayerUID.cpp @@ -180,7 +180,7 @@ bool PlayerUID::isPrimaryUser() const /* only true if we're on the local machine - +#ifndef DISABLE_PSN GameSessionUID::GameSessionUID() { memset(this,0,sizeof(GameSessionUID)); @@ -214,4 +214,4 @@ GameSessionUID& GameSessionUID::operator=(const PlayerUID& rhs) m_bSignedIntoPSN = rhs.isSignedIntoPSN(); return *this; } - +#endif \ No newline at end of file diff --git a/Minecraft.Client/Orbis/Orbis_PlayerUID.h b/Minecraft.Client/Orbis/Orbis_PlayerUID.h index dfcc336e..fe700b72 100644 --- a/Minecraft.Client/Orbis/Orbis_PlayerUID.h +++ b/Minecraft.Client/Orbis/Orbis_PlayerUID.h @@ -20,6 +20,7 @@ class PlayerUID SceUserServiceUserId m_userID; public: + ULONGLONG XUID; class Hash { @@ -30,6 +31,8 @@ public: PlayerUID(); PlayerUID(SceUserServiceUserId userID, SceNpOnlineId& onlineID, bool bSignedInPSN, int quadrant); PlayerUID(std::wstring fromString); + PlayerUID(ULONGLONG xuid) { XUID = xuid; } + operator ULONGLONG() const { return XUID; } bool operator==(const PlayerUID& rhs) const; bool operator!=(const PlayerUID& rhs); @@ -64,7 +67,7 @@ namespace std - +#ifndef DISABLE_PSN class GameSessionUID { char m_onlineID[SCE_NP_ONLINEID_MAX_LENGTH]; @@ -83,3 +86,4 @@ public: int getQuadrant() const { return m_quadrant; } bool isSignedIntoPSN() const { return m_bSignedIntoPSN; } }; +#endif \ No newline at end of file diff --git a/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp b/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp index 4c5dd09d..c2f74e53 100644 --- a/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp +++ b/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp @@ -53,16 +53,16 @@ HRESULT PS3LeaderboardManager::destroyTransactionContext(int transactionContext) return sceNpScoreDestroyTransactionCtx(transactionContext); } -HRESULT PS3LeaderboardManager::getFriendsList(const SceNpId &myNpId, SceNpId* &npIds, uint32_t &len) -{ - EFilterMode filterMode = m_eFilterMode; - m_eFilterMode = eFM_Friends; - - HRESULT ret = fillByIdsQuery(myNpId, npIds, len); - - m_eFilterMode = filterMode; - - return ret; +HRESULT PS3LeaderboardManager::getFriendsList(const SceNpId &myNpId, SceNpId* &npIds, uint32_t &len) +{ + EFilterMode filterMode = m_eFilterMode; + m_eFilterMode = eFM_Friends; + + HRESULT ret = fillByIdsQuery(myNpId, npIds, len); + + m_eFilterMode = filterMode; + + return ret; } char *PS3LeaderboardManager::getComment(SceNpScoreComment *comment) diff --git a/Minecraft.Client/PlayerList.cpp b/Minecraft.Client/PlayerList.cpp index 4ff43f5f..08b01e62 100644 --- a/Minecraft.Client/PlayerList.cpp +++ b/Minecraft.Client/PlayerList.cpp @@ -27,7 +27,7 @@ #include "..\Minecraft.World\EntityIO.h" #if defined(_XBOX) || defined(_WINDOWS64) || defined(DISABLE_PSN) #include "Xbox\Network\NetworkPlayerXbox.h" -#elif !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) +#elif !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__)) #include "Common\Network\Sony\NetworkPlayerSony.h" #endif @@ -53,7 +53,7 @@ PlayerList::PlayerList(MinecraftServer *server) //int viewDistance = server->settings->getInt(L"view-distance", 10); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(DISABLE_PSN) || defined(_DISABLE_XBLIVE) maxPlayers = MINECRAFT_NET_MAX_PLAYERS; #else maxPlayers = server->settings->getInt(L"max-players", 20); @@ -94,7 +94,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_HOST,1); } -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__)) // PS3 networking library doesn't automatically assign PlayerUIDs to the network players for anything remote, so need to tell it what to set from the data in this packet now if( !g_NetworkManager.IsLocalGame() ) { diff --git a/Minecraft.World/ConsoleSaveFile.h b/Minecraft.World/ConsoleSaveFile.h index e4f403c8..731dc967 100644 --- a/Minecraft.World/ConsoleSaveFile.h +++ b/Minecraft.World/ConsoleSaveFile.h @@ -30,7 +30,7 @@ public: virtual vector *getFilesWithPrefix(const wstring &prefix) = 0; virtual vector *getRegionFilesByDimension(unsigned int dimensionIndex) = 0; -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) virtual wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID) = 0; virtual wstring getPlayerDataFilenameForSave(const PlayerUID& pUID) = 0; virtual vector *getValidPlayerDatFiles() = 0; diff --git a/Minecraft.World/ConsoleSaveFileConverter.cpp b/Minecraft.World/ConsoleSaveFileConverter.cpp index a509fb4f..d589b341 100644 --- a/Minecraft.World/ConsoleSaveFileConverter.cpp +++ b/Minecraft.World/ConsoleSaveFileConverter.cpp @@ -78,7 +78,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile *sourceSave, ConsoleS } // MGH added - find any player data files and copy them across -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) vector* playerFiles = sourceSave->getValidPlayerDatFiles(); #else vector *playerFiles = sourceSave->getFilesWithPrefix( DirectoryLevelStorage::getPlayerDir() ); diff --git a/Minecraft.World/ConsoleSaveFileOriginal.cpp b/Minecraft.World/ConsoleSaveFileOriginal.cpp index ec7ead0f..81775db9 100644 --- a/Minecraft.World/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/ConsoleSaveFileOriginal.cpp @@ -920,7 +920,7 @@ vector *ConsoleSaveFileOriginal::getRegionFilesByDimension(unsigned return NULL; } -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) wstring ConsoleSaveFileOriginal::getPlayerDataFilenameForLoad(const PlayerUID& pUID) { return header.getPlayerDataFilenameForLoad( pUID ); diff --git a/Minecraft.World/ConsoleSaveFileOriginal.h b/Minecraft.World/ConsoleSaveFileOriginal.h index 39a56fa9..212ca849 100644 --- a/Minecraft.World/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/ConsoleSaveFileOriginal.h @@ -65,7 +65,7 @@ public: virtual vector *getFilesWithPrefix(const wstring &prefix); virtual vector *getRegionFilesByDimension(unsigned int dimensionIndex); -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) virtual wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID); virtual wstring getPlayerDataFilenameForSave(const PlayerUID& pUID); virtual vector *getValidPlayerDatFiles(); diff --git a/Minecraft.World/DataInputStream.cpp b/Minecraft.World/DataInputStream.cpp index db9df5a5..9bf61c76 100644 --- a/Minecraft.World/DataInputStream.cpp +++ b/Minecraft.World/DataInputStream.cpp @@ -519,7 +519,7 @@ int DataInputStream::readUTFChar() PlayerUID DataInputStream::readPlayerUID() { PlayerUID returnValue; -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) for(int idPos=0;idPos player) { CompoundTag *tag = new CompoundTag(); player->saveWithoutId(tag); -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) ConsoleSavePath realFile = ConsoleSavePath( m_saveFile->getPlayerDataFilenameForSave(playerXuid).c_str() ); #elif defined(_DURANGO) ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + player->getXuid().toString() + L".dat" ); @@ -442,7 +442,7 @@ CompoundTag *DirectoryLevelStorage::load(shared_ptr player) CompoundTag *DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid) { // 4J Jev, removed try/catch. -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) ConsoleSavePath realFile = ConsoleSavePath( m_saveFile->getPlayerDataFilenameForLoad(xuid).c_str() ); #elif defined(_DURANGO) ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + xuid.toString() + L".dat" ); @@ -472,7 +472,7 @@ void DirectoryLevelStorage::clearOldPlayerFiles() { if(StorageManager.GetSaveDisabled() ) return; -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) vector *playerFiles = m_saveFile->getValidPlayerDatFiles(); #else vector *playerFiles = m_saveFile->getFilesWithPrefix( playerDir.getName() ); @@ -561,7 +561,7 @@ void DirectoryLevelStorage::resetNetherPlayerPositions() { if(app.GetResetNether()) { -#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)) vector *playerFiles = m_saveFile->getValidPlayerDatFiles(); #else vector *playerFiles = m_saveFile->getFilesWithPrefix( playerDir.getName() ); diff --git a/Minecraft.World/Minecraft.World.vcxproj b/Minecraft.World/Minecraft.World.vcxproj index 9fb68449..f9105bc4 100644 --- a/Minecraft.World/Minecraft.World.vcxproj +++ b/Minecraft.World/Minecraft.World.vcxproj @@ -1446,7 +1446,7 @@ true true Level2 - SPLIT_SAVES;_LARGE_WORLDS;_EXTENDED_ACHIEVEMENTS;_DEBUG_MENUS_ENABLED + SPLIT_SAVES;_LARGE_WORLDS;_EXTENDED_ACHIEVEMENTS;DEBUG_MENUS_ENABLED diff --git a/Minecraft.World/x64headers/extraX64.h b/Minecraft.World/x64headers/extraX64.h index 69d0b508..18f36335 100644 --- a/Minecraft.World/x64headers/extraX64.h +++ b/Minecraft.World/x64headers/extraX64.h @@ -11,7 +11,7 @@ #define MULTITHREAD_ENABLE -#ifdef __PS3__ +#if defined(__PS3__) || defined(__ORBIS__) #define DISABLE_PSN #endif @@ -35,10 +35,16 @@ const int MINECRAFT_NET_MAX_PLAYERS = 8; #include #include #include "..\..\Minecraft.Client\Orbis\Orbis_PlayerUID.h" + +#ifndef DISABLE_PSN #include "..\..\Minecraft.Client\Orbis\Network\SQRNetworkManager_Orbis.h" typedef SQRNetworkManager_Orbis::SessionID SessionID; typedef SQRNetworkManager_Orbis::PresenceSyncInfo INVITE_INFO; - +#else +typedef ULONGLONG GameSessionUID; +typedef ULONGLONG SessionID; +class INVITE_INFO; +#endif // DISABLE_PSN #elif defined __PS3__ // defined in the profile lib #include #include