TU19: Merge Minecraft.Client/Platform/Common/Network
Some checks are pending
Build (Linux, x86_64) / build-linux (push) Waiting to run
Build (Linux, x86_64) / build-linux-debug (push) Waiting to run
Clang Format / clang-format (push) Waiting to run

This commit is contained in:
Tropical 2026-03-22 04:21:50 -05:00
parent 5f22cd8093
commit 90bdcd47d4
3 changed files with 222 additions and 110 deletions

View file

@ -40,14 +40,12 @@
#include "../../Minecraft.World/Stats/DurangoStats.h" #include "../../Minecraft.World/Stats/DurangoStats.h"
#endif #endif
#define WAIT_TIMEOUT 258
// Global instance // Global instance
CGameNetworkManager g_NetworkManager; CGameNetworkManager g_NetworkManager;
CPlatformNetworkManager* CGameNetworkManager::s_pPlatformNetworkManager; CPlatformNetworkManager* CGameNetworkManager::s_pPlatformNetworkManager;
__int64 CGameNetworkManager::messageQueue[512]; int64_t CGameNetworkManager::messageQueue[512];
__int64 CGameNetworkManager::byteQueue[512]; int64_t CGameNetworkManager::byteQueue[512];
int CGameNetworkManager::messageQueuePos = 0; int CGameNetworkManager::messageQueuePos = 0;
CGameNetworkManager::CGameNetworkManager() { CGameNetworkManager::CGameNetworkManager() {
@ -183,7 +181,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
ProfileManager.SetDeferredSignoutEnabled(true); ProfileManager.SetDeferredSignoutEnabled(true);
#endif #endif
__int64 seed = 0; int64_t seed = 0;
if (lpParameter != NULL) { if (lpParameter != NULL) {
NetworkGameInitData* param = (NetworkGameInitData*)lpParameter; NetworkGameInitData* param = (NetworkGameInitData*)lpParameter;
seed = param->seed; seed = param->seed;
@ -198,14 +196,110 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
} else { } else {
param->seed = seed = param->seed = seed =
app.getLevelGenerationOptions()->getLevelSeed(); app.getLevelGenerationOptions()->getLevelSeed();
if (param->levelGen->isTutorial()) {
// Load the tutorial save data here
if (param->levelGen->requiresBaseSave() &&
!param->levelGen->getBaseSavePath().empty()) {
#ifdef _XBOX
#ifdef _TU_BUILD
std::wstring fileRoot =
L"UPDATE:\\res\\GameRules\\" +
param->levelGen->getBaseSavePath();
#else
std::wstring fileRoot =
L"GAME:\\res\\TitleUpdate\\GameRules\\" +
param->levelGen->getBaseSavePath();
#endif
#else
#ifdef _WINDOWS64
std::wstring fileRoot =
L"Windows64Media\\Tutorial\\" +
param->levelGen->getBaseSavePath();
File root(fileRoot);
if (!root.exists())
fileRoot = L"Windows64\\Tutorial\\" +
param->levelGen->getBaseSavePath();
#elif defined(__ORBIS__)
std::wstring fileRoot =
L"/app0/orbis/Tutorial/" +
param->levelGen->getBaseSavePath();
#elif defined(__PSVITA__)
std::wstring fileRoot =
L"PSVita/Tutorial/" +
param->levelGen->getBaseSavePath();
#elif defined(__PS3__)
std::wstring fileRoot =
L"PS3/Tutorial/" +
param->levelGen->getBaseSavePath();
#else
std::wstring fileRoot =
L"Tutorial\\" + param->levelGen->getBaseSavePath();
#endif
#endif
File grf(fileRoot);
if (grf.exists()) {
#ifdef _UNICODE
std::wstring path = grf.getPath();
const WCHAR* pchFilename = path.c_str();
HANDLE fileHandle = CreateFile(
pchFilename, // file name
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need
// to share file? Probably not but...
NULL, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu
// - Assuming that the file
// already exists if we are
// opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
NULL // Unsupported
);
#else
const char* pchFilename =
wstringtofilename(grf.getPath());
HANDLE fileHandle = CreateFile(
pchFilename, // file name
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need
// to share file? Probably not but...
NULL, // Unused
OPEN_EXISTING, // how to create // TODO 4J Stu
// - Assuming that the file
// already exists if we are
// opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
NULL // Unsupported
);
#endif
if (fileHandle != INVALID_HANDLE_VALUE) {
DWORD bytesRead,
dwFileSize = GetFileSize(fileHandle, NULL);
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
BOOL bSuccess =
ReadFile(fileHandle, pbData, dwFileSize,
&bytesRead, NULL);
if (bSuccess == FALSE) {
app.FatalLoadError();
}
CloseHandle(fileHandle);
// 4J-PB - is it possible that we can get here
// after a read fail and it's not an error?
param->levelGen->setBaseSaveData(pbData,
dwFileSize);
}
}
}
}
} }
} }
} }
static __int64 sseed = static int64_t sseed =
seed; // Create static version so this will be valid until next call to seed; // Create static version so this will be valid until next call to
// this function & whilst thread is running // this function & whilst thread is running
ServerStoppedCreate(false); ServerStoppedCreate(false);
if (g_NetworkManager.IsHost()) { if (g_NetworkManager.IsHost()) {
ServerStoppedCreate(true); ServerStoppedCreate(true);
@ -727,9 +821,8 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam,
if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) { if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) {
unsigned int uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_OK; uiIDA[0] = IDS_OK;
ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE,
IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad, NULL, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad);
NULL, app.GetStringTable());
return 0; return 0;
} }
@ -776,10 +869,10 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam,
} else if (noPrivileges) { } else if (noPrivileges) {
unsigned int uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_CONFIRM_OK; uiIDA[0] = IDS_CONFIRM_OK;
ui.RequestMessageBox(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT,
uiIDA, 1, ProfileManager.GetPrimaryPad(), uiIDA, 1,
NULL, NULL, app.GetStringTable()); ProfileManager.GetPrimaryPad());
} else { } else {
#if defined(__ORBIS__) || defined(__PSVITA__) #if defined(__ORBIS__) || defined(__PSVITA__)
bool chatRestricted = false; bool chatRestricted = false;
@ -895,11 +988,24 @@ int CGameNetworkManager::RunNetworkGameThreadProc(void* lpParameter) {
} }
int CGameNetworkManager::ServerThreadProc(void* lpParameter) { int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
__int64 seed = 0; int64_t seed = 0;
if (lpParameter != NULL) { if (lpParameter != NULL) {
NetworkGameInitData* param = (NetworkGameInitData*)lpParameter; NetworkGameInitData* param = (NetworkGameInitData*)lpParameter;
seed = param->seed; seed = param->seed;
app.SetGameHostOption(eGameHostOption_All, param->settings); app.SetGameHostOption(eGameHostOption_All, param->settings);
// 4J Stu - If we are loading a DLC save that's separate from the
// texture pack, load
if (param->levelGen != NULL &&
(param->texturePackId == 0 ||
param->levelGen->getRequiredTexturePackId() !=
param->texturePackId)) {
while ((Minecraft::GetInstance()->skins->needsUIUpdate() ||
ui.IsReloadingSkin())) {
Sleep(1);
}
param->levelGen->loadBaseSaveData();
}
} }
SetThreadName(-1, "Minecraft Server thread"); SetThreadName(-1, "Minecraft Server thread");
@ -911,6 +1017,7 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
Entity::useSmallIds(); Entity::useSmallIds();
Level::enableLightingCache(); Level::enableLightingCache();
Tile::CreateNewThreadStorage(); Tile::CreateNewThreadStorage();
FireworksRecipe::CreateNewThreadStorage();
MinecraftServer::main( MinecraftServer::main(
seed, seed,
@ -924,7 +1031,7 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
if (lpParameter != NULL) delete (NetworkGameInitData*)lpParameter; if (lpParameter != NULL) delete (NetworkGameInitData*)lpParameter;
return 0; return S_OK;
} }
int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) { int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) {
@ -935,10 +1042,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) {
Compression::UseDefaultThreadStorage(); Compression::UseDefaultThreadStorage();
// app.SetGameStarted(false); // app.SetGameStarted(false);
#ifndef __PSVITA__
UIScene_PauseMenu::_ExitWorld(NULL); UIScene_PauseMenu::_ExitWorld(NULL);
#endif
while (g_NetworkManager.IsInSession()) { while (g_NetworkManager.IsInSession()) {
Sleep(1); Sleep(1);
@ -946,7 +1050,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) {
// Xbox should always be online when receiving invites - on PS3 we need to // Xbox should always be online when receiving invites - on PS3 we need to
// check & ask the user to sign in // check & ask the user to sign in
#ifndef __PS3__ #if !defined(__PS3__) && !defined(__PSVITA__)
JoinFromInviteData* inviteData = (JoinFromInviteData*)lpParam; JoinFromInviteData* inviteData = (JoinFromInviteData*)lpParam;
app.SetAction(inviteData->dwUserIndex, eAppAction_JoinFromInvite, lpParam); app.SetAction(inviteData->dwUserIndex, eAppAction_JoinFromInvite, lpParam);
#else #else
@ -958,14 +1062,14 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) {
unsigned int uiIDA[2]; unsigned int uiIDA[2];
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE;
ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT,
uiIDA, 2, ProfileManager.GetPrimaryPad(), uiIDA, 2, ProfileManager.GetPrimaryPad(),
&CGameNetworkManager::MustSignInReturned_0, &CGameNetworkManager::MustSignInReturned_0,
lpParam, app.GetStringTable()); lpParam);
} }
#endif #endif
return 0; return S_OK;
} }
#if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__
@ -1098,17 +1202,17 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
uiIDA[0] = IDS_CONFIRM_OK; uiIDA[0] = IDS_CONFIRM_OK;
if (g_NetworkManager.m_bLastDisconnectWasLostRoomOnly) { if (g_NetworkManager.m_bLastDisconnectWasLostRoomOnly) {
if (g_NetworkManager.m_bSignedOutofPSN) { if (g_NetworkManager.m_bSignedOutofPSN) {
C4JStorage::EMessageResult result = ui.RequestMessageBox( C4JStorage::EMessageResult result = ui.RequestErrorMessage(
IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, IDS_ERROR_PSN_SIGN_OUT, IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, IDS_ERROR_PSN_SIGN_OUT,
uiIDA, 1, ProfileManager.GetPrimaryPad()); uiIDA, 1, ProfileManager.GetPrimaryPad());
} else { } else {
C4JStorage::EMessageResult result = C4JStorage::EMessageResult result = ui.RequestErrorMessage(
ui.RequestMessageBox(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK_TITLE,
IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, uiIDA, 1,
uiIDA, 1, ProfileManager.GetPrimaryPad()); ProfileManager.GetPrimaryPad());
} }
} else { } else {
C4JStorage::EMessageResult result = ui.RequestMessageBox( C4JStorage::EMessageResult result = ui.RequestErrorMessage(
IDS_CONNECTION_LOST, IDS_CONNECTION_LOST,
g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT), g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT),
uiIDA, 1, ProfileManager.GetPrimaryPad()); uiIDA, 1, ProfileManager.GetPrimaryPad());
@ -1117,13 +1221,14 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
// Swap these two messages around as one is too long to display at 480 // Swap these two messages around as one is too long to display at 480
pMinecraft->progressRenderer->progressStartNoAbort( pMinecraft->progressRenderer->progressStartNoAbort(
IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME);
pMinecraft->progressRenderer->progressStage(-1); // g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) pMinecraft->progressRenderer->progressStage(
// ); -1); // g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT)
// );
#elif defined(_XBOX_ONE) #elif defined(_XBOX_ONE)
if (g_NetworkManager.m_bFullSessionMessageOnNextSessionChange) { if (g_NetworkManager.m_bFullSessionMessageOnNextSessionChange) {
unsigned int uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_CONFIRM_OK; uiIDA[0] = IDS_CONFIRM_OK;
C4JStorage::EMessageResult result = ui.RequestMessageBox( C4JStorage::EMessageResult result = ui.RequestErrorMessage(
IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, IDS_IN_PARTY_SESSION_FULL, IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME, IDS_IN_PARTY_SESSION_FULL,
uiIDA, 1, ProfileManager.GetPrimaryPad()); uiIDA, 1, ProfileManager.GetPrimaryPad());
pMinecraft->progressRenderer->progressStartNoAbort( pMinecraft->progressRenderer->progressStartNoAbort(
@ -1158,8 +1263,9 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
// Swap these two messages around as one is too long to display at 480 // Swap these two messages around as one is too long to display at 480
pMinecraft->progressRenderer->progressStartNoAbort( pMinecraft->progressRenderer->progressStartNoAbort(
IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME);
pMinecraft->progressRenderer->progressStage(-1); // g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT) pMinecraft->progressRenderer->progressStage(
// ); -1); // g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT)
// );
#elif defined(_XBOX_ONE) #elif defined(_XBOX_ONE)
if (g_NetworkManager.m_bFullSessionMessageOnNextSessionChange) { if (g_NetworkManager.m_bFullSessionMessageOnNextSessionChange) {
pMinecraft->progressRenderer->progressStartNoAbort( pMinecraft->progressRenderer->progressStartNoAbort(
@ -1277,6 +1383,14 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
->getSocket() ->getSocket()
->setPlayer( ->setPlayer(
g_NetworkManager.GetLocalPlayerByUserIndex(index)); g_NetworkManager.GetLocalPlayerByUserIndex(index));
} else if (pMinecraft->m_connectionFailed[index] &&
(pMinecraft->m_connectionFailedReason[index] ==
DisconnectPacket::
eDisconnect_ConnectionCreationFailed)) {
pMinecraft->removeLocalPlayerIdx(index);
#ifdef _XBOX_ONE
ProfileManager.RemoveGamepadFromGame(index);
#endif
} }
} }
} }
@ -1308,7 +1422,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
app.SetChangingSessionType(false); app.SetChangingSessionType(false);
app.SetReallyChangingSessionType(false); app.SetReallyChangingSessionType(false);
return 0; return S_OK;
} }
void CGameNetworkManager::SystemFlagSet(INetworkPlayer* pNetworkPlayer, void CGameNetworkManager::SystemFlagSet(INetworkPlayer* pNetworkPlayer,
@ -1649,78 +1763,49 @@ void CGameNetworkManager::GameInviteReceived(int userIndex,
// npAvailability isn't SCE_OK // npAvailability isn't SCE_OK
unsigned int uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_OK; uiIDA[0] = IDS_OK;
ui.RequestMessageBox( ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE,
IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, IDS_CONTENT_RESTRICTION, uiIDA, 1,
iPadNotSignedInLive, NULL, NULL, app.GetStringTable()); iPadNotSignedInLive);
} else if (ProfileManager.isSignedInPSN(iPadNotSignedInLive)) { } else if (ProfileManager.isSignedInPSN(iPadNotSignedInLive)) {
// Signed in to PSN but not connected (no internet access) // Signed in to PSN but not connected (no internet access)
assert(!ProfileManager.isConnectedToPSN(iPadNotSignedInLive)); assert(!ProfileManager.isConnectedToPSN(iPadNotSignedInLive));
unsigned int uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_OK; uiIDA[0] = IDS_OK;
ui.RequestMessageBox(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, ui.RequestErrorMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK,
uiIDA, 1, iPadNotSignedInLive, NULL, NULL, uiIDA, 1, iPadNotSignedInLive);
app.GetStringTable());
} else { } else {
// Not signed in to PSN // Not signed in to PSN
unsigned int uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
ui.RequestMessageBox( ui.RequestAlertMessage(
IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1,
iPadNotSignedInLive, &CGameNetworkManager::MustSignInReturned_1, iPadNotSignedInLive, &CGameNetworkManager::MustSignInReturned_1,
(void*)pInviteInfo, app.GetStringTable(), NULL, 0, false); (void*)pInviteInfo);
} }
return; return;
} }
// 4J-JEV: Check that all players are authorised for PsPlus, present upsell // if this is the trial game, we'll check and send the user to unlock the
// to players that aren't and try again. // game later, in HandleInviteWhenInMenus
for (unsigned int index = 0; index < XUSER_MAX_COUNT; index++) { if (ProfileManager.IsFullVersion()) {
if (ProfileManager.IsSignedIn(index) && // 4J-JEV: Check that all players are authorised for PsPlus, present
!ProfileManager.HasPlayStationPlus(userIndex)) { // upsell to players that aren't and try again.
m_pInviteInfo = (INVITE_INFO*)pInviteInfo; for (unsigned int index = 0; index < XUSER_MAX_COUNT; index++) {
m_iPlayerInvited = userIndex; if (ProfileManager.IsSignedIn(index) &&
!ProfileManager.HasPlayStationPlus(userIndex)) {
m_pInviteInfo = (INVITE_INFO*)pInviteInfo;
m_iPlayerInvited = userIndex;
m_pUpsell = new PsPlusUpsellWrapper(index); m_pUpsell = new PsPlusUpsellWrapper(index);
m_pUpsell->displayUpsell(); m_pUpsell->displayUpsell();
return; return;
}
} }
} }
#endif #endif
#ifdef __PSVITA__
// Need to check we're signed in to PSN
bool isSignedInLive =
ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad());
if (!isSignedInLive) {
// Determine why they're not "signed in live"
// MGH - we need to add a new message at some point for connecting when
// already signed in
// if
// (ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad()))
// {
// // Signed in to PSN but not connected (no
// internet access) unsigned int uiIDA[1]; uiIDA[0] = IDS_OK;
// ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE,
// IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL,
// NULL, app.GetStringTable());
// }
// else
{
// Not signed in to PSN
unsigned int uiIDA[1];
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
ui.RequestMessageBox(
IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1,
ProfileManager.GetPrimaryPad(),
&CGameNetworkManager::MustSignInReturned_1, (void*)pInviteInfo,
app.GetStringTable(), NULL, 0, false);
}
return;
}
#endif
int localUsersMask = 0; int localUsersMask = 0;
Minecraft* pMinecraft = Minecraft::GetInstance(); Minecraft* pMinecraft = Minecraft::GetInstance();
int joiningUsers = 0; int joiningUsers = 0;
@ -1764,19 +1849,27 @@ void CGameNetworkManager::GameInviteReceived(int userIndex,
// 4J-PB - it's possible there is no primary pad here, when accepting an // 4J-PB - it's possible there is no primary pad here, when accepting an
// invite from the dashboard // invite from the dashboard
ui.RequestMessageBox(IDS_CONNECTION_FAILED, ui.RequestErrorMessage(IDS_CONNECTION_FAILED,
IDS_CONNECTION_FAILED_NO_SD_SPLITSCREEN, uiIDA, 1, IDS_CONNECTION_FAILED_NO_SD_SPLITSCREEN, uiIDA,
XUSER_INDEX_ANY, NULL, NULL, app.GetStringTable()); 1, XUSER_INDEX_ANY);
} else } else
#endif #endif
if (noUGC) { if (noUGC) {
#ifdef __PSVITA__
// showing the system message for chat restriction here instead now, to
// fix FQA bug report
ProfileManager.DisplaySystemMessage(
SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION,
ProfileManager.GetPrimaryPad());
#else
int messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; int messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL;
if (joiningUsers > 1) if (joiningUsers > 1)
messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL;
ui.RequestUGCMessageBox(IDS_CONNECTION_FAILED, messageText, ui.RequestUGCMessageBox(IDS_CONNECTION_FAILED, messageText,
XUSER_INDEX_ANY); XUSER_INDEX_ANY);
#endif
} }
#if defined(__PS3__) || defined __PSVITA__ #if defined(__PS3__) || defined __PSVITA__
else if (bContentRestricted) { else if (bContentRestricted) {
@ -1797,9 +1890,9 @@ void CGameNetworkManager::GameInviteReceived(int userIndex,
// IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, // IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT,
// uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, // uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL,
// app.GetStringTable()); // app.GetStringTable());
ui.RequestMessageBox(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1,
XUSER_INDEX_ANY, NULL, NULL, app.GetStringTable()); XUSER_INDEX_ANY);
} else { } else {
#if defined(__ORBIS__) || defined(__PSVITA__) #if defined(__ORBIS__) || defined(__PSVITA__)
bool chatRestricted = false; bool chatRestricted = false;
@ -1812,34 +1905,40 @@ void CGameNetworkManager::GameInviteReceived(int userIndex,
} }
#endif #endif
if (!g_NetworkManager.IsInSession()) { if (!g_NetworkManager.IsInSession()) {
#ifndef __PS3__ #if defined(__PS3__) || defined(__PSVITA__)
HandleInviteWhenInMenus(userIndex, pInviteInfo);
#else
// PS3 is more complicated here - we need to make sure that the // 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 // 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 // xbox, if not we need to try and get them online and then, if they
// do sign in, go down the same path // do sign in, go down the same path
// Determine why they're not "signed in live"
// MGH - On Vita we need to add a new message at some point for
// connecting when already signed in
if (ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) { if (ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) {
HandleInviteWhenInMenus(userIndex, pInviteInfo); HandleInviteWhenInMenus(userIndex, pInviteInfo);
} else { } else {
unsigned int uiIDA[2]; unsigned int uiIDA[2];
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE;
ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, ui.RequestErrorMessage(
IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2,
ProfileManager.GetPrimaryPad(), ProfileManager.GetPrimaryPad(),
&CGameNetworkManager::MustSignInReturned_1, &CGameNetworkManager::MustSignInReturned_1,
(void*)pInviteInfo, app.GetStringTable()); (void*)pInviteInfo);
} }
#else
HandleInviteWhenInMenus(userIndex, pInviteInfo);
#endif #endif
} else { } else {
app.DebugPrintf( app.DebugPrintf(
"We are already in a multiplayer game...need to leave it\n"); "We are already in a multiplayer game...need to leave it\n");
// JoinFromInviteData *joinData = new // JoinFromInviteData *joinData = new
// JoinFromInviteData(); joinData->dwUserIndex = dwUserIndex; // JoinFromInviteData(); joinData->dwUserIndex =
// joinData->dwLocalUsersMask = dwLocalUsersMask; // dwUserIndex; joinData->dwLocalUsersMask =
// joinData->pInviteInfo = pInviteInfo; // dwLocalUsersMask; joinData->pInviteInfo =
// pInviteInfo;
// tell the app to process this // tell the app to process this
#ifdef __PSVITA__ #ifdef __PSVITA__
@ -1873,7 +1972,9 @@ void CGameNetworkManager::HandleInviteWhenInMenus(
app.SetAction(userIndex, eAppAction_DashboardTrialJoinFromInvite); app.SetAction(userIndex, eAppAction_DashboardTrialJoinFromInvite);
} else { } else {
#ifndef _XBOX_ONE
ProfileManager.SetPrimaryPad(userIndex); ProfileManager.SetPrimaryPad(userIndex);
#endif
// 4J Stu - If we accept an invite from the main menu before going to // 4J Stu - If we accept an invite from the main menu before going to
// play game we need to load the DLC These checks are done within the // play game we need to load the DLC These checks are done within the
@ -1887,17 +1988,23 @@ void CGameNetworkManager::HandleInviteWhenInMenus(
// as the main player might sign out in the sign-in ui // as the main player might sign out in the sign-in ui
// ProfileManager.SetLockedProfile(-1); // ProfileManager.SetLockedProfile(-1);
if (!app.IsLocalMultiplayerAvailable()) { #ifdef _XBOX_ONE
if ((!app.IsLocalMultiplayerAvailable()) &&
InputManager.IsPadLocked(userIndex))
#else
if (!app.IsLocalMultiplayerAvailable())
#endif
{
bool noPrivileges = bool noPrivileges =
!ProfileManager.AllowedToPlayMultiplayer(userIndex); !ProfileManager.AllowedToPlayMultiplayer(userIndex);
if (noPrivileges) { if (noPrivileges) {
unsigned int uiIDA[1]; unsigned int uiIDA[1];
uiIDA[0] = IDS_CONFIRM_OK; uiIDA[0] = IDS_CONFIRM_OK;
ui.RequestMessageBox(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT,
uiIDA, 1, ProfileManager.GetPrimaryPad(), uiIDA, 1,
NULL, NULL, app.GetStringTable()); ProfileManager.GetPrimaryPad());
} else { } else {
ProfileManager.SetLockedProfile(userIndex); ProfileManager.SetLockedProfile(userIndex);
ProfileManager.SetPrimaryPad(userIndex); ProfileManager.SetPrimaryPad(userIndex);

View file

@ -24,6 +24,8 @@
class ClientConnection; class ClientConnection;
class Minecraft; class Minecraft;
const int NON_QNET_SENDDATA_ACK_REQUIRED = 1;
// This class implements the game-side interface to the networking system. As // This class implements the game-side interface to the networking system. As
// such, it is platform independent and may contain bits of game-side code where // such, it is platform independent and may contain bits of game-side code where
// appropriate. It shouldn't ever reference any platform specifics of the // appropriate. It shouldn't ever reference any platform specifics of the

View file

@ -11,8 +11,9 @@ public:
virtual ~INetworkPlayer() {} virtual ~INetworkPlayer() {}
virtual unsigned char GetSmallId() = 0; virtual unsigned char GetSmallId() = 0;
virtual void SendData(INetworkPlayer* player, const void* pvData, virtual void SendData(INetworkPlayer* player, const void* pvData,
int dataSize, bool lowPriority) = 0; int dataSize, bool lowPriority, bool ack) = 0;
virtual bool IsSameSystem(INetworkPlayer* player) = 0; virtual bool IsSameSystem(INetworkPlayer* player) = 0;
virtual int GetOutstandingAckCount() = 0;
virtual int GetSendQueueSizeBytes(INetworkPlayer* player, virtual int GetSendQueueSizeBytes(INetworkPlayer* player,
bool lowPriority) = 0; bool lowPriority) = 0;
virtual int GetSendQueueSizeMessages(INetworkPlayer* player, virtual int GetSendQueueSizeMessages(INetworkPlayer* player,
@ -32,4 +33,6 @@ public:
virtual const wchar_t* GetOnlineName() = 0; virtual const wchar_t* GetOnlineName() = 0;
virtual std::wstring GetDisplayName() = 0; virtual std::wstring GetDisplayName() = 0;
virtual PlayerUID GetUID() = 0; virtual PlayerUID GetUID() = 0;
virtual void SentChunkPacket() = 0;
virtual int GetTimeSinceLastChunkPacket_ms() = 0;
}; };