rebase for the 4th time

This commit is contained in:
NaN
2026-08-04 18:43:48 -04:00
72 changed files with 1214 additions and 489 deletions
-8
View File
@@ -4,14 +4,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonMedia", "CommonMedia.vcxproj", "{21BBD32C-AF5E-4741-8B80-3B73FC0D0F27}"
EndProject
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = http://tfs_server:8080/tfs/storiespark
SccProjectUniqueName0 = CommonMedia.vcxproj
SccLocalPath0 = .
SccLocalPath1 = .
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
+9 -1
View File
@@ -4419,7 +4419,7 @@ int CMinecraftApp::EthernetDisconnectReturned(void *pParam,int iPad,const C4JSto
// 4J-PB - turn off the PSN store icon just in case this happened when we were in one of the DLC menus
#ifdef __ORBIS__
sceNpCommerceHidePsStoreIcon();
#elif defined __PSVITA__
#elif defined(__PSVITA__) && !defined(DISABLE_PSN)
app.GetCommerce()->HidePsStoreIcon();
#endif
app.SetAction(iPad,eAppAction_EthernetDisconnectedReturned_Menus);
@@ -6885,12 +6885,20 @@ HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGe
// ignore the names if we don't recognize them
if(pBannerName!=L"")
{
#ifdef __PSVITA__
wcsncpy_s( pDLCData->wchBanner, MAX_BANNERNAME_SIZE, pBannerName, MAX_BANNERNAME_SIZE);
#else
wcsncpy_s( pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE);
#endif
}
if(pDataFile[0]!=0)
{
#ifdef __PSVITA__
wcsncpy_s( pDLCData->wchDataFile, MAX_BANNERNAME_SIZE, pDataFile, MAX_BANNERNAME_SIZE);
#else
wcsncpy_s( pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE);
#endif
}
#endif
@@ -9,7 +9,7 @@ const wstring LeaderboardManager::filterNames[eNumFilterModes] =
L"Friends", L"MyScore", L"TopRank"
};
#ifdef __PS3__ // str1k3r - only PS3 needs this, also this wasnt in the leak?
#if defined(__PS3__) && !defined(_CONTENT_PACKAGE) // str1k3r - only PS3 needs this, also this wasnt in the leak?
LeaderboardManager *LeaderboardManager::m_instance = NULL;
#endif
@@ -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();
}
#elif defined(__PSVITA__)
bool CGameNetworkManager::usingAdhocMode()
{
return false;
}
void CGameNetworkManager::setAdhocMode(bool bAdhoc)
{
}
void CGameNetworkManager::startAdhocMatching()
{
}
#endif
@@ -4,28 +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__
#define LCE_NET_ERRNO sys_net_errno
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__
#define LCE_NET_ERRNO errno
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;
@@ -62,6 +57,9 @@ std::vector<BYTE> NetworkSocketLayer::s_disconnectedSmallIds;
CRITICAL_SECTION NetworkSocketLayer::s_freeSmallIdLock;
std::vector<BYTE> NetworkSocketLayer::s_freeSmallIds;
// only goes true on a successful Initialize(), and a failed one gets retried
static bool s_locksCreated = false;
bool g_MultiplayerHost = false;
#if defined __ORBIS__
// Orbis has direct lan networking so it can bypass psn account checks
@@ -77,6 +75,19 @@ char g_MultiplayerIP[256] = "127.0.0.1";
bool NetworkSocketLayer::Initialize()
{
if (s_initialized) return true;
// Create the locks before touching the platform network stack.
if (!s_locksCreated)
{
InitializeCriticalSection(&s_sendLock);
InitializeCriticalSection(&s_connectionsLock);
InitializeCriticalSection(&s_advertiseLock);
InitializeCriticalSection(&s_discoveryLock);
InitializeCriticalSection(&s_disconnectLock);
InitializeCriticalSection(&s_freeSmallIdLock);
s_locksCreated = true;
}
#if defined _WINDOWS64 || defined _XBOX
WSADATA wsaData;
int result = WSAStartup(MAKEWORD(2, 2), &wsaData);
@@ -98,14 +109,21 @@ bool NetworkSocketLayer::Initialize()
sys_net_finalize_network();
return false;
}
#endif
#elif defined __PSVITA__
SceNetInitParam param;
static char memory[16 * 1024];
InitializeCriticalSection(&s_sendLock);
InitializeCriticalSection(&s_connectionsLock);
InitializeCriticalSection(&s_advertiseLock);
InitializeCriticalSection(&s_discoveryLock);
InitializeCriticalSection(&s_disconnectLock);
InitializeCriticalSection(&s_freeSmallIdLock);
param.memory = memory;
param.size = sizeof(memory);
param.flags = 0;
int result = sceNetInit(&param);
// libnet is brought up before us by the platform layer, which reports EBUSY here.
if (result < 0 && result != SCE_NET_ERROR_EBUSY) {
app.DebugPrintf("sceNetInit failed: 0x%08x\n", result);
return false;
}
#endif
s_initialized = true;
@@ -134,7 +152,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);
@@ -155,7 +173,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
{
@@ -189,6 +207,7 @@ void NetworkSocketLayer::Shutdown()
s_disconnectedSmallIds.clear();
DeleteCriticalSection(&s_freeSmallIdLock);
s_freeSmallIds.clear();
s_locksCreated = false;
WSACleanup();
s_initialized = false;
}
@@ -247,8 +266,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);
@@ -301,8 +324,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);
@@ -555,14 +582,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
#if defined(__ORBIS__)
addr.sin_len = sizeof(addr);
@@ -602,41 +633,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));
int connectError = iResult < 0 ? LCE_NET_ERRNO : 0;
#endif
if (iResult < 0)
{
#if defined(__PS3__)
int err = connectError;
int err = sys_net_errno;
if (err == SYS_NET_EINPROGRESS)
{
#elif defined(__ORBIS__)
int err = connectError;
if (err == 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);
@@ -667,7 +704,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
@@ -721,7 +758,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
@@ -740,7 +777,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
{
@@ -757,7 +794,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
{
@@ -780,7 +817,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);
@@ -806,7 +843,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
}
@@ -848,7 +885,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)
{
@@ -856,7 +897,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)
@@ -1063,7 +1104,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
{
@@ -1128,7 +1169,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);
@@ -1156,7 +1197,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);
@@ -1200,7 +1241,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);
@@ -1218,15 +1263,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);
@@ -1251,7 +1301,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)
{
@@ -1263,8 +1313,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);
@@ -1278,14 +1332,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;
@@ -1319,7 +1374,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);
@@ -1357,22 +1412,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;
@@ -7,7 +7,7 @@
#include <stdint.h>
#include <winsockx.h>
#include <xtl.h>
#elif defined __PS3__ || defined __ORBIS__
#elif defined __PS3__ || defined __ORBIS__
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -16,6 +16,8 @@
#include <arpa/inet.h>
#include <sys/time.h>
#include <sys/select.h>
#elif defined __PSVITA__
#include <net.h>
#endif
#ifdef __PS3__
@@ -37,8 +39,62 @@
#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
#elif defined(__ORBIS__)
typedef int SOCKET;
#define INVALID_SOCKET -1
#define SO_NBIO SCE_NET_SO_NBIO
#define sys_net_errno errno
#define SYS_NET_EINPROGRESS 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
@@ -173,4 +229,4 @@ private:
extern bool g_MultiplayerHost;
extern bool g_MultiplayerJoin;
extern int g_MultiplayerPort;
extern char g_MultiplayerIP[256];
extern char g_MultiplayerIP[256];
@@ -770,7 +770,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));
@@ -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
@@ -56,7 +56,7 @@ void CPlatformNetworkManagerSony::HandleStateChange(SQRNetworkManager::eSQRNetwo
// 4J Stu - We may be accepting an invite from the DLC menu, so hide the icon
#ifdef __ORBIS__
sceNpCommerceHidePsStoreIcon();
#elif defined __PSVITA__
#elif defined(__PSVITA__) && !defined(DISABLE_PSN)
app.GetCommerce()->HidePsStoreIcon();
#endif
m_bLeavingGame = false;
@@ -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;
};
};
@@ -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
@@ -1,6 +1,7 @@
param(
[string]$OutDir,
[string]$ProjectDir
[string]$ProjectDir,
[string]$Configuration
)
Write-Host "PS3 Postbuild: script started. Output Directory: $OutDir, Project Directory: $ProjectDir"
@@ -59,7 +60,12 @@ foreach ($copy in $fileCopies) {
}
}
$builtFile = Join-Path $OutDir "Minecraft.Client.self"
if ($Configuration -match "ContentPackage") {
$builtFile = Join-Path $OutDir "Minecraft.Client.elf"
} else {
$builtFile = Join-Path $OutDir "Minecraft.Client.self"
}
$newName = "EBOOT.BIN"
$destDir = Join-Path $OutDir "PS3_GAME\USRDIR"
$destPath = Join-Path $destDir $newName
+18 -41
View File
@@ -528,48 +528,12 @@ void UIController::loadSkins()
}
#endif
// Every platform has one of these, so nothing shared
if(m_fScreenHeight==1080.0f)
// str1k3r - Fixes 720p/480p Crashes on Windows64, also allows this to be used on 1080p consoles instead of just Windows64
// This also cleans up some 4J code and turns 3 if statements into 1.
if (m_fScreenHeight >= 1080.0f)
{
m_iggyLibraries[eLibrary_Platform] = loadSkin(platformSkinPath, L"platformskinHD.swf");
}
else
{
m_iggyLibraries[eLibrary_Platform] = loadSkin(platformSkinPath, L"platformskin.swf");
}
#if defined(__PS3__) || defined(__PSVITA__)
m_iggyLibraries[eLibrary_GraphicsDefault] = loadSkin(L"skinGraphics.swf", L"skinGraphics.swf");
m_iggyLibraries[eLibrary_GraphicsHUD] = loadSkin(L"skinGraphicsHud.swf", L"skinGraphicsHud.swf");
m_iggyLibraries[eLibrary_GraphicsInGame] = loadSkin(L"skinGraphicsInGame.swf", L"skinGraphicsInGame.swf");
m_iggyLibraries[eLibrary_GraphicsTooltips] = loadSkin(L"skinGraphicsTooltips.swf", L"skinGraphicsTooltips.swf");
m_iggyLibraries[eLibrary_GraphicsLabels] = loadSkin(L"skinGraphicsLabels.swf", L"skinGraphicsLabels.swf");
m_iggyLibraries[eLibrary_Labels] = loadSkin(L"skinLabels.swf", L"skinLabels.swf");
m_iggyLibraries[eLibrary_InGame] = loadSkin(L"skinInGame.swf", L"skinInGame.swf");
m_iggyLibraries[eLibrary_HUD] = loadSkin(L"skinHud.swf", L"skinHud.swf");
m_iggyLibraries[eLibrary_Tooltips] = loadSkin(L"skinTooltips.swf", L"skinTooltips.swf");
m_iggyLibraries[eLibrary_Default] = loadSkin(L"skin.swf", L"skin.swf");
#endif
#if ( defined(_WINDOWS64) || defined(_DURANGO) || defined(__ORBIS__) )
#if defined(_WINDOWS64)
if (m_fScreenHeight <= 720.0f)
{
m_iggyLibraries[eLibrary_GraphicsDefault] = loadSkin(L"skinGraphics.swf", L"skinGraphics.swf");
m_iggyLibraries[eLibrary_GraphicsHUD] = loadSkin(L"skinGraphicsHud.swf", L"skinGraphicsHud.swf");
m_iggyLibraries[eLibrary_GraphicsInGame] = loadSkin(L"skinGraphicsInGame.swf", L"skinGraphicsInGame.swf");
m_iggyLibraries[eLibrary_GraphicsTooltips] = loadSkin(L"skinGraphicsTooltips.swf", L"skinGraphicsTooltips.swf");
m_iggyLibraries[eLibrary_GraphicsLabels] = loadSkin(L"skinGraphicsLabels.swf", L"skinGraphicsLabels.swf");
m_iggyLibraries[eLibrary_Labels] = loadSkin(L"skinLabels.swf", L"skinLabels.swf");
m_iggyLibraries[eLibrary_InGame] = loadSkin(L"skinInGame.swf", L"skinInGame.swf");
m_iggyLibraries[eLibrary_HUD] = loadSkin(L"skinHud.swf", L"skinHud.swf");
m_iggyLibraries[eLibrary_Tooltips] = loadSkin(L"skinTooltips.swf", L"skinTooltips.swf");
m_iggyLibraries[eLibrary_Default] = loadSkin(L"skin.swf", L"skin.swf");
}
else
#endif
{
m_iggyLibraries[eLibrary_GraphicsDefault] = loadSkin(L"skinHDGraphics.swf", L"skinHDGraphics.swf");
m_iggyLibraries[eLibrary_GraphicsHUD] = loadSkin(L"skinHDGraphicsHud.swf", L"skinHDGraphicsHud.swf");
m_iggyLibraries[eLibrary_GraphicsInGame] = loadSkin(L"skinHDGraphicsInGame.swf", L"skinHDGraphicsInGame.swf");
@@ -581,7 +545,20 @@ void UIController::loadSkins()
m_iggyLibraries[eLibrary_Tooltips] = loadSkin(L"skinHDTooltips.swf", L"skinHDTooltips.swf");
m_iggyLibraries[eLibrary_Default] = loadSkin(L"skinHD.swf", L"skinHD.swf");
}
#endif // HD platforms
else
{
m_iggyLibraries[eLibrary_Platform] = loadSkin(platformSkinPath, L"platformskin.swf");
m_iggyLibraries[eLibrary_GraphicsDefault] = loadSkin(L"skinGraphics.swf", L"skinGraphics.swf");
m_iggyLibraries[eLibrary_GraphicsHUD] = loadSkin(L"skinGraphicsHud.swf", L"skinGraphicsHud.swf");
m_iggyLibraries[eLibrary_GraphicsInGame] = loadSkin(L"skinGraphicsInGame.swf", L"skinGraphicsInGame.swf");
m_iggyLibraries[eLibrary_GraphicsTooltips] = loadSkin(L"skinGraphicsTooltips.swf", L"skinGraphicsTooltips.swf");
m_iggyLibraries[eLibrary_GraphicsLabels] = loadSkin(L"skinGraphicsLabels.swf", L"skinGraphicsLabels.swf");
m_iggyLibraries[eLibrary_Labels] = loadSkin(L"skinLabels.swf", L"skinLabels.swf");
m_iggyLibraries[eLibrary_InGame] = loadSkin(L"skinInGame.swf", L"skinInGame.swf");
m_iggyLibraries[eLibrary_HUD] = loadSkin(L"skinHud.swf", L"skinHud.swf");
m_iggyLibraries[eLibrary_Tooltips] = loadSkin(L"skinTooltips.swf", L"skinTooltips.swf");
m_iggyLibraries[eLibrary_Default] = loadSkin(L"skin.swf", L"skin.swf");
}
}
IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinName)
+1 -18
View File
@@ -96,24 +96,7 @@ private:
eLibrary_HUD,
eLibrary_Tooltips,
eLibrary_Default,
#if ( defined(_WINDOWS64) )
// 4J Stu - Load the 720/480 skins so that we have something to fallback on during development
#ifndef _FINAL_BUILD
eLibraryFallback_Platform,
eLibraryFallback_GraphicsDefault,
eLibraryFallback_GraphicsHUD,
eLibraryFallback_GraphicsInGame,
eLibraryFallback_GraphicsTooltips,
eLibraryFallback_GraphicsLabels,
eLibraryFallback_Labels,
eLibraryFallback_InGame,
eLibraryFallback_HUD,
eLibraryFallback_Tooltips,
eLibraryFallback_Default,
#endif
#endif
eLibrary_Count,
};
@@ -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)
@@ -100,7 +100,7 @@ void UIScene_DLCMainMenu::handleInput(int iPad, int key, bool repeat, bool press
{
#ifdef __ORBIS__
sceNpCommerceHidePsStoreIcon();
#elif defined __PSVITA__
#elif defined(__PSVITA__) && !defined(DISABLE_PSN)
app.GetCommerce()->HidePsStoreIcon();
#endif
navigateBack();
@@ -174,7 +174,7 @@ int UIScene_DLCMainMenu::ExitDLCMainMenu(void *pParam,int iPad,C4JStorage::EMess
#ifdef __ORBIS__
sceNpCommerceHidePsStoreIcon();
#elif defined __PSVITA__
#elif defined(__PSVITA__) && !defined(DISABLE_PSN)
app.GetCommerce()->HidePsStoreIcon();
#endif
pClass->navigateBack();
@@ -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
@@ -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
@@ -107,7 +107,7 @@ int UIScene_DLCOffersMenu::ExitDLCOffersMenu(void *pParam,int iPad,C4JStorage::E
#ifdef __ORBIS__
sceNpCommerceHidePsStoreIcon();
#elif defined __PSVITA__
#elif defined(__PSVITA__) && !defined(DISABLE_PSN)
app.GetCommerce()->HidePsStoreIcon();
#endif
ui.NavigateToHomeMenu();//iPad,eUIScene_MainMenu);
@@ -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)
{
@@ -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
}
@@ -474,7 +474,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
@@ -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)
@@ -182,7 +182,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
@@ -1559,7 +1559,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
@@ -2232,6 +2232,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);
@@ -2241,6 +2244,7 @@ int UIScene_LoadOrJoinMenu::MustSignInTexturePack(void *pParam,int iPad,C4JStora
pClass->m_bIgnoreInput = false;
}
#endif
return 0;
}
@@ -750,7 +750,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())
@@ -1343,7 +1343,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);
@@ -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;