diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index fb407878..dc73db51 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -6885,12 +6885,12 @@ HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGe // ignore the names if we don't recognize them if(pBannerName!=L"") { - wcsncpy_s( pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE); + wcsncpy_s( pDLCData->wchBanner, MAX_BANNERNAME_SIZE, pBannerName, MAX_BANNERNAME_SIZE); } if(pDataFile[0]!=0) { - wcsncpy_s( pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE); + wcsncpy_s( pDLCData->wchDataFile, MAX_BANNERNAME_SIZE, pDataFile, MAX_BANNERNAME_SIZE); } #endif diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Common/Network/GameNetworkManager.cpp index 53ea7a0e..0823939f 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/GameNetworkManager.cpp @@ -1847,7 +1847,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * // joinData->pInviteInfo = pInviteInfo; // tell the app to process this -#ifdef __PSVITA__ +#if !defined(DISABLE_PSN) && defined(__PSVITA__) if(((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->checkValidInviteData(pInviteInfo)) #endif { @@ -2090,7 +2090,7 @@ void CGameNetworkManager::FakeLocalPlayerJoined() } #endif -#ifdef __PSVITA__ +#if !defined(DISABLE_PSN) && defined(__PSVITA__) bool CGameNetworkManager::usingAdhocMode() { return ((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->usingAdhocMode(); @@ -2105,5 +2105,17 @@ void CGameNetworkManager::startAdhocMatching() { ((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->startAdhocMatching(); } +#else +bool CGameNetworkManager::usingAdhocMode() +{ + return false; +} +void CGameNetworkManager::setAdhocMode(bool bAdhoc) +{ +} + +void CGameNetworkManager::startAdhocMatching() +{ +} #endif diff --git a/Minecraft.Client/Common/Network/NetworkSocketLayer.cpp b/Minecraft.Client/Common/Network/NetworkSocketLayer.cpp index 22900158..62edc33f 100644 --- a/Minecraft.Client/Common/Network/NetworkSocketLayer.cpp +++ b/Minecraft.Client/Common/Network/NetworkSocketLayer.cpp @@ -4,26 +4,23 @@ #include "..\..\Common\Network\PlatformNetworkManager.h" #include "..\..\..\Minecraft.World\Socket.h" -#if defined _WINDOWS64 || defined _XBOX SOCKET NetworkSocketLayer::s_listenSocket = INVALID_SOCKET; SOCKET NetworkSocketLayer::s_hostConnectionSocket = INVALID_SOCKET; SOCKET NetworkSocketLayer::s_advertiseSock = INVALID_SOCKET; SOCKET NetworkSocketLayer::s_discoverySock = INVALID_SOCKET; -#elif defined __PS3__ || defined __ORBIS__ -SOCKET NetworkSocketLayer::s_listenSocket = -1; -SOCKET NetworkSocketLayer::s_hostConnectionSocket = -1; -SOCKET NetworkSocketLayer::s_advertiseSock = -1; -SOCKET NetworkSocketLayer::s_discoverySock = -1; -#if defined __PS3__ -int closesocket(int s) { return socketclose(s); }; +#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ +void WSACleanup() {}; +#endif + +#ifdef __PS3__ 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); }; +#else void terminate_networking() {}; #endif -void WSACleanup() {}; + +#if defined __PSVITA__ +int socket(int family, int type, int protocol) { return sceNetSocket(NULL, family, type, protocol); }; #endif C4JThread* NetworkSocketLayer::s_acceptThread = NULL; @@ -89,6 +86,19 @@ bool NetworkSocketLayer::Initialize() sys_net_finalize_network(); return false; } +#elif defined __PSVITA__ + SceNetInitParam param; + static char memory[16 * 1024]; + + param.memory = memory; + param.size = sizeof(memory); + param.flags = 0; + + int result = sceNetInit(¶m); + if (result < 0) { + app.DebugPrintf("sceNetInit failed: %d\n", result); + return false; + } #endif InitializeCriticalSection(&s_sendLock); @@ -125,7 +135,7 @@ void NetworkSocketLayer::Shutdown() closesocket(s_hostConnectionSocket); s_hostConnectionSocket = INVALID_SOCKET; } -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (s_listenSocket >= 0) { socketclose(s_listenSocket); @@ -146,7 +156,7 @@ void NetworkSocketLayer::Shutdown() s_connections[i].active = false; #if defined _WINDOWS64 || defined _XBOX if (s_connections[i].tcpSocket != INVALID_SOCKET) -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (s_connections[i].tcpSocket >= 0) #endif { @@ -238,8 +248,12 @@ bool NetworkSocketLayer::HostGame(int port) app.DebugPrintf("socket() failed: %d\n", WSAGetLastError()); return false; } -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ +#ifdef __PSVITA__ + SceNetSockaddrIn addr = {}; +#else struct sockaddr_in addr = {}; +#endif addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(INADDR_ANY); addr.sin_port = htons((uint16_t)port); @@ -292,8 +306,12 @@ bool NetworkSocketLayer::HostGame(int port) s_listenSocket = INVALID_SOCKET; return false; } -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ +#ifdef __PSVITA__ + iResult = ::bind(s_listenSocket, (const sockaddr*)&addr, sizeof(addr)); +#else iResult = ::bind(s_listenSocket, (struct sockaddr*)&addr, sizeof(addr)); +#endif if (iResult < 0) { app.DebugPrintf("bind() failed: %d\n", iResult); @@ -546,14 +564,18 @@ bool NetworkSocketLayer::JoinGame(const char *ip, int port) connected = true; break; } -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (s_hostConnectionSocket != -1) { socketclose(s_hostConnectionSocket); s_hostConnectionSocket = -1; } +#ifdef __PSVITA__ + SceNetSockaddrIn addr = {}; +#else struct sockaddr_in addr = {}; +#endif addr.sin_family = AF_INET; addr.sin_port = htons((uint16_t)port); @@ -590,40 +612,47 @@ bool NetworkSocketLayer::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 +#ifdef __PSVITA__ + iResult = connect(s_hostConnectionSocket, (const SceNetSockaddr*)&addr, sizeof(addr)); +#else iResult = connect(s_hostConnectionSocket, (struct sockaddr*)&addr, sizeof(addr)); +#endif 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 +#ifndef __PSVITA__ fd_set writeFds, exceptFds; FD_ZERO(&writeFds); FD_ZERO(&exceptFds); FD_SET(s_hostConnectionSocket, &writeFds); FD_SET(s_hostConnectionSocket, &exceptFds); - struct timeval tv; 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); +#else + SceNetId eid = sceNetEpollCreate(NULL, 0); + SceNetEpollEvent ev = {}; + ev.events = SCE_NET_EPOLLOUT; + ev.data.fd = s_hostConnectionSocket; + sceNetEpollControl(eid, SCE_NET_EPOLL_CTL_ADD, s_hostConnectionSocket, &ev); + int timeoutUsec = connectTimeoutMs * 1000; + SceNetEpollEvent outEvents[1]; + int selectResult = sceNetEpollWait(eid, outEvents, 1, timeoutUsec); + sceNetEpollControl(eid, SCE_NET_EPOLL_CTL_DEL, s_hostConnectionSocket, NULL); + sceNetEpollDestroy(eid); #endif + +#ifndef __PSVITA__ + int selectResult = socketselect(s_hostConnectionSocket + 1, NULL, &writeFds, &exceptFds, &tv); if (selectResult <= 0 || FD_ISSET(s_hostConnectionSocket, &exceptFds)) +#else + if (selectResult <= 0 || (selectResult > 0) && + (outEvents[0].events & (SCE_NET_EPOLLERR | SCE_NET_EPOLLHUP))) +#endif { app.DebugPrintf("connect() to %s:%d timed out or failed (attempt %d/%d)\n", ip, port, attempt + 1, maxAttempts); closesocket(s_hostConnectionSocket); @@ -654,7 +683,7 @@ bool NetworkSocketLayer::JoinGame(const char *ip, int port) int blocking = 0; #ifdef __PS3__ setsockopt(s_hostConnectionSocket, SOL_SOCKET, SO_NBIO, &blocking, sizeof(blocking)); -#elif defined(__ORBIS__) +#elif defined(__ORBIS__) || defined __PSVITA__ setsockopt(s_hostConnectionSocket, SOL_SOCKET, SCE_NET_SO_NBIO, &blocking, sizeof(blocking)); #endif @@ -708,7 +737,7 @@ bool NetworkSocketLayer::SendOnSocket(SOCKET sock, const void *data, int dataSiz { #if defined _WINDOWS64 || defined _XBOX if (sock == INVALID_SOCKET || dataSize <= 0) return false; -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (sock < 0 || dataSize <= 0) return false; #endif @@ -727,7 +756,7 @@ bool NetworkSocketLayer::SendOnSocket(SOCKET sock, const void *data, int dataSiz 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__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (sent < 0 || sent == 0) #endif { @@ -744,7 +773,7 @@ bool NetworkSocketLayer::SendOnSocket(SOCKET sock, const void *data, int dataSiz #if defined _WINDOWS64 || defined _XBOX if (sent == SOCKET_ERROR || sent == 0) -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (sent < 0 || sent == 0) #endif { @@ -767,7 +796,7 @@ bool NetworkSocketLayer::SendToSmallId(BYTE targetSmallId, const void *data, int SOCKET sock = GetSocketForSmallId(targetSmallId); #if defined _WINDOWS64 || defined _XBOX if (sock == INVALID_SOCKET) return false; -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (sock < 0) return false; #endif return SendOnSocket(sock, data, dataSize); @@ -793,7 +822,7 @@ SOCKET NetworkSocketLayer::GetSocketForSmallId(BYTE smallId) LeaveCriticalSection(&s_connectionsLock); #if defined _WINDOWS64 || defined _XBOX return INVALID_SOCKET; -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ return -1; #endif } @@ -835,7 +864,11 @@ int NetworkSocketLayer::AcceptThreadProc(LPVOID param) { while (s_active) { +#ifdef __PSVITA__ + SOCKET clientSocket = accept(s_listenSocket, (SceNetSockaddr *)NULL, NULL); +#else SOCKET clientSocket = accept(s_listenSocket, NULL, NULL); +#endif #if defined _WINDOWS64 || defined _XBOX if (clientSocket == INVALID_SOCKET) { @@ -843,7 +876,7 @@ int NetworkSocketLayer::AcceptThreadProc(LPVOID param) app.DebugPrintf("accept() failed: %d\n", WSAGetLastError()); break; } -#elif __PS3__ || defined __ORBIS__ +#elif __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (clientSocket < 0) { if (s_active) @@ -1050,7 +1083,7 @@ int NetworkSocketLayer::ClientRecvThreadProc(LPVOID param) #if defined _WINDOWS64 || defined _XBOX while (s_active && s_hostConnectionSocket != INVALID_SOCKET) -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ while (s_active && s_hostConnectionSocket >= 0) #endif { @@ -1115,7 +1148,7 @@ bool NetworkSocketLayer::StartAdvertising(int gamePort, const wchar_t *hostName, app.DebugPrintf("Win64 LAN: Failed to create advertise socket: %d\n", WSAGetLastError()); return false; } -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (s_advertiseSock < 0) { app.DebugPrintf("PS3 LAN: Failed to create advertise socket: %d\n", s_advertiseSock); @@ -1143,7 +1176,7 @@ void NetworkSocketLayer::StopAdvertising() closesocket(s_advertiseSock); s_advertiseSock = INVALID_SOCKET; } -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (s_advertiseSock >= 0) { closesocket(s_advertiseSock); @@ -1187,7 +1220,11 @@ void NetworkSocketLayer::UpdateAdvertiseJoinable(bool joinable) int NetworkSocketLayer::AdvertiseThreadProc(LPVOID param) { +#ifdef __PSVITA__ + SceNetSockaddrIn broadcastAddr; +#else struct sockaddr_in broadcastAddr; +#endif memset(&broadcastAddr, 0, sizeof(broadcastAddr)); broadcastAddr.sin_family = AF_INET; broadcastAddr.sin_port = htons(NETWORK_LAN_DISCOVERY_PORT); @@ -1205,15 +1242,20 @@ int NetworkSocketLayer::AdvertiseThreadProc(LPVOID param) data.gameHostSettings = htonl(data.gameHostSettings); data.texturePackParentId = htonl(data.texturePackParentId); +#ifdef __PSVITA__ + int sent = sendto(s_advertiseSock, (const char *)&data, sizeof(data), 0, + (const sockaddr *)&broadcastAddr, sizeof(broadcastAddr)); +#else int sent = sendto(s_advertiseSock, (const char *)&data, sizeof(data), 0, (struct sockaddr *)&broadcastAddr, sizeof(broadcastAddr)); +#endif #if defined _WINDOWS64 || defined _XBOX if (sent == SOCKET_ERROR && s_advertising) { app.DebugPrintf("Win64 LAN: Broadcast sendto failed: %d\n", WSAGetLastError()); } -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (sent < 0 && s_advertising) { app.DebugPrintf("PS3 LAN: Broadcast sendto failed: %d\n", sent); @@ -1238,7 +1280,7 @@ bool NetworkSocketLayer::StartDiscovery() app.DebugPrintf("Win64 LAN: Failed to create discovery socket: %d\n", WSAGetLastError()); return false; } -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ app.DebugPrintf("Discovery socket: %d\n", s_discoverySock); if (s_discoverySock < 0) { @@ -1250,8 +1292,12 @@ bool NetworkSocketLayer::StartDiscovery() BOOL reuseAddr = TRUE; setsockopt(s_discoverySock, SOL_SOCKET, SO_REUSEADDR, (const char *)&reuseAddr, sizeof(reuseAddr)); - + +#ifdef __PSVITA__ + SceNetSockaddrIn bindAddr; +#else struct sockaddr_in bindAddr; +#endif memset(&bindAddr, 0, sizeof(bindAddr)); bindAddr.sin_family = AF_INET; bindAddr.sin_port = htons(NETWORK_LAN_DISCOVERY_PORT); @@ -1265,14 +1311,15 @@ bool NetworkSocketLayer::StartDiscovery() s_discoverySock = INVALID_SOCKET; return false; } -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ +#ifdef __PSVITA__ + if (::bind(s_discoverySock, (const sockaddr *)&bindAddr, sizeof(bindAddr)) < 0) + { +#else 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 + app.DebugPrintf("PS3 LAN: Discovery bind failed: %d\n", sys_net_errno); socketclose(s_discoverySock); s_discoverySock = -1; return false; @@ -1299,7 +1346,7 @@ void NetworkSocketLayer::StopDiscovery() closesocket(s_discoverySock); s_discoverySock = INVALID_SOCKET; } -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (s_discoverySock >= 0) { socketclose(s_discoverySock); @@ -1337,22 +1384,31 @@ int NetworkSocketLayer::DiscoveryThreadProc(LPVOID param) while (s_discovering) { +#ifdef __PSVITA__ + SceNetSockaddrIn senderAddr; +#else struct sockaddr_in senderAddr; +#endif #if defined _WINDOWS64 || defined _XBOX int senderLen = sizeof(senderAddr); -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ socklen_t senderLen = sizeof(senderAddr); #endif +#ifdef __PSVITA__ + int recvLen = recvfrom(s_discoverySock, recvBuf, sizeof(recvBuf), 0, + (sockaddr *)&senderAddr, &senderLen); +#else int recvLen = recvfrom(s_discoverySock, recvBuf, sizeof(recvBuf), 0, (struct sockaddr *)&senderAddr, &senderLen); +#endif #ifdef _WINDOWS64 if (recvLen == SOCKET_ERROR) { continue; } -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ if (recvLen < 0) { continue; diff --git a/Minecraft.Client/Common/Network/NetworkSocketLayer.h b/Minecraft.Client/Common/Network/NetworkSocketLayer.h index 823cfeee..3b415b5d 100644 --- a/Minecraft.Client/Common/Network/NetworkSocketLayer.h +++ b/Minecraft.Client/Common/Network/NetworkSocketLayer.h @@ -7,7 +7,7 @@ #include #include #include -#elif defined __PS3__ || defined __ORBIS__ +#elif defined __PS3__ || defined __ORBIS__ #include #include #include @@ -16,6 +16,8 @@ #include #include #include +#elif defined __PSVITA__ +#include #endif #ifdef __PS3__ @@ -37,8 +39,63 @@ #define NETWORK_LAN_DISCOVERY_PORT 25566 #define NETWORK_LAN_BROADCAST_MAGIC 0x4D434C4E -#if defined __PS3__ || defined __ORBIS__ +#ifdef __PS3__ typedef int SOCKET; +#define INVALID_SOCKET -1 +#define closesocket socketclose +#define +#elif defined(__ORBIS__) +typedef int SOCKET; +#define INVALID_SOCKET -1 +#define SO_NBIO SCE_NET_SO_NBIO +#define sys_net_errno sce_net_errno +#define SYS_NET_EINPROGRESS SCE_NET_EINPROGRESS +#define socketselect select +#define closesocket sceNetSocketClose +#define socketclose sceNetSocketClose +#elif defined(__PSVITA__) +typedef SceNetId SOCKET; +typedef SceNetSockaddr sockaddr; +typedef SceNetSocklen_t socklen_t; + +#define getsockopt sceNetGetsockopt +#define setsockopt sceNetSetsockopt +#define recv sceNetRecv +#define send sceNetSend +#define bind sceNetBind +#define sendto sceNetSendto +#define recvfrom sceNetRecvfrom +#define listen sceNetListen +#define connect sceNetConnect +#define accept sceNetAccept +#define closesocket sceNetSocketClose +#define socketclose sceNetSocketClose +#define inet_ntop sceNetInetNtop + +#define SOL_SOCKET SCE_NET_SOL_SOCKET +#define AF_INET SCE_NET_AF_INET +#define SOCK_STREAM SCE_NET_SOCK_STREAM +#define sys_net_errno sce_net_errno +#define SYS_NET_EINPROGRESS SCE_NET_EINPROGRESS + +#define htonl sceNetHtonl +#define htons sceNetHtons +#define ntohl sceNetNtohl +#define ntohs sceNetNtohs + +#define SO_BROADCAST SCE_NET_SO_BROADCAST +#define SO_ERROR SCE_NET_SO_ERROR +#define SO_RCVTIMEO SCE_NET_SO_RCVTIMEO +#define SO_REUSEADDR SCE_NET_SO_REUSEADDR +#define SO_NBIO SCE_NET_SO_NBIO +#define SOCK_DGRAM SCE_NET_SOCK_DGRAM + +#define INADDR_ANY SCE_NET_INADDR_ANY +#define IPPROTO_TCP SCE_NET_IPPROTO_TCP +#define IPPROTO_UDP SCE_NET_IPPROTO_UDP +#define TCP_NODELAY SCE_NET_TCP_NODELAY +#define INADDR_BROADCAST SCE_NET_INADDR_BROADCAST + #define INVALID_SOCKET -1 #endif diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManager.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManager.cpp index 59ce1a0b..6b8040a4 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManager.cpp @@ -768,7 +768,7 @@ void CPlatformNetworkManagerStub::SearchForGames() } } -#ifdef __ORBIS__ +#if defined(__ORBIS__) || defined(__PSVITA__) 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)); diff --git a/Minecraft.Client/Common/Network/SessionInfo.h b/Minecraft.Client/Common/Network/SessionInfo.h index b48ecbae..eb9a42a6 100644 --- a/Minecraft.Client/Common/Network/SessionInfo.h +++ b/Minecraft.Client/Common/Network/SessionInfo.h @@ -1,6 +1,6 @@ #pragma once -#if defined(__PS3__) || defined(__ORBIS__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__)) #include "..\..\Common\Network\Sony\SQRNetworkManager.h" #endif diff --git a/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.h b/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.h index 5bb66875..9251da76 100644 --- a/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.h +++ b/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.h @@ -80,7 +80,6 @@ public: bool inviteOnly; }; - // Externally exposed state. All internal states are mapped to one of these broader states. typedef enum { @@ -324,4 +323,4 @@ public: virtual void HandleAddLocalPlayerFailed(int idx) = 0; virtual void HandleDisconnect(bool bLostRoomOnly,bool bPSNSignOut=false) = 0; virtual void HandleInviteReceived( int userIndex, const SQRNetworkManager::PresenceSyncInfo *pInviteInfo) = 0; -}; +}; \ No newline at end of file diff --git a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h index d1baab8c..1c1acc38 100644 --- a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h +++ b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.h @@ -124,7 +124,7 @@ class SQRNetworkPlayer int GetTotalSendQueueMessages(); -#ifdef __PSVITA__ +#if !defined(DISABLE_PSN) && defined(__PSVITA__) void SendInternal_VitaAdhoc(const void *data, unsigned int dataSize, EAdhocDataTag tag = e_dataTag_Normal); void SendMoreInternal_VitaAdhoc(); #endif diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp index ce0b56a8..9e8a6b92 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp @@ -13,7 +13,7 @@ #include "..\..\..\Minecraft.World\LevelType.h" #include "..\..\DLCTexturePack.h" -#ifdef __PSVITA__ +#if !defined(DISABLE_PSN) && defined(__PSVITA__) #include "PSVita\Network\SQRNetworkManager_AdHoc_Vita.h" #endif @@ -1044,7 +1044,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD #endif bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; -#ifdef __PSVITA__ +#if !defined DISABLE_PSN && defined __PSVITA__ if(CGameNetworkManager::usingAdhocMode()) { if(SQRNetworkManager_AdHoc_Vita::GetAdhocStatus())// && pClass->m_MoreOptionsParams.bOnlineGame) diff --git a/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp index b2147311..6c01f785 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp @@ -201,7 +201,7 @@ void UIScene_DLCMainMenu::tick() { UIScene::tick(); -#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)) if((m_bCategoriesShown==false) && (app.GetCommerceCategoriesRetrieved())) { // disable the timer display on this menu diff --git a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp index cf08371b..c4cad811 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp @@ -6,7 +6,7 @@ #include "Common\Network\Sony\SonyHttp.h" #endif -#ifdef __PSVITA__ +#if !defined(DISABLE_PSN) && defined(__PSVITA__) #include "PSVita\Network\SonyCommerce_Vita.h" #endif @@ -335,7 +335,7 @@ void UIScene_DLCOffersMenu::tick() { UIScene::tick(); -#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) +#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)) if(m_bAddAllDLCButtons) { @@ -506,7 +506,7 @@ void UIScene_DLCOffersMenu::tick() } else { -#ifdef __PSVITA__ +#if !defined(DISABLE_PSN) && defined(__PSVITA__) // MGH - fixes bug 5768 on Vita - should be extended properly to work for other platforms if((SonyCommerce_Vita::getPurchasabilityUpdated()) && app.GetCommerceProductListRetrieved()&& app.GetCommerceProductListInfoRetrieved() && m_iTotalDLC > 0) { diff --git a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp index b55ee5fc..ba8870e2 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp @@ -532,7 +532,7 @@ int UIScene_InGameInfoMenu::ViewInvites_SignInReturned(void *pParam,bool bContin #elif 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); -#else // __PSVITA__ +#elif !defined(DISABLE_PSN) // __PSVITA__ SQRNetworkManager_Vita::RecvInviteGUI(); #endif } diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp index 86b3806b..a107ed63 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp @@ -458,7 +458,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) #ifndef DISABLE_PSN isSignedInLive = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()); #endif -#ifdef __PSVITA__ +#if !defined DISABLE_PSN && defined __PSVITA__ if(CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) isSignedInLive = true; #endif diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp index cf5afce4..27c961af 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp @@ -1550,7 +1550,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal } bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; -#ifdef __PSVITA__ +#if !defined DISABLE_PSN && defined __PSVITA__ if(CGameNetworkManager::usingAdhocMode()) { if(SQRNetworkManager_AdHoc_Vita::GetAdhocStatus())// && pClass->m_MoreOptionsParams.bOnlineGame) diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index 39bba779..94c8d8c2 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -181,7 +181,7 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer Initialise(); -#ifdef __PSVITA__ +#if !defined DISABLE_PSN && defined __PSVITA__ if(CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) { g_NetworkManager.startAdhocMatching(); // create the client matching context and clear out the friends list @@ -1552,7 +1552,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) return; } -#ifdef __PSVITA__ +#if !defined DISABLE_PSN && defined __PSVITA__ if(CGameNetworkManager::usingAdhocMode() && !SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) { // not connected to adhoc anymore, must have connected back to PSN to buy texture pack so sign in again @@ -2225,6 +2225,9 @@ int UIScene_LoadOrJoinMenu::MustSignInTexturePack(void *pParam,int iPad,C4JStora { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; +#ifdef DISABLE_PSN + UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(pClass, true, iPad); +#else if(result==C4JStorage::EMessage_ResultAccept) { SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack, pClass); @@ -2234,6 +2237,7 @@ int UIScene_LoadOrJoinMenu::MustSignInTexturePack(void *pParam,int iPad,C4JStora pClass->m_bIgnoreInput = false; } +#endif return 0; } diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp index c9251291..f7ec3409 100644 --- a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp @@ -740,7 +740,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in if(ProfileManager.IsFullVersion()) { bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); -#ifdef __PSVITA__ +#if !defined DISABLE_PSN && defined __PSVITA__ if(CGameNetworkManager::usingAdhocMode()) { if(SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) @@ -1327,7 +1327,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { // are we offline? bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); -#ifdef __PSVITA__ +#if !defined DISABLE_PSN && defined __PSVITA__ if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_PSVita_NetworkModeAdhoc) == true) { CGameNetworkManager::setAdhocMode(true); diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index 151532a4..86f3b87a 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -1703,12 +1703,16 @@ int UIScene_SkinSelectMenu::MustSignInReturned(void *pParam,int iPad,C4JStorage: { if(result==C4JStorage::EMessage_ResultAccept) { +#ifdef DISABLE_PSN + UIScene_SkinSelectMenu::PSNSignInReturned(pParam, true, iPad); +#else #ifdef __PS3__ SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_SkinSelectMenu::PSNSignInReturned, pParam,true); #elif defined __PSVITA__ SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_SkinSelectMenu::PSNSignInReturned, pParam,true); #elif defined __ORBIS__ SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_SkinSelectMenu::PSNSignInReturned, pParam,true); +#endif #endif } return 0; diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index 50472670..31e040ea 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -479,7 +479,7 @@ true - $(SCE_PSP2_SDK_DIR)/target\src\npToolkit\include;$(ProjectDir)..\Minecraft.Client\PSVita\Assert;$(ProjectDir);$(ProjectDir)..\Minecraft.World\x64headers;$(ProjectDir)\..\Minecraft.Client\PSVita\PSVitaExtras + $(SCE_PSP2_SDK_DIR)/target\src\npToolkit\include;$(ProjectDir)..\Minecraft.Client\PSVita\Assert;$(ProjectDir);$(ProjectDir)..\Minecraft.World\x64headers;$(ProjectDir)\..\Minecraft.Client\PSVita\PSVitaExtras;$(SCE_PSP2_SDK_DIR)\host_tools\build\include;$(SCE_PSP2_SDK_DIR)\target\include;$(SCE_PSP2_SDK_DIR)\target\include_common; true @@ -2230,7 +2230,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU true $(OutDir)$(ProjectName).pdb - -lSceDbg_stub;-lSceGxm_stub;-lSceAppUtil_stub;-lSceCommonDialog_stub;-lSceDisplay_stub;-lSceTouch_stub;-lSceCtrl_stub;-lSceAudio_stub;-lSceDbgFont;-lSceRazorCapture_stub_weak;-lSceSysmodule_stub;-lSceDeflt;-lScePng;$(OutDir)Minecraft.World.a;libSceRtc_stub.a;libSceFios2_stub_weak.a;libSceCes.a;libScePerf_stub.a;libScePerf_stub_weak.a;libSceUlt_stub.a;libSceUlt_stub_weak.a;libSceNpManager_stub_weak.a;libSceNpCommon_stub_weak.a;libSceHttp_stub.a;libSceNpTrophy_stub.a;libSceNpScore_stub.a;libSceRudp_stub_weak.a;libSceVoice_stub.a;libSceNetAdhocMatching_stub.a;libScePspnetAdhoc_stub.a;libScePower_stub.a;libSceAppUtil_stub.a;libSceAppMgr_stub.a;..\Minecraft.Client\PSVita\Miles\lib\msspsp2.a;..\Minecraft.Client\PSVita\Miles\lib\binkapsp2.a;..\Minecraft.Client\PSVita\Miles\lib\msspsp2midi.a;..\Minecraft.Client\PSVita\Miles\lib\fltpsp2.a;..\Minecraft.Client\Common\Network\Sony\sceRemoteStorage\psvita\lib\sceRemoteStorage.a + -lSceNet_stub;-lSceDbg_stub;-lSceGxm_stub;-lSceAppUtil_stub;-lSceCommonDialog_stub;-lSceDisplay_stub;-lSceTouch_stub;-lSceCtrl_stub;-lSceAudio_stub;-lSceDbgFont;-lSceNet_stub_weak;-lSceRazorCapture_stub_weak;-lSceSysmodule_stub;-lSceDeflt;-lScePng;$(OutDir)Minecraft.World.a;libSceNet_stub.a;libSceNet_stub_weak.a;libSceRtc_stub.a;libSceFios2_stub_weak.a;libSceCes.a;libScePerf_stub.a;libScePerf_stub_weak.a;libSceUlt_stub.a;libSceUlt_stub_weak.a;libSceNpManager_stub_weak.a;libSceNpCommon_stub_weak.a;libSceHttp_stub.a;libSceNpTrophy_stub.a;libSceNpScore_stub.a;libSceRudp_stub_weak.a;libSceVoice_stub.a;libSceNetAdhocMatching_stub.a;libScePspnetAdhoc_stub.a;libScePower_stub.a;libSceAppUtil_stub.a;libSceAppMgr_stub.a;..\Minecraft.Client\PSVita\Miles\lib\msspsp2.a;..\Minecraft.Client\PSVita\Miles\lib\binkapsp2.a;..\Minecraft.Client\PSVita\Miles\lib\msspsp2midi.a;..\Minecraft.Client\PSVita\Miles\lib\fltpsp2.a;..\Minecraft.Client\Common\Network\Sony\sceRemoteStorage\psvita\lib\sceRemoteStorage.a StripFuncsAndData --strip-duplicates None @@ -3835,6 +3835,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true @@ -3849,18 +3855,18 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse true true - true + false true - true + false true - true + false true - true + false true - true + false false true - true + false true true true @@ -3888,12 +3894,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - false - false - false - false - false - false + true + true + true + true + true + true true @@ -3910,12 +3916,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - false - false - false - false - false - false + true + true + true + true + true + true true true @@ -4005,12 +4011,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - false - false - false - false - false - false + true + true + true + true + true + true true @@ -4027,12 +4033,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - false - false - false - false - false - false + true + true + true + true + true + true false true true @@ -14026,6 +14032,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true true @@ -14182,6 +14194,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true true @@ -14219,6 +14237,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true true @@ -14256,6 +14280,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true @@ -15598,18 +15628,18 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse false true - true + false true - true + false true - true + false true - true + false true true - true + false true - true + false true true true @@ -16479,12 +16509,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - true - true - true - true - true - true + false + false + false + false + false + false false false false @@ -20927,6 +20957,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true @@ -20938,18 +20974,18 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse true true - true + false true - true + false true - true + false true - true + false true - true + false false true - true + false true true true @@ -20977,12 +21013,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - false - false - false - false - false - false + true + true + true + true + true + true true @@ -20999,12 +21035,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - false - false - false - false - false - false + true + true + true + true + true + true true true @@ -21081,12 +21117,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse false false - false - false - false - false - false - false + true + true + true + true + true + true true true true @@ -21117,12 +21153,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - false - false - false - false - false - false + true + true + true + true + true + true false true true @@ -27455,6 +27491,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true true @@ -27492,6 +27534,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true true @@ -27646,6 +27694,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true true @@ -27683,6 +27737,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true true @@ -27720,6 +27780,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true + true + true + true + true + true + true @@ -28508,18 +28574,18 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse false true - true + false true - true + false true - true + false true - true + false true - true + false true true - true + false true true true @@ -28865,12 +28931,12 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true true - true - true - true - true - true - true + false + false + false + false + false + false false false false diff --git a/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h b/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h index a3a487fe..d7df4413 100644 --- a/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h @@ -24,6 +24,7 @@ class PlayerUID int m_userID; // user logged on to the XMB public: + ULONGLONG XUID; class Hash { @@ -34,6 +35,8 @@ public: PlayerUID(); PlayerUID(int 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); @@ -56,6 +59,7 @@ private: typedef PlayerUID *PPlayerUID; +#ifndef DISABLE_PSN class GameSessionUID { char m_onlineID[SCE_NP_ONLINEID_MAX_LENGTH]; @@ -76,6 +80,7 @@ public: void setForAdhoc(); }; +#endif enum eAwardType { diff --git a/Minecraft.Client/PSVita/PSVita_App.cpp b/Minecraft.Client/PSVita/PSVita_App.cpp index 790debd0..3bee4de3 100644 --- a/Minecraft.Client/PSVita/PSVita_App.cpp +++ b/Minecraft.Client/PSVita/PSVita_App.cpp @@ -14,13 +14,18 @@ #include "PSVita\Network\SonyRemoteStorage_Vita.h" #include "PSVita\Network\SonyCommerce_Vita.h" #include "..\..\Common\Network\Sony\SonyRemoteStorage.h" -#include "PSVita/Network/PSVita_NPToolkit.h" #include #include #include "Common\UI\UI.h" #include "PSVita\PSVitaExtras\PSVitaStrings.h" +#ifndef DISABLE_PSN +#include "PSVita/Network/PSVita_NPToolkit.h" +#endif + +#ifndef DISABLE_PSN #define VITA_COMMERCE_ENABLED +#endif CConsoleMinecraftApp app; CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp() @@ -1021,6 +1026,7 @@ void CConsoleMinecraftApp::AppEventTick() res = sceAppUtilReceiveAppEvent(&eventParam); if (res == SCE_OK) { +#ifndef DISABLE_PSN if (SCE_APPUTIL_APPEVENT_TYPE_NP_APP_DATA_MESSAGE == eventParam.type) { PSVitaNPToolkit::getMessageData(&eventParam); @@ -1035,6 +1041,7 @@ void CConsoleMinecraftApp::AppEventTick() app.DebugPrintf("unknown app event : 0x%08x\n", eventParam.type); assert(0); } +#endif } } @@ -1073,6 +1080,7 @@ void CConsoleMinecraftApp::AppEventTick() bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad) { +#ifdef VITA_COMMERCE SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo(); bool bEmptyStore=true; @@ -1102,6 +1110,9 @@ bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad) } return bEmptyStore; +#else + return true; +#endif } diff --git a/Minecraft.Client/PSVita/PSVita_Minecraft.cpp b/Minecraft.Client/PSVita/PSVita_Minecraft.cpp index 7edc1687..e4a32956 100644 --- a/Minecraft.Client/PSVita/PSVita_Minecraft.cpp +++ b/Minecraft.Client/PSVita/PSVita_Minecraft.cpp @@ -3,7 +3,12 @@ #include "stdafx.h" +#ifndef DISABLE_PSN #include "Leaderboards\PSVitaLeaderboardManager.h" +#include "Common\Network\Sony\SQRNetworkManager.h" +#include "PSVita/Network/PSVita_NPToolkit.h" +#include "PSVita\Network\SonyVoiceChat_Vita.h" +#endif #include "PSVita\PSVitaExtras\ShutdownManager.h" //#define HEAPINSPECTOR_PS3 1 @@ -54,12 +59,10 @@ #include "..\..\Minecraft.World\OldChunkStorage.h" //#include "PS3\PS3Extras\EdgeZLib.h" #include "..\..\Minecraft.World\C4JThread.h" -#include "Common\Network\Sony\SQRNetworkManager.h" #include "Common\UI\IUIScene_PauseMenu.h" #include "Conf.h" -#include "PSVita/Network/PSVita_NPToolkit.h" -#include "PSVita\Network\SonyVoiceChat_Vita.h" #include "..\..\Minecraft.World\FireworksRecipe.h" +#include "..\..\Minecraft.Client\Common\Network\NetworkSocketLayer.h" #include #include @@ -376,7 +379,9 @@ void RegisterAwardsWithProfileManager() ProfileManager.RichPresenceInit(4,1); //Chris TODO +#ifndef DISABLE_PSN ProfileManager.SetRichPresenceSettingFn(SQRNetworkManager_Vita::SetRichPresence); +#endif char *pchRichPresenceString; pchRichPresenceString=(char *)AddRichPresenceString(IDS_RICHPRESENCE_GAMESTATE); @@ -517,7 +522,9 @@ int main() } app.InitTime(); +#ifndef DISABLE_PSN PSVitaNPToolkit::init(); +#endif // initialise the storage manager with a default save display name, a Minimum save size, and a callback for displaying the saving message StorageManager.Init( 0, L"savegame.dat", "savePackName", FIFTY_ONE_MB, &CConsoleMinecraftApp::DisplaySavingMessage, (LPVOID)&app, NULL); @@ -759,6 +766,7 @@ int main() // XN_SYS_SIGNINCHANGED notifications. This does mean that we need to have a callback in the // ProfileManager for XN_LIVE_INVITE_ACCEPTED for QNet. g_NetworkManager.Initialise(); + NetworkSocketLayer::Initialize(); g_NetworkManager.SetLocalGame(true); // Set the default sound levels @@ -796,8 +804,9 @@ int main() #endif while( true ) { +#ifndef DISABLE_PSN SonyVoiceChat_Vita::tick(); - +#endif RenderManager.StartFrame(); #if 0 if(pMinecraft->soundEngine->isStreamingWavebankReady() && @@ -846,7 +855,9 @@ int main() g_NetworkManager.DoWork(); PIXEndNamedEvent(); +#ifndef DISABLE_PSN LeaderboardManager::Instance()->Tick(); +#endif // Render game graphics. if(app.GetGameStarted()) { diff --git a/Minecraft.World/x64headers/extraX64.h b/Minecraft.World/x64headers/extraX64.h index 18f36335..d384cbe7 100644 --- a/Minecraft.World/x64headers/extraX64.h +++ b/Minecraft.World/x64headers/extraX64.h @@ -11,7 +11,7 @@ #define MULTITHREAD_ENABLE -#if defined(__PS3__) || defined(__ORBIS__) +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) #define DISABLE_PSN #endif @@ -67,11 +67,18 @@ class INVITE_INFO; #include #include #include -#include "..\..\Minecraft.Client\PSVita\Network\SQRNetworkManager_Vita.h" -#include "..\..\Minecraft.Client\PSVita\Network\SQRNetworkManager_AdHoc_Vita.h" #include "..\..\Minecraft.Client\PSVita\4JLibs\inc\4J_Profile.h" + +#ifndef DISABLE_PSN +#include "..\..\Minecraft.Client\PSVita\Network\SQRNetworkManager_AdHoc_Vita.h" +#include "..\..\Minecraft.Client\PSVita\Network\SQRNetworkManager_Vita.h" typedef SQRNetworkManager_Vita::SessionID SessionID; typedef SQRNetworkManager_Vita::PresenceSyncInfo INVITE_INFO; +#else +typedef ULONGLONG GameSessionUID; +typedef ULONGLONG SessionID; +class INVITE_INFO; +#endif #elif defined _DURANGO #include "..\..\Minecraft.Client\Durango\4JLibs\inc\4J_Profile.h"