From 7c3e4fb0d5494ae79b375ad0fbbfe9457cc2e290 Mon Sep 17 00:00:00 2001 From: GabsPuNs Date: Thu, 28 May 2026 18:52:42 -0400 Subject: [PATCH] Some cleanup Just a bit. i dont want to clean all the ifdef for consoles right now --- Minecraft.Client/ClientConnection.cpp | 7 - Minecraft.Client/Common/Consoles_App.cpp | 226 +- Minecraft.Client/Common/Consoles_App.h | 27 - .../Common/GameRules/GameRuleManager.cpp | 43 +- .../Common/Network/GameNetworkManager.cpp | 125 +- .../Common/Network/GameNetworkManager.h | 5 - .../Common/UI/UIScene_CreateWorldMenu.cpp | 168 -- .../Common/UI/UIScene_CreateWorldMenu.h | 6 - .../Common/UI/UIScene_InGameInfoMenu.cpp | 87 +- .../Common/UI/UIScene_InGameInfoMenu.h | 5 - .../UI/UIScene_InGameSaveManagementMenu.cpp | 8 - .../Common/UI/UIScene_JoinMenu.cpp | 14 - .../Common/UI/UIScene_LoadMenu.cpp | 218 +- Minecraft.Client/Common/UI/UIScene_LoadMenu.h | 5 - .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 1988 ----------------- .../Common/UI/UIScene_LoadOrJoinMenu.h | 9 - .../Common/UI/UIScene_MainMenu.cpp | 379 +--- Minecraft.Client/Common/UI/UIScene_MainMenu.h | 61 +- .../Common/UI/UIScene_PauseMenu.cpp | 658 +----- .../Common/UI/UIScene_PauseMenu.h | 9 - .../Common/UI/UIScene_SkinSelectMenu.cpp | 36 - Minecraft.Client/LocalPlayer.cpp | 39 +- Minecraft.Client/Minecraft.cpp | 45 +- Minecraft.Client/Minecraft.h | 4 - 24 files changed, 60 insertions(+), 4112 deletions(-) diff --git a/Minecraft.Client/ClientConnection.cpp b/Minecraft.Client/ClientConnection.cpp index 3a0ebd28..339637ba 100644 --- a/Minecraft.Client/ClientConnection.cpp +++ b/Minecraft.Client/ClientConnection.cpp @@ -2411,13 +2411,6 @@ void ClientConnection::handlePreLogin(shared_ptr packet) // Guest don't have an offline XUID as they cannot play offline, so use their online one ProfileManager.GetXUID(m_userIndex,&onlineXUID,true); } -#ifdef __PSVITA__ - if(CGameNetworkManager::usingAdhocMode() && onlineXUID.getOnlineID()[0] == 0) - { - // player doesn't have an online UID, set it from the player name - onlineXUID.setForAdhoc(); - } -#endif // On PS3, all non-signed in players (even guests) can get a useful offlineXUID #if !(defined __PS3__ || defined _DURANGO ) diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 22ed020e..0bca368f 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -1,4 +1,4 @@ -#include "../../Minecraft.World/net.minecraft.world.entity.item.h" +#include "../../Minecraft.World/net.minecraft.world.entity.item.h" #include "../../Minecraft.World/net.minecraft.world.entity.player.h" #include "../../Minecraft.World/net.minecraft.world.level.tile.entity.h" #include "../../Minecraft.World/net.minecraft.world.phys.h" @@ -65,12 +65,9 @@ const float CMinecraftApp::fSafeZoneY = 36.0f; // 5% of 720 int CMinecraftApp::s_iHTMLFontSizesA[eHTMLSize_COUNT] = { -#ifdef _XBOX - 14,12,14,24 -#else - //20,15,20,24 + //20,15,20,24 OLD? + //14,12,14,24 XBOX 20,13,20,26 -#endif }; @@ -193,11 +190,6 @@ CMinecraftApp::CMinecraftApp() m_bResetNether=false; -#ifdef _XBOX - // m_bTransferSavesToXboxOne=false; - // m_uiTransferSlotC=5; -#endif - #if (defined _CONTENT_PACAKGE) || (defined _XBOX) m_bUseDPadForDebug = false; #else @@ -217,10 +209,6 @@ CMinecraftApp::CMinecraftApp() } LocaleAndLanguageInit(); - -#ifdef _XBOX_ONE - m_hasReachedMainMenu = false; -#endif } @@ -371,7 +359,6 @@ void CMinecraftApp::HandleButtonPresses() void CMinecraftApp::HandleButtonPresses(int iPad) { - // // test an update of the profile data // void *pData=ProfileManager.GetGameDefinedProfileData(iPad); // @@ -3120,21 +3107,9 @@ void CMinecraftApp::HandleXuiActions(void) if((iPlayer!=i) && pMinecraft->localplayers[iPlayer]) { if(g_NetworkManager.IsLocalGame()) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); - #else - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); else - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); - #else - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYER,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); } } } @@ -3145,21 +3120,9 @@ void CMinecraftApp::HandleXuiActions(void) if((iPlayer!=i) && pMinecraft->localplayers[iPlayer]) { if(g_NetworkManager.IsLocalGame()) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE); - #else - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE); else - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1P); - #else - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYER_1P,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1P); } } } @@ -3218,21 +3181,9 @@ void CMinecraftApp::HandleXuiActions(void) if((iPlayer!=i) && pMinecraft->localplayers[iPlayer]) { if(g_NetworkManager.IsLocalGame()) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); - #else - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); else - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); - #else - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYER,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); } } } @@ -3243,21 +3194,9 @@ void CMinecraftApp::HandleXuiActions(void) if((iPlayer!=i) && pMinecraft->localplayers[iPlayer]) { if(g_NetworkManager.IsLocalGame()) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE); - #else - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE); else - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1P); - #else - ProfileManager.SetCurrentGameActivity(iPlayer,CONTEXT_PRESENCE_MULTIPLAYER_1P,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1P); } } } @@ -3375,20 +3314,12 @@ void CMinecraftApp::HandleXuiActions(void) if(g_NetworkManager.IsLocalGame()) { app.SetRichPresenceContext(j,CONTEXT_GAME_STATE_BLANK); - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); - #else - ProfileManager.SetCurrentGameActivity(j,CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,false); - #endif + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); } else { app.SetRichPresenceContext(j,CONTEXT_GAME_STATE_BLANK); - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); - #else - ProfileManager.SetCurrentGameActivity(j,CONTEXT_PRESENCE_MULTIPLAYER,false); - #endif + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); } TelemetryManager->RecordLevelExit(j, eSen_LevelExitStatus_Exited); } @@ -3398,21 +3329,10 @@ void CMinecraftApp::HandleXuiActions(void) { app.SetRichPresenceContext(i,CONTEXT_GAME_STATE_BLANK); if(g_NetworkManager.IsLocalGame()) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE); - #else - ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE); else - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1P); - #else - ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MULTIPLAYER_1P,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1P); + TelemetryManager->RecordLevelExit(i, eSen_LevelExitStatus_Exited); } break; @@ -4924,14 +4844,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange // Some menus require the player to be signed in to live, so if this callback happens and the primary player is // no longer signed in then nav back else if ( pApp->GetLiveLinkRequired() && !ProfileManager.IsSignedInLive( ProfileManager.GetLockedProfile() ) ) - { -#ifdef __PSVITA__ - if(!CGameNetworkManager::usingAdhocMode()) // if we're in adhoc mode, we can ignore this -#endif - { pApp->SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected); - } - } #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ ) // 4J-JEV: Need to kick of loading of profile data for sub-sign in players. @@ -9710,31 +9623,6 @@ wstring CMinecraftApp::getFilePath(DWORD packId, wstring filename, bool bAddData return getRootPath(packId, false, true, mountPoint) + filename; } -#ifdef _XBOX -// Texture packs that have their data in the TU data -enum ETitleUpdateTexturePacks -{ - eTUTP_MassEffect = 0x400, - eTUTP_Skyrim = 0x401, - eTUTP_Halo = 0x402, - eTUTP_Festive = 0x405, - - eTUTP_Plastic = 0x801, - eTUTP_Candy = 0x802, - eTUTP_Fantasy = 0x803, - eTUTP_Halloween = 0x804, - eTUTP_Natural = 0x805, - eTUTP_City = 0x01000806, // 4J Stu - The released City pack had a sub-pack ID - eTUTP_Cartoon = 0x807, - eTUTP_Steampunk = 0x01000808, // 4J Stu - The released Steampunk pack had a sub-pack ID -}; - -#ifdef _TU_BUILD -wstring titleUpdateTexturePackRoot = L"UPDATE:\\res\\DLC\\"; -#else -wstring titleUpdateTexturePackRoot = L"GAME:\\res\\TitleUpdate\\DLC\\"; -#endif -#else enum ETitleUpdateTexturePacks { //eTUTP_MassEffect = 0x400, @@ -9752,72 +9640,12 @@ enum ETitleUpdateTexturePacks //eTUTP_Steampunk = 0x01000808, // 4J Stu - The released Steampunk pack had a sub-pack ID }; -#ifdef _WINDOWS64 wstring titleUpdateTexturePackRoot = L"Assets/DLC/"; -#elif defined(__ORBIS__) -wstring titleUpdateTexturePackRoot = L"/app0/orbis/CU/DLC/"; -#elif defined(__PSVITA__) -wstring titleUpdateTexturePackRoot = L"PSVita/CU/DLC/"; -#elif defined(__PS3__) -wstring titleUpdateTexturePackRoot = L"PS3/CU/DLC/"; -#else -wstring titleUpdateTexturePackRoot = L"CU\\DLC\\"; -#endif - -#endif wstring CMinecraftApp::getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder, wstring mountPoint) { wstring path = mountPoint; -#ifdef _XBOX - if(allowOverride) - { - switch(packId) - { - case eTUTP_MassEffect: - path = titleUpdateTexturePackRoot + L"MassEffect"; - break; - case eTUTP_Skyrim: - path = titleUpdateTexturePackRoot + L"Skyrim"; - break; - case eTUTP_Halo: - path = titleUpdateTexturePackRoot + L"Halo"; - break; - case eTUTP_Festive: - path = titleUpdateTexturePackRoot + L"Festive"; - break; - case eTUTP_Plastic: - path = titleUpdateTexturePackRoot + L"Plastic"; - break; - case eTUTP_Candy: - path = titleUpdateTexturePackRoot + L"Candy"; - break; - case eTUTP_Fantasy: - path = titleUpdateTexturePackRoot + L"Fantasy"; - break; - case eTUTP_Halloween: - path = titleUpdateTexturePackRoot + L"Halloween"; - break; - case eTUTP_Natural: - path = titleUpdateTexturePackRoot + L"Natural"; - break; - case eTUTP_City: - path = titleUpdateTexturePackRoot + L"City"; - break; - case eTUTP_Cartoon: - path = titleUpdateTexturePackRoot + L"Cartoon"; - break; - case eTUTP_Steampunk: - path = titleUpdateTexturePackRoot + L"Steampunk"; - break; - }; - File folder(path); - if(!folder.exists()) - { - path = mountPoint; - } - } -#else + if(allowOverride) { switch(packId) @@ -9832,27 +9660,9 @@ wstring CMinecraftApp::getRootPath(DWORD packId, bool allowOverride, bool bAddDa path = mountPoint; } } -#endif if(bAddDataFolder) - { return path + L"\\Data\\"; - } else - { return path + L"\\"; - } - -} - -#ifdef _XBOX_ONE -void CMinecraftApp::SetReachedMainMenu() -{ - m_hasReachedMainMenu = true; -} - -bool CMinecraftApp::HasReachedMainMenu() -{ - return m_hasReachedMainMenu; -} -#endif +} \ No newline at end of file diff --git a/Minecraft.Client/Common/Consoles_App.h b/Minecraft.Client/Common/Consoles_App.h index 1fc8e9b6..ced6b2a3 100644 --- a/Minecraft.Client/Common/Consoles_App.h +++ b/Minecraft.Client/Common/Consoles_App.h @@ -7,10 +7,6 @@ using namespace std; #include #include ".\Tutorial\TutorialEnum.h" -#ifdef _XBOX -#include ".\XUI\XUI_Helper.h" -#include ".\XUI\XUI_HelpCredits.h" -#endif #include "UI\UIStructs.h" #include "..\..\Minecraft.World\DisconnectPacket.h" @@ -910,29 +906,6 @@ private: unordered_mapm_eMCLangA; unordered_mapm_xcLangA; wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder, wstring mountPoint); -public: - -#ifdef _XBOX - // bool m_bTransferSavesToXboxOne; - // unsigned int m_uiTransferSlotC; - -#elif defined (__PS3__) - -#elif defined _DURANGO - -#elif defined _WINDOWS64 - //CMinecraftAudio audio; -#else // PS4 - -#endif - -#ifdef _XBOX_ONE -public: - void SetReachedMainMenu(); - bool HasReachedMainMenu(); -private: - bool m_hasReachedMainMenu; -#endif }; //singleton diff --git a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp index 6bb477ba..16cd50c2 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp @@ -644,55 +644,14 @@ void GameRuleManager::processSchematicsLighting(LevelChunk *levelChunk) void GameRuleManager::loadDefaultGameRules() { -#ifdef _XBOX -#ifdef _TU_BUILD - wstring fileRoot = L"UPDATE:\\res\\GameRules\\Tutorial.pck"; -#else - wstring fileRoot = L"GAME:\\res\\TitleUpdate\\GameRules\\Tutorial.pck"; -#endif - File packedTutorialFile(fileRoot); - if(loadGameRulesPack(&packedTutorialFile)) - { - m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(app.GetString(IDS_PLAY_TUTORIAL)); - //m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(L"Tutorial"); - m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME)); - } - -#else // _XBOX - -#ifdef _WINDOWS64 File packedTutorialFile(L"Assets/Tutorial/Tutorial.pck"); -#elif defined(__ORBIS__) - File packedTutorialFile(L"/app0/orbis/Tutorial/Tutorial.pck"); -#elif defined(__PSVITA__) - File packedTutorialFile(L"PSVita/Tutorial/Tutorial.pck"); -#elif defined(__PS3__) - File packedTutorialFile(L"PS3/Tutorial/Tutorial.pck"); -#else - File packedTutorialFile(L"Tutorial\\Tutorial.pck"); -#endif + if(loadGameRulesPack(&packedTutorialFile)) { m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(app.GetString(IDS_PLAY_TUTORIAL)); //m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(L"Tutorial"); m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME)); } -#if 0 - wstring fpTutorial = L"Tutorial.pck"; - if(app.getArchiveFileSize(fpTutorial) >= 0) - { - DLCPack *pack = new DLCPack(L"",0xffffffff); - DWORD dwFilesProcessed = 0; - if ( app.m_dlcManager.readDLCDataFile(dwFilesProcessed,fpTutorial,pack,true) ) - { - app.m_dlcManager.addPack(pack); - //m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(app.GetString(IDS_PLAY_TUTORIAL)); - //m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME)); - } - else delete pack; - } -#endif -#endif } bool GameRuleManager::loadGameRulesPack(File *path) diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Common/Network/GameNetworkManager.cpp index 722e4ede..7720e647 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/GameNetworkManager.cpp @@ -209,25 +209,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame // Load the tutorial save data here if(param->levelGen->requiresBaseSave() && !param->levelGen->getBaseSavePath().empty() ) { -#ifdef _XBOX -#ifdef _TU_BUILD - wstring fileRoot = L"UPDATE:\\res\\GameRules\\" + param->levelGen->getBaseSavePath(); -#else - wstring fileRoot = L"GAME:\\res\\TitleUpdate\\GameRules\\" + param->levelGen->getBaseSavePath(); -#endif -#else -#ifdef _WINDOWS64 wstring fileRoot = L"Assets/Tutorial/" + param->levelGen->getBaseSavePath(); -#elif defined(__ORBIS__) - wstring fileRoot = L"/app0/orbis/Tutorial/" + param->levelGen->getBaseSavePath(); -#elif defined(__PSVITA__) - wstring fileRoot = L"PSVita/Tutorial/" + param->levelGen->getBaseSavePath(); -#elif defined(__PS3__) - wstring fileRoot = L"PS3/Tutorial/" + param->levelGen->getBaseSavePath(); -#else - wstring fileRoot = L"Tutorial\\" + param->levelGen->getBaseSavePath(); -#endif -#endif + File grf(fileRoot); if (grf.exists()) { @@ -441,40 +424,16 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame if (GetPlayerCount() > 1) // Are we offline or online, and how many players are there { if (IsLocalGame()) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); - #else - ProfileManager.SetCurrentGameActivity(primaryPad,CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); else - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); - #else - ProfileManager.SetCurrentGameActivity(primaryPad,CONTEXT_PRESENCE_MULTIPLAYER,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); } else { if(IsLocalGame()) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE); - #else - ProfileManager.SetCurrentGameActivity(primaryPad,CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE); else - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1P); - #else - ProfileManager.SetCurrentGameActivity(primaryPad,CONTEXT_PRESENCE_MULTIPLAYER_1P,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1P); } @@ -549,21 +508,9 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame { app.SetRichPresenceContext(idx,CONTEXT_GAME_STATE_BLANK); if (IsLocalGame()) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); - #else - ProfileManager.SetCurrentGameActivity(idx,CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); else - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); - #else - ProfileManager.SetCurrentGameActivity(idx,CONTEXT_PRESENCE_MULTIPLAYER,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); } else { @@ -1650,40 +1597,16 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer ) if (multiplayer) { if (localgame) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); - #else - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); else - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); - #else - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MULTIPLAYER, false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); } else { if (localgame) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE); - #else - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE); else - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1P); - #else - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MULTIPLAYER_1P, false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1P); } } } @@ -1713,11 +1636,7 @@ void CGameNetworkManager::PlayerLeaving( INetworkPlayer *pNetworkPlayer ) { if( pNetworkPlayer->IsLocal() ) { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_IDLE); - #else - ProfileManager.SetCurrentGameActivity(pNetworkPlayer->GetUserIndex(),CONTEXT_PRESENCE_IDLE,false); - #endif + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_IDLE); TelemetryManager->RecordPlayerSessionExit(pNetworkPlayer->GetUserIndex(), app.GetDisconnectReason()); } @@ -2179,22 +2098,4 @@ void CGameNetworkManager::FakeLocalPlayerJoined() { s_pPlatformNetworkManager->FakeLocalPlayerJoined(); } -#endif - -#ifdef __PSVITA__ -bool CGameNetworkManager::usingAdhocMode() -{ - return ((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->usingAdhocMode(); -} - -void CGameNetworkManager::setAdhocMode(bool bAdhoc) -{ - ((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->setAdhocMode(bAdhoc); -} - -void CGameNetworkManager::startAdhocMatching() -{ - ((CPlatformNetworkManagerSony*)s_pPlatformNetworkManager)->startAdhocMatching(); -} - -#endif +#endif \ No newline at end of file diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.h b/Minecraft.Client/Common/Network/GameNetworkManager.h index 22d58807..896684c7 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.h +++ b/Minecraft.Client/Common/Network/GameNetworkManager.h @@ -150,11 +150,6 @@ public: void ServerStoppedDestroy(); // Destroy signal bool ServerStoppedValid(); // Is non-nullptr -#ifdef __PSVITA__ - static bool usingAdhocMode(); - static void setAdhocMode(bool bAdhoc); - static void startAdhocMatching(); -#endif // Debug output wstring GatherStats(); diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp index f91efab4..43c52cf1 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp @@ -296,56 +296,8 @@ void UIScene_CreateWorldMenu::tick() m_bShowTexturePackDescription = false; } - -#ifdef __ORBIS__ - // check the status of the PSPlus common dialog - switch (sceNpCommerceDialogUpdateStatus()) - { - case SCE_COMMON_DIALOG_STATUS_FINISHED: - { - SceNpCommerceDialogResult Result; - sceNpCommerceDialogGetResult(&Result); - sceNpCommerceDialogTerminate(); - - if(Result.authorized) - { - ProfileManager.PsPlusUpdate(ProfileManager.GetPrimaryPad(), &Result); - // they just became a PSPlus member - checkStateAndStartGame(); - } - else - { - // continue offline? - UINT uiIDA[1]; - uiIDA[0]=IDS_PRO_NOTONLINE_DECLINE; - - // Give the player a warning about the texture pack missing - ui.RequestAlertMessage(IDS_PLAY_OFFLINE,IDS_NO_PLAYSTATIONPLUS, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::ContinueOffline,dynamic_cast(this)); - } - } - break; - default: - break; - } -#endif } -#ifdef __ORBIS__ -int UIScene_CreateWorldMenu::ContinueOffline(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam; - - // results switched for this dialog - if(result==C4JStorage::EMessage_ResultAccept) - { - pClass->m_MoreOptionsParams.bOnlineGame=false; - pClass->checkStateAndStartGame(); - } - return 0; -} - -#endif - #ifdef _WINDOWS64 void UIScene_CreateWorldMenu::getDirectEditInputs(vector &inputs) { @@ -725,54 +677,11 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // If this is an online game but not all players are signed in to Live, stop! if (isOnlineGame && !isSignedInLive) { -#ifdef __ORBIS__ - assert(iPadNotSignedInLive != -1); - - // Check if PSN is unavailable because of age restriction - int npAvailability = ProfileManager.getNPAvailability(iPadNotSignedInLive); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - m_bIgnoreInput = false; - // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK - UINT uiIDA[1]; - uiIDA[0]=IDS_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive); - } - else - { - m_bIgnoreInput = true; - UINT uiIDA[2]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1] = IDS_CANCEL; - ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPadNotSignedInLive, &UIScene_CreateWorldMenu::MustSignInReturnedPSN, this); - } - return; -/* 4J-PB - Add this after release -#elif defined __PSVITA__ - m_bIgnoreInput=false; - // Determine why they're not "signed in live" - if (ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad())) - { - // Signed in to PSN but not connected (no internet access) - UINT uiIDA[1]; - uiIDA[0] = IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_PRO_CURRENTLY_NOT_ONLINE_TITLE, IDS_PRO_PSNOFFLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad()); - } - else - { - // Not signed in to PSN - UINT uiIDA[1]; - uiIDA[0] = IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad()); - return; - }*/ -#else m_bIgnoreInput=false; UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad()); return; -#endif } #ifdef __ORBIS__ @@ -1007,13 +916,6 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD #endif bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; -#ifdef __PSVITA__ - if(CGameNetworkManager::usingAdhocMode()) - { - if(SQRNetworkManager_AdHoc_Vita::GetAdhocStatus())// && pClass->m_MoreOptionsParams.bOnlineGame) - isClientSide = true; - } -#endif // __PSVITA__ bool isPrivate = pClass->m_MoreOptionsParams.bInviteOnly?true:false; @@ -1218,35 +1120,11 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu // If this is an online game but not all players are signed in to Live, stop! if (isOnlineGame && !isSignedInLive) { -#ifdef __ORBIS__ - assert(iPadNotSignedInLive != -1); - - // Check if PSN is unavailable because of age restriction - int npAvailability = ProfileManager.getNPAvailability(iPadNotSignedInLive); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - pClass->m_bIgnoreInput = false; - // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK - UINT uiIDA[1]; - uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive); - } - else - { - pClass->m_bIgnoreInput=true; - UINT uiIDA[2]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1] = IDS_CANCEL; - ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPadNotSignedInLive, &UIScene_CreateWorldMenu::MustSignInReturnedPSN, pClass); - } - return 0; -#else pClass->m_bIgnoreInput=false; UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad()); return 0; -#endif } // Check if user-created content is allowed, as we cannot play multiplayer if it's not @@ -1362,52 +1240,6 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor return 0; } -#ifdef __ORBIS__ -int UIScene_CreateWorldMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu *)pParam; - pClass->m_bIgnoreInput = false; - - if(result==C4JStorage::EMessage_ResultAccept) - { - SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_CreateWorldMenu::StartGame_SignInReturned, pClass, false, iPad); - } - - return 0; -} - -// int UIScene_CreateWorldMenu::PSPlusReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -// { -// int32_t iResult; -// UIScene_CreateWorldMenu *pClass = (UIScene_CreateWorldMenu *)pParam; -// -// // continue offline, or upsell PS Plus? -// if(result==C4JStorage::EMessage_ResultDecline) -// { -// // upsell psplus -// int32_t iResult=sceNpCommerceDialogInitialize(); -// -// SceNpCommerceDialogParam param; -// sceNpCommerceDialogParamInitialize(¶m); -// param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; -// param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; -// param.userId = ProfileManager.getUserID(pClass->m_iPad); -// -// iResult=sceNpCommerceDialogOpen(¶m); -// } -// else if(result==C4JStorage::EMessage_ResultAccept) -// { -// // continue offline -// pClass->m_MoreOptionsParams.bOnlineGame=false; -// pClass->checkStateAndStartGame(); -// } -// -// pClass->m_bIgnoreInput=false; -// return 0; -// } -#endif - - void UIScene_CreateWorldMenu::handleTouchBoxRebuild() { m_bRebuildTouchBoxes = true; diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h index 75bfe602..36b0f344 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h @@ -99,12 +99,6 @@ protected: static void CreateGame(UIScene_CreateWorldMenu* pClass, DWORD dwLocalUsersMask); static int ConfirmCreateReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int StartGame_SignInReturned(void *pParam,bool bContinue, int iPad); - static int MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result); - -#ifdef __ORBIS__ - //static int PSPlusReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int ContinueOffline(void *pParam,int iPad,C4JStorage::EMessageResult result); -#endif virtual void checkStateAndStartGame(); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp index 14b2914b..4924891d 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp @@ -88,9 +88,6 @@ void UIScene_InGameInfoMenu::updateTooltips() } if(g_NetworkManager.IsLocalGame()) keyX = -1; -#ifdef __PSVITA__ - if(CGameNetworkManager::usingAdhocMode()) keyX = -1; -#endif INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[m_playerList.getCurrentSelection()]->m_smallId); @@ -250,33 +247,6 @@ void UIScene_InGameInfoMenu::handleInput(int iPad, int key, bool repeat, bool pr } break; case ACTION_MENU_Y: -#if defined(__PS3__) || defined(__ORBIS__) - if(pressed && iPad == ProfileManager.GetPrimaryPad()) - { -#ifdef __PS3__ - // are we offline? - if(!ProfileManager.IsSignedInLive(iPad)) - { - // get them to sign in to online - UINT uiIDA[2]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_InGameInfoMenu::MustSignInReturnedPSN,this); - } - else -#endif - { -#ifdef __ORBIS__ - SQRNetworkManager_Orbis::RecvInviteGUI(); -#else // __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); -#endif - } - } -#else - - if(pressed && m_playerList.hasFocus() && (m_playerList.getItemCount() > 0) && (m_playerList.getCurrentSelection() < m_players.size()) ) { INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId(m_players[m_playerList.getCurrentSelection()]->m_smallId); @@ -284,30 +254,13 @@ void UIScene_InGameInfoMenu::handleInput(int iPad, int key, bool repeat, bool pr { PlayerUID uid = player->GetUID(); if( uid != INVALID_XUID ) - { -#ifdef __PSVITA__ - PSVITA_STUBBED; -#else ProfileManager.ShowProfileCard(iPad,uid); -#endif - } } } - -#endif break; case ACTION_MENU_X: - if(pressed && !repeat && !g_NetworkManager.IsLocalGame() ) - { -#ifdef __PSVITA__ - if(CGameNetworkManager::usingAdhocMode() == false) - g_NetworkManager.SendInviteGUI(iPad); -#else g_NetworkManager.SendInviteGUI(iPad); -#endif - } - break; case ACTION_MENU_OK: #ifdef __ORBIS__ @@ -494,42 +447,4 @@ UIScene_InGameInfoMenu::PlayerInfo *UIScene_InGameInfoMenu::BuildPlayerInfo(INet info->m_name = playerName; return info; -} - -#if defined __PS3__ || defined __PSVITA__ -int UIScene_InGameInfoMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_InGameInfoMenu* pClass = (UIScene_InGameInfoMenu*)pParam; - - if(result==C4JStorage::EMessage_ResultAccept) - { -#ifdef __PS3__ - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_InGameInfoMenu::ViewInvites_SignInReturned, pClass); -#else // __PSVITA__ - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_InGameInfoMenu::ViewInvites_SignInReturned, pClass); -#endif - } - - return 0; -} - -int UIScene_InGameInfoMenu::ViewInvites_SignInReturned(void *pParam,bool bContinue, int iPad) -{ - if(bContinue==true) - { - // Check if we're signed in to LIVE - if(ProfileManager.IsSignedInLive(iPad)) - { -#ifdef __ORBIS__ - SQRNetworkManager_Orbis::RecvInviteGUI(); -#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__ - SQRNetworkManager_Vita::RecvInviteGUI(); -#endif - } - } - return 0; -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.h b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.h index 2d8d3417..af0ec296 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.h @@ -66,9 +66,4 @@ public: private: PlayerInfo *BuildPlayerInfo(INetworkPlayer *player); - -#if defined(__PS3__) || defined (__PSVITA__) || defined(__ORBIS__) - static int MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int ViewInvites_SignInReturned(void *pParam,bool bContinue, int iPad); -#endif }; diff --git a/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp index 6cd33600..8623636f 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -75,14 +75,6 @@ UIScene_InGameSaveManagementMenu::UIScene_InGameSaveManagementMenu(int iPad, voi Initialise(); } -#ifdef __PSVITA__ - if(CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) - { - g_NetworkManager.startAdhocMatching(); // create the client matching context and clear out the friends list - } - -#endif - // If we're not ignoring input, then we aren't still waiting for the DLC to mount, and can now check for corrupt dlc. Otherwise this will happen when the dlc has finished mounting. if( !m_bIgnoreInput) { diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp index 8a5680b7..33da9b30 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp @@ -494,11 +494,6 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); isSignedInLive = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()); -#ifdef __PSVITA__ - if(CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) - isSignedInLive = true; -#endif - } } @@ -542,15 +537,6 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) if(!pccAllowed && !pccFriendsAllowed) noUGC = true; #endif - -#ifdef __PSVITA__ - if( CGameNetworkManager::usingAdhocMode() ) - { - noPrivileges = false; - noUGC = false; - } -#endif - if(noUGC) { pClass->setVisible( true ); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp index f2bd81e3..bd8d7917 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp @@ -581,57 +581,9 @@ void UIScene_LoadMenu::tick() ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_QuadrantSignin,&info); } -#ifdef __ORBIS__ - // check the status of the PSPlus common dialog - switch (sceNpCommerceDialogUpdateStatus()) - { - case SCE_COMMON_DIALOG_STATUS_FINISHED: - { - SceNpCommerceDialogResult Result; - sceNpCommerceDialogGetResult(&Result); - sceNpCommerceDialogTerminate(); - - if(Result.authorized) - { - ProfileManager.PsPlusUpdate(ProfileManager.GetPrimaryPad(), &Result); - // they just became a PSPlus member - LoadDataComplete(this); - } - else - { - // continue offline? - UINT uiIDA[1]; - uiIDA[0]=IDS_PRO_NOTONLINE_DECLINE; - - // Give the player a warning about the texture pack missing - ui.RequestAlertMessage(IDS_PLAY_OFFLINE,IDS_NO_PLAYSTATIONPLUS, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_LoadMenu::ContinueOffline,this); - } - } - break; - default: - break; - } -#endif - UIScene::tick(); } -#ifdef __ORBIS__ -int UIScene_LoadMenu::ContinueOffline(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; - - // results switched for this dialog - if(result==C4JStorage::EMessage_ResultAccept) - { - pClass->m_MoreOptionsParams.bOnlineGame=false; - pClass->LoadDataComplete(pClass); - } - return 0; -} - -#endif - void UIScene_LoadMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { if(m_bIgnoreInput) return; @@ -1193,34 +1145,11 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // If this is an online game but not all players are signed in to Live, stop! if (isOnlineGame && !isSignedInLive) { -#ifdef __ORBIS__ - assert(iPadNotSignedInLive != -1); - // Check if PSN is unavailable because of age restriction - int npAvailability = ProfileManager.getNPAvailability(iPadNotSignedInLive); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - pClass->m_bIgnoreInput = false; - // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK - UINT uiIDA[1]; - uiIDA[0]=IDS_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive); - } - else - { - pClass->m_bIgnoreInput=true; - UINT uiIDA[2]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1] = IDS_CANCEL; - ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPadNotSignedInLive, &UIScene_LoadMenu::MustSignInReturnedPSN, pClass); - } - return 0; -#else pClass->m_bIgnoreInput=false; UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad()); return 0; -#endif } // Check if user-created content is allowed, as we cannot play multiplayer if it's not @@ -1229,29 +1158,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) BOOL pccFriendsAllowed = TRUE; bool bContentRestricted = false; ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); -#if defined(__PS3__) || defined(__PSVITA__) - if(isOnlineGame) - { - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,nullptr,&bContentRestricted,nullptr); - } -#endif -#ifdef __ORBIS__ - bool bPlayStationPlus=true; - int iPadWithNoPlaystationPlus=0; - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - if(ProfileManager.IsSignedIn(i) && ((i == iPrimaryPad) || isLocalMultiplayerAvailable)) - { - if(!ProfileManager.HasPlayStationPlus(i)) - { - bPlayStationPlus=false; - iPadWithNoPlaystationPlus=i; - break; - } - } - } -#endif noUGC = !pccAllowed && !pccFriendsAllowed; if(!isOnlineGame || !isLocalMultiplayerAvailable) @@ -1271,54 +1178,8 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) ui.RequestContentRestrictedMessageBox(); pClass->m_bIgnoreInput=false; } -#ifdef __ORBIS__ - else if(isOnlineGame && (bPlayStationPlus==false)) - { - pClass->setVisible( true ); - pClass->m_bIgnoreInput=false; - - if(ProfileManager.RequestingPlaystationPlus(iPadWithNoPlaystationPlus)) - { - // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). - UINT uiIDA[1]; - uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); - return 0; - } - - // 4J-PB - we're not allowed to show the text Playstation Plus - have to call the upsell all the time! - // upsell psplus - int32_t iResult=sceNpCommerceDialogInitialize(); - - SceNpCommerceDialogParam param; - sceNpCommerceDialogParamInitialize(¶m); - param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; - param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; - param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus); - - iResult=sceNpCommerceDialogOpen(¶m); - -// UINT uiIDA[2]; -// uiIDA[0]=IDS_PLAY_OFFLINE; -// uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; -// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadMenu::PSPlusReturned,pClass, app.GetStringTable(),nullptr,0,false); - } - -#endif else { - -#if defined(__ORBIS__) || defined(__PSVITA__) - if(isOnlineGame) - { - bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); - if(chatRestricted) - { - ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); - } - } -#endif DWORD dwLocalUsersMask = CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); // No guest problems so we don't need to force a sign-in of players here @@ -1488,13 +1349,6 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal } bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; -#ifdef __PSVITA__ - if(CGameNetworkManager::usingAdhocMode()) - { - if(SQRNetworkManager_AdHoc_Vita::GetAdhocStatus())// && pClass->m_MoreOptionsParams.bOnlineGame) - isClientSide = true; - } -#endif // __PSVITA__ bool isPrivate = (app.GetGameSettings(pClass->m_iPad,eGameSetting_InviteOnly)>0)?true:false; @@ -1630,35 +1484,11 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int // If this is an online game but not all players are signed in to Live, stop! if (isOnlineGame && !isSignedInLive) { -#ifdef __ORBIS__ - assert(iPadNotSignedInLive != -1); - - // Check if PSN is unavailable because of age restriction - int npAvailability = ProfileManager.getNPAvailability(iPadNotSignedInLive); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - pClass->m_bIgnoreInput = false; - // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK - UINT uiIDA[1]; - uiIDA[0]=IDS_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive); - } - else - { - pClass->m_bIgnoreInput=true; - UINT uiIDA[2]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1] = IDS_CANCEL; - ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPadNotSignedInLive, &UIScene_LoadMenu::MustSignInReturnedPSN, pClass); - } - return 0; -#else pClass->m_bIgnoreInput=false; UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad()); return 0; -#endif } // Check if user-created content is allowed, as we cannot play multiplayer if it's not @@ -1727,50 +1557,4 @@ void UIScene_LoadMenu::handleGainFocus(bool navBack) { m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame == TRUE); } -} - -#ifdef __ORBIS__ -int UIScene_LoadMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_LoadMenu* pClass = (UIScene_LoadMenu *)pParam; - pClass->m_bIgnoreInput = false; - - if(result==C4JStorage::EMessage_ResultAccept) - { - SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_LoadMenu::StartGame_SignInReturned, pClass, false, iPad); - } - - return 0; -} - -// int UIScene_LoadMenu::PSPlusReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -// { -// int32_t iResult; -// UIScene_LoadMenu *pClass = (UIScene_LoadMenu *)pParam; -// -// // continue offline, or upsell PS Plus? -// if(result==C4JStorage::EMessage_ResultDecline) -// { -// // upsell psplus -// iResult=sceNpCommerceDialogInitialize(); -// -// SceNpCommerceDialogParam param; -// sceNpCommerceDialogParamInitialize(¶m); -// param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; -// param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; -// param.userId = ProfileManager.getUserID(pClass->m_iPad); -// -// -// iResult=sceNpCommerceDialogOpen(¶m); -// } -// else if(result==C4JStorage::EMessage_ResultAccept) -// { -// // continue offline -// pClass->m_MoreOptionsParams.bOnlineGame=false; -// pClass->LoadDataComplete(pClass); -// } -// -// pClass->m_bIgnoreInput=false; -// return 0; -// } -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.h b/Minecraft.Client/Common/UI/UIScene_LoadMenu.h index 53d66d55..6bbfd5dc 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.h @@ -117,11 +117,6 @@ private: static int CheckResetNetherReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int DeleteSaveDataReturned(void *pParam,bool bSuccess); - static int MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result); -#ifdef __ORBIS__ - //static int PSPlusReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int ContinueOffline(void *pParam,int iPad,C4JStorage::EMessageResult result); -#endif public: static int StartGame_SignInReturned(LPVOID pParam, bool, int); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index c4cc8ed7..2069eb6f 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -110,33 +110,9 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) } #endif - -#ifdef SONY_REMOTE_STORAGE_DOWNLOAD -unsigned long UIScene_LoadOrJoinMenu::m_ulFileSize=0L; -wstring UIScene_LoadOrJoinMenu::m_wstrStageText=L""; -bool UIScene_LoadOrJoinMenu::m_bSaveTransferRunning = false; -#endif - - #define JOIN_LOAD_ONLINE_TIMER_ID 0 #define JOIN_LOAD_ONLINE_TIMER_TIME 100 -#ifdef _XBOX -#define CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID 3 -#define CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME 50 -#endif - -#ifdef _XBOX_ONE -UIScene_LoadOrJoinMenu::ESaveTransferFiles UIScene_LoadOrJoinMenu::s_eSaveTransferFile; -unsigned long UIScene_LoadOrJoinMenu::s_ulFileSize=0L; -byteArray UIScene_LoadOrJoinMenu::s_transferData = byteArray(); -wstring UIScene_LoadOrJoinMenu::m_wstrStageText=L""; - -#ifdef _DEBUG_MENUS_ENABLED -C4JStorage::SAVETRANSFER_FILE_DETAILS UIScene_LoadOrJoinMenu::m_debugTransferDetails; -#endif -#endif - int UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) { UIScene_LoadOrJoinMenu *pClass= static_cast(lpParam); @@ -226,27 +202,8 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); -#ifdef _XBOX_ONE - // 4J-PB - in order to buy the skin packs & texture packs, we need the signed offer ids for them, which we get in the availability info - // we need to retrieve this info though, so do it here - app.AddDLCRequest(e_Marketplace_Content); // content is skin packs, texture packs and mash-up packs -#endif - int iLB = -1; -#ifdef _XBOX - XPARTY_USER_LIST partyList; - - if((XPartyGetUserList( &partyList ) != XPARTY_E_NOT_IN_PARTY ) && (partyList.dwUserCount>1)) - { - m_bInParty=true; - } - else - { - m_bInParty=false; - } -#endif - #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO) || defined(_WINDOWS64) // Always clear the saves when we enter this menu StorageManager.ClearSavesInfo(); @@ -263,14 +220,6 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer Initialise(); } -#ifdef __PSVITA__ - if(CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) - { - g_NetworkManager.startAdhocMatching(); // create the client matching context and clear out the friends list - } - -#endif - UpdateGamesList(); g_NetworkManager.SetSessionsUpdatedCallback( &UpdateGamesListCallback, this ); @@ -285,85 +234,6 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer { app.m_dlcManager.checkForCorruptDLCAndAlert(); } - - // 4J-PB - Only Xbox will not have trial DLC patched into the game -#ifdef _XBOX - // 4J-PB - there may be texture packs we don't have, so use the info from TMS for this - - DLC_INFO *pDLCInfo=nullptr; - - // first pass - look to see if there are any that are not in the list - bool bTexturePackAlreadyListed; - bool bNeedToGetTPD=false; - Minecraft *pMinecraft = Minecraft::GetInstance(); - int texturePacksCount = pMinecraft->skins->getTexturePackCount(); - - for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) - { - bTexturePackAlreadyListed=false; -#if defined(__PS3__) || defined(__ORBIS__) - char *pchDLCName=app.GetDLCInfoTextures(i); - pDLCInfo=app.GetDLCInfo(pchDLCName); -#else - ULONGLONG ull=app.GetDLCInfoTexturesFullOffer(i); - pDLCInfo=app.GetDLCInfoForFullOfferID(ull); -#endif - for(unsigned int i = 0; i < texturePacksCount; ++i) - { - TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i); - if(pDLCInfo && pDLCInfo->iConfig==tp->getDLCParentPackId()) - { - bTexturePackAlreadyListed=true; - } - } - if(bTexturePackAlreadyListed==false) - { - // some missing - bNeedToGetTPD=true; - - m_iTexturePacksNotInstalled++; - } - } - - if(bNeedToGetTPD==true) - { - // add a TMS request for them - app.DebugPrintf("+++ Adding TMSPP request for texture pack data\n"); - app.AddTMSPPFileTypeRequest(e_DLC_TexturePackData); - m_iConfigA= new int [m_iTexturePacksNotInstalled]; - m_iTexturePacksNotInstalled=0; - - for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) - { - bTexturePackAlreadyListed=false; -#if defined(__PS3__) || defined(__ORBIS__) - char *pchDLCName=app.GetDLCInfoTextures(i); - pDLCInfo=app.GetDLCInfo(pchDLCName); -#else - ULONGLONG ull=app.GetDLCInfoTexturesFullOffer(i); - pDLCInfo=app.GetDLCInfoForFullOfferID(ull); -#endif - for(unsigned int i = 0; i < texturePacksCount; ++i) - { - TexturePack *tp = pMinecraft->skins->getTexturePackByIndex(i); - if(pDLCInfo->iConfig==tp->getDLCParentPackId()) - { - bTexturePackAlreadyListed=true; - } - } - if(bTexturePackAlreadyListed==false) - { - m_iConfigA[m_iTexturePacksNotInstalled++]=pDLCInfo->iConfig; - } - } - } - - addTimer(CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID,CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME); -#endif - -#ifdef SONY_REMOTE_STORAGE_DOWNLOAD - m_eSaveTransferState = eSaveTransfer_Idle; -#endif } @@ -558,10 +428,6 @@ void UIScene_LoadOrJoinMenu::updateComponents() void UIScene_LoadOrJoinMenu::handleDestroy() { -#ifdef __PSVITA__ - app.DebugPrintf("missing InputManager.DestroyKeyboard on Vita !!!!!!\n"); -#endif - // shut down the keyboard if it is displayed #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO) InputManager.DestroyKeyboard(); @@ -840,24 +706,6 @@ void UIScene_LoadOrJoinMenu::tick() (wchar_t *)u16Message, // destination buffer MAX_SAVEFILENAME_LENGTH // size of destination buffer, in WCHAR's ); -#else -#ifdef __PS3 - size_t srcmax,dstmax; -#else - uint32_t srcmax,dstmax; - uint32_t srclen,dstlen; -#endif - srcmax=MAX_SAVEFILENAME_LENGTH; - dstmax=MAX_SAVEFILENAME_LENGTH; - -#if defined(__PS3__) - L10nResult lres= UTF8stoUTF16s((uint8_t *)m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename,&srcmax,u16Message,&dstmax); -#else - SceCesUcsContext context; - sceCesUcsContextInit(&context); - - sceCesUtf8StrToUtf16Str(&context, (uint8_t *)m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename,srcmax,&srclen,u16Message,dstmax,&dstlen); -#endif #endif if( m_saveDetails[m_iRequestingThumbnailId].pbThumbnailData ) { @@ -942,47 +790,6 @@ void UIScene_LoadOrJoinMenu::tick() m_controlSavesTimer.setVisible( false ); } #endif - -#ifdef _XBOX_ONE - if(g_NetworkManager.ShouldMessageForFullSession()) - { - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage( IDS_CONNECTION_FAILED, IDS_IN_PARTY_SESSION_FULL, uiIDA,1,ProfileManager.GetPrimaryPad()); - } -#endif - - // SAVE TRANSFERS -#ifdef __ORBIS__ - // check the status of the PSPlus common dialog - switch (sceNpCommerceDialogUpdateStatus()) - { - case SCE_COMMON_DIALOG_STATUS_FINISHED: - { - SceNpCommerceDialogResult Result; - sceNpCommerceDialogGetResult(&Result); - sceNpCommerceDialogTerminate(); - - if(Result.authorized) - { - // they just became a PSPlus member - ProfileManager.PsPlusUpdate(ProfileManager.GetPrimaryPad(), &Result); - - } - else - { - - } - - // 4J-JEV: Fix for PS4 #5148 - [ONLINE] If the user attempts to join a game when they do not have Playstation Plus, the title will lose all functionality. - m_bIgnoreInput = false; - } - break; - default: - break; - } -#endif - } void UIScene_LoadOrJoinMenu::GetSaveInfo() @@ -1149,23 +956,6 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr m_bIgnoreInput=true; StorageManager.SetSaveDevice(&CScene_MultiGameJoinLoad::DeviceSelectReturned,this,true); ui.PlayUISFX(eSFX_Press); -#endif - // Save Transfer -#ifdef _XBOX_ONE - if(ProfileManager.IsSignedInLive( m_iPad )) - { - UIScene_LoadOrJoinMenu::s_ulFileSize=0; - LaunchSaveTransfer(); - } -#endif -#ifdef SONY_REMOTE_STORAGE_DOWNLOAD - { - bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); - if(bSignedInLive) - { - LaunchSaveTransfer(); - } - } #endif #ifdef _WINDOWS64 // Right click on a save opens save options (same as RB / ACTION_MENU_RIGHT_SCROLL) @@ -1206,55 +996,6 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr #endif break; case ACTION_MENU_Y: -#if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__) - m_eAction = eAction_ViewInvites; - if(pressed && iPad == ProfileManager.GetPrimaryPad()) - { -#ifdef __ORBIS__ - // Check if PSN is unavailable because of age restriction - int npAvailability = ProfileManager.getNPAvailability(iPad); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - UINT uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); - - break; - } -#endif - - // are we offline? - if(!ProfileManager.IsSignedInLive(iPad)) - { - // get them to sign in to online - UINT uiIDA[2]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(), &UIScene_LoadOrJoinMenu::MustSignInReturnedPSN, this); - } - else - { -#ifdef __ORBIS__ - SQRNetworkManager_Orbis::RecvInviteGUI(); -#elif defined __PSVITA__ - SQRNetworkManager_Vita::RecvInviteGUI(); -#else - 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); -#endif - } - } -#elif defined(_DURANGO) - if(getControlFocus() == eControl_GamesList && m_buttonListGames.getItemCount() > 0) - { - DWORD nIndex = m_buttonListGames.getCurrentSelection(); - FriendSessionInfo *pSelectedSession = m_currentSessions->at( nIndex ); - - PlayerUID uid = pSelectedSession->searchResult.m_playerXuids[0]; - if( uid != INVALID_XUID ) ProfileManager.ShowProfileCard(ProfileManager.GetLockedProfile(),uid); - ui.PlayUISFX(eSFX_Press); - } -#endif // __PS3__ || __ORBIS__ break; case ACTION_MENU_RIGHT_SCROLL: @@ -1634,13 +1375,6 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) } } #endif -#ifdef __PSVITA__ - if( CGameNetworkManager::usingAdhocMode() ) - { - bContentRestricted = false; - noUGC = false; - } -#endif if(noUGC) { @@ -1770,15 +1504,6 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) { return; } - -#ifdef __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 - SQRNetworkManager_AdHoc_Vita::AttemptAdhocSignIn(&UIScene_LoadOrJoinMenu::SignInAdhocReturned, this); - return; - } -#endif } m_controlJoinTimer.setVisible( false ); @@ -2099,19 +1824,6 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) { case JOIN_LOAD_ONLINE_TIMER_ID: { -#ifdef _XBOX - XPARTY_USER_LIST partyList; - - if((XPartyGetUserList( &partyList ) != XPARTY_E_NOT_IN_PARTY ) && (partyList.dwUserCount>1)) - { - m_bInParty=true; - } - else - { - m_bInParty=false; - } -#endif - bool bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); if(bMultiplayerAllowed != m_bMultiplayerAllowed) { @@ -2132,60 +1844,6 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) } } break; - // 4J-PB - Only Xbox will not have trial DLC patched into the game -#ifdef _XBOX - case CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID: - { - -#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - for(int i=0;ichImageURL); - - if(hasRegisteredSubstitutionTexture(textureName)==false) - { - PBYTE pbImageData; - int iImageDataBytes=0; - SonyHttp::getDataFromURL(pDLCInfo->chImageURL,(void **)&pbImageData,&iImageDataBytes); - - if(iImageDataBytes!=0) - { - // set the image - registerSubstitutionTexture(textureName,pbImageData,iImageDataBytes,true); - m_iConfigA[i]=-1; - } - - } - } - } - } - - bool bAllDone=true; - for(int i=0;igetLocalFilename(), strlen(app.getRemoteStorage()->getLocalFilename())+1); // plus null - File cloudFile(wFileName); - - - StorageManager.ResetSaveData(); - - // Make our next save default to the name of the level - wchar_t wSaveName[128]; - mbstowcs(wSaveName, app.getRemoteStorage()->getSaveNameUTF8(), strlen(app.getRemoteStorage()->getSaveNameUTF8())+1); // plus null - StorageManager.SetSaveTitle(wSaveName); - - int64_t fileSize = cloudFile.length(); - FileInputStream fis(cloudFile); - byteArray ba(fileSize); - fis.read(ba); - fis.close(); - - - - bool isClientSide = false; - bool isPrivate = false; - int maxPlayers = MINECRAFT_NET_MAX_PLAYERS; - - if( app.GetTutorialMode() ) - { - isClientSide = false; - maxPlayers = 4; - } - - app.SetGameHostOption(eGameHostOption_All, app.getRemoteStorage()->getSaveHostOptions() ); - - g_NetworkManager.HostGame(0,isClientSide,isPrivate,maxPlayers,0); - - LoadSaveDataThreadParam *saveData = new LoadSaveDataThreadParam(ba.data, ba.length, cloudFile.getName()); - - NetworkGameInitData *param = new NetworkGameInitData(); - param->seed = app.getRemoteStorage()->getSaveSeed(); - param->saveData = saveData; - param->settings = app.GetGameHostOption( eGameHostOption_All ); - param->savePlatform = app.getRemoteStorage()->getSavePlatform(); - param->texturePackId = app.getRemoteStorage()->getSaveTexturePack(); - -#ifndef _XBOX - g_NetworkManager.FakeLocalPlayerJoined(); -#endif - - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; - - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; - completionData->iPad = DEFAULT_XUI_MENU_USER; - loadingParams->completionData = completionData; - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); -} - -#endif //SONY_REMOTE_STORAGE_DOWNLOAD - int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { auto* pClass = static_cast(pParam); @@ -2367,7 +1958,6 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) return 0; } - int UIScene_LoadOrJoinMenu::RenameSaveDataReturned(LPVOID lpParam,bool bRes) { UIScene_LoadOrJoinMenu* pClass = static_cast(lpParam); @@ -2383,23 +1973,6 @@ int UIScene_LoadOrJoinMenu::RenameSaveDataReturned(LPVOID lpParam,bool bRes) return 0; } -#ifdef __ORBIS__ - - -void UIScene_LoadOrJoinMenu::LoadRemoteFileFromDisk(char* remoteFilename) -{ - wchar_t wSaveName[128]; - mbstowcs(wSaveName, remoteFilename, strlen(remoteFilename)+1); // plus null - - // processConsoleSave(wSaveName, L"ProcessedSave.bin"); - - // File remoteFile(L"ProcessedSave.bin"); - File remoteFile(wSaveName); - LoadSaveFromDisk(&remoteFile, SAVE_FILE_PLATFORM_PS3); -} -#endif - - int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = static_cast(pParam); @@ -2451,29 +2024,6 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS } break; -#ifdef SONY_REMOTE_STORAGE_UPLOAD - case C4JStorage::EMessage_ResultFourthOption: // upload to cloud - { - UINT uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_OK; - uiIDA[1]=IDS_CONFIRM_CANCEL; - - ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_TEXT, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::SaveTransferDialogReturned,pClass); - } - break; -#endif // SONY_REMOTE_STORAGE_UPLOAD -#if defined _XBOX_ONE || defined __ORBIS__ - case C4JStorage::EMessage_ResultFourthOption: // copy save - { - UINT uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_OK; - uiIDA[1]=IDS_CONFIRM_CANCEL; - - ui.RequestAlertMessage(IDS_COPYSAVE, IDS_TEXT_COPY_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::CopySaveDialogReturned,pClass); - } - break; -#endif - case C4JStorage::EMessage_Cancelled: default: { @@ -2486,91 +2036,6 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS return 0; } - -#if defined (__PSVITA__) - -int UIScene_LoadOrJoinMenu::SignInAdhocReturned(void *pParam,bool bContinue, int iPad) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - pClass->m_bIgnoreInput = false; - return 0; - -} - - - -int UIScene_LoadOrJoinMenu::MustSignInTexturePack(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - - if(result==C4JStorage::EMessage_ResultAccept) - { - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack, pClass); - } - else - { - pClass->m_bIgnoreInput = false; - } - - return 0; -} - - -int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bContinue, int iPad) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - - int commerceState = app.GetCommerceState(); - while( commerceState != CConsoleMinecraftApp::eCommerce_State_Offline && - commerceState != CConsoleMinecraftApp::eCommerce_State_Online && - commerceState != CConsoleMinecraftApp::eCommerce_State_Error) - { - Sleep(10); - commerceState = app.GetCommerceState(); - } - - if(bContinue==true) - { - SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); - if(pSONYDLCInfo!=nullptr) - { - char chName[42]; - char chKeyName[20]; - char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; - - memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); - // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. - // So we assume the first sku for the product is the one we want - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char - memset(chKeyName, 0, sizeof(chKeyName)); - strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); - -#ifdef __ORBIS__ - strcpy_s(chName, chKeyName); -#else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); -#endif - app.GetDLCSkuIDFromProductList(chName,chSkuID); - // 4J-PB - need to check for an empty store - if(app.CheckForEmptyStore(iPad)==false) - { - if(app.DLCAlreadyPurchased(chSkuID)) - { - app.DownloadAlreadyPurchased(chSkuID); - } - else - { - app.Checkout(chSkuID); - } - } - } - } - pClass->m_bIgnoreInput = false; - return 0; -} - -#endif - int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { UIScene_LoadOrJoinMenu *pClass = static_cast(pParam); @@ -2580,1464 +2045,11 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS { // we need to enable background downloading for the DLC XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); -#if defined __PSVITA__ || defined __PS3__ || defined __ORBIS__ - -#ifdef __PSVITA__ - if(!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && CGameNetworkManager::usingAdhocMode()) - { - // get them to sign in to online - UINT uiIDA[2]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_LoadOrJoinMenu::MustSignInTexturePack,pClass); - return; - } -#endif - - SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); - if(pSONYDLCInfo!=nullptr) - { - char chName[42]; - char chKeyName[20]; - char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; - - memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); - // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. - // So we assume the first sku for the product is the one we want - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char - memset(chKeyName, 0, sizeof(chKeyName)); - strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); - -#ifdef __ORBIS__ - strcpy_s(chName, chKeyName); -#else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); -#endif - app.GetDLCSkuIDFromProductList(chName,chSkuID); - // 4J-PB - need to check for an empty store - if(app.CheckForEmptyStore(iPad)==false) - { - if(app.DLCAlreadyPurchased(chSkuID)) - { - app.DownloadAlreadyPurchased(chSkuID); - } - else - { - app.Checkout(chSkuID); - } - } - } -#endif - - -#if defined _XBOX_ONE - if(ProfileManager.IsSignedIn(iPad)) - { - if (ProfileManager.IsSignedInLive(iPad)) - { - wstring ProductId; - app.GetDLCFullOfferIDForPackID(pClass->m_initData->selectedSession->data.texturePackParentId,ProductId); - - StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),nullptr,nullptr); - } - else - { - // 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no active network connection user is unable to convert from Trial to Full texture pack and is not messaged why. - UINT uiIDA[1] = { IDS_CONFIRM_OK }; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad); - } - } -#endif - } pClass->m_bIgnoreInput=false; return 0; } -#if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ -int UIScene_LoadOrJoinMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - - if(result==C4JStorage::EMessage_ResultAccept) - { -#if defined(__PS3__) - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::PSN_SignInReturned, pClass); -#elif defined __PSVITA__ - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::PSN_SignInReturned, pClass); -#else - SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::PSN_SignInReturned, pClass, false, iPad); -#endif - } - else - { - pClass->m_bIgnoreInput = false; - } - - return 0; -} - -int UIScene_LoadOrJoinMenu::PSN_SignInReturned(void *pParam,bool bContinue, int iPad) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - if(bContinue==true) - { - switch(pClass->m_eAction) - { - case eAction_ViewInvites: - // Check if we're signed in to LIVE - if(ProfileManager.IsSignedInLive(iPad)) - { -#if defined(__PS3__) - int ret = sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, SYS_MEMORY_CONTAINER_ID_INVALID); - app.DebugPrintf("sceNpBasicRecvMessageCustom return %d ( %08x )\n", ret, ret); -#elif defined __PSVITA__ - SQRNetworkManager_Vita::RecvInviteGUI(); -#else - SQRNetworkManager_Orbis::RecvInviteGUI(); -#endif - } - break; - case eAction_JoinGame: - pClass->CheckAndJoinGame(pClass->m_iGameListIndex); - break; - } - } - else - { - pClass->m_bIgnoreInput = false; - } - return 0; -} -#endif - -#ifdef SONY_REMOTE_STORAGE_DOWNLOAD - -void UIScene_LoadOrJoinMenu::LaunchSaveTransfer() -{ - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc; - loadingParams->lpParam = (LPVOID)this; - - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->type = e_ProgressCompletion_NavigateBackToScene; - completionData->iPad = DEFAULT_XUI_MENU_USER; - loadingParams->completionData = completionData; - - loadingParams->cancelFunc=&UIScene_LoadOrJoinMenu::CancelSaveTransferCallback; - loadingParams->m_cancelFuncParam=this; - loadingParams->cancelText=IDS_TOOLTIPS_CANCEL; - - ui.NavigateToScene(m_iPad,eUIScene_FullscreenProgress, loadingParams); -} - -int UIScene_LoadOrJoinMenu::CreateDummySaveDataCallback(LPVOID lpParam,bool bRes) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; - if(bRes) - { - pClass->m_eSaveTransferState = eSaveTransfer_GetSavesInfo; - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("CreateDummySaveDataCallback failed\n"); - - } - return 0; -} - -int UIScene_LoadOrJoinMenu::CrossSaveGetSavesInfoCallback(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, bool bRes) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; - if(bRes) - { - pClass->m_eSaveTransferState = eSaveTransfer_GetFileData; - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("CrossSaveGetSavesInfoCallback failed\n"); - } - return 0; -} - -int UIScene_LoadOrJoinMenu::LoadCrossSaveDataCallback( void *pParam,bool bIsCorrupt, bool bIsOwner ) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) pParam; - if(bIsCorrupt == false && bIsOwner) - { - pClass->m_eSaveTransferState = eSaveTransfer_CreatingNewSave; - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("LoadCrossSaveDataCallback failed \n"); - - } - return 0; -} - -int UIScene_LoadOrJoinMenu::CrossSaveFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) pParam; - pClass->m_eSaveTransferState = eSaveTransfer_Idle; - return 0; -} - - -int UIScene_LoadOrJoinMenu::CrossSaveDeleteOnErrorReturned(LPVOID lpParam,bool bRes) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; - return 0; -} - -int UIScene_LoadOrJoinMenu::RemoteSaveNotFoundCallback(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) pParam; - pClass->m_eSaveTransferState = eSaveTransfer_Idle; - return 0; -} - -// MGH - added this global to force the delete of the previous data, for the remote storage saves -// need to speak to Chris why this is necessary -bool g_bForceVitaSaveWipe = false; - - -int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter ) -{ - m_bSaveTransferRunning = true; -#ifdef __PS3__ - StorageManager.SetSaveTransferInProgress(true); -#endif - Compression::UseDefaultThreadStorage(); - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParameter; - pClass->m_saveTransferDownloadCancelled = false; - m_bSaveTransferRunning = true; - bool bAbortCalled = false; - Minecraft *pMinecraft=Minecraft::GetInstance(); - bool bSaveFileCreated = false; - wchar_t wSaveName[128]; - - // get the save file size - pMinecraft->progressRenderer->progressStagePercentage(0); - pMinecraft->progressRenderer->progressStart(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD); - pMinecraft->progressRenderer->progressStage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD ); - - ConsoleSaveFile* pSave = nullptr; - - pClass->m_eSaveTransferState = eSaveTransfer_GetRemoteSaveInfo; - - - while(pClass->m_eSaveTransferState!=eSaveTransfer_Idle) - { - switch(pClass->m_eSaveTransferState) - { - case eSaveTransfer_Idle: - break; - case eSaveTransfer_GetRemoteSaveInfo: - app.DebugPrintf("UIScene_LoadOrJoinMenu getSaveInfo\n"); - app.getRemoteStorage()->getSaveInfo(); - pClass->m_eSaveTransferState = eSaveTransfer_GettingRemoteSaveInfo; - break; - case eSaveTransfer_GettingRemoteSaveInfo: - if(pClass->m_saveTransferDownloadCancelled) - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - break; - } - if(app.getRemoteStorage()->waitingForSaveInfo() == false) - { - if(app.getRemoteStorage()->saveIsAvailable()) - { - if(app.getRemoteStorage()->saveVersionSupported()) - { - pClass->m_eSaveTransferState = eSaveTransfer_CreateDummyFile; - } - else - { - // must be a newer version of the save in the cloud that we don't support yet - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_WRONG_VERSION, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass); - } - } - else - { - // no save available, inform the user about the functionality - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_NOT_AVAILABLE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass); - } - } - break; - case eSaveTransfer_CreateDummyFile: - { - StorageManager.ResetSaveData(); - BYTE *compData = (BYTE *)StorageManager.AllocateSaveData( app.getRemoteStorage()->getSaveFilesize() ); - // Make our next save default to the name of the level - const char* pNameUTF8 = app.getRemoteStorage()->getSaveNameUTF8(); - mbstowcs(wSaveName, pNameUTF8, strlen(pNameUTF8)+1); // plus null - StorageManager.SetSaveTitle(wSaveName); - PBYTE pbThumbnailData=nullptr; - DWORD dwThumbnailDataSize=0; - - PBYTE pbDataSaveImage=nullptr; - DWORD dwDataSizeSaveImage=0; - - StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t - StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that - - BYTE bTextMetadata[88]; - ZeroMemory(bTextMetadata,88); - unsigned int hostOptions = app.getRemoteStorage()->getSaveHostOptions(); -#ifdef __ORBIS__ - app.SetGameHostOption(hostOptions, eGameHostOption_WorldSize, e_worldSize_Classic); // force the classic world size on, otherwise it's unknown and we can't expand -#endif - int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, hostOptions, app.getRemoteStorage()->getSaveTexturePack() ); - - // set the icon and save image - StorageManager.SetSaveImages(pbThumbnailData,dwThumbnailDataSize,pbDataSaveImage,dwDataSizeSaveImage,bTextMetadata,iTextMetadataBytes); - - app.getRemoteStorage()->waitForStorageManagerIdle(); - C4JStorage::ESaveGameState saveState = StorageManager.SaveSaveData( &UIScene_LoadOrJoinMenu::CreateDummySaveDataCallback, lpParameter ); - if(saveState == C4JStorage::ESaveGame_Save) - { - pClass->m_eSaveTransferState = eSaveTransfer_CreatingDummyFile; - } - else - { - app.DebugPrintf("Failed to create dummy save file\n"); - pClass->m_eSaveTransferState = eSaveTransfer_Error; - } - } - break; - case eSaveTransfer_CreatingDummyFile: - break; - case eSaveTransfer_GetSavesInfo: - { - // we can't cancel here, we need the saves info so we can delete the file - if(pClass->m_saveTransferDownloadCancelled) - { - WCHAR wcTemp[256]; - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" - m_wstrStageText=wcTemp; - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - } - - app.getRemoteStorage()->waitForStorageManagerIdle(); - app.DebugPrintf("CALL GetSavesInfo B\n"); - C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(pClass->m_iPad,&UIScene_LoadOrJoinMenu::CrossSaveGetSavesInfoCallback,pClass,"save"); - pClass->m_eSaveTransferState = eSaveTransfer_GettingSavesInfo; - } - break; - case eSaveTransfer_GettingSavesInfo: - if(pClass->m_saveTransferDownloadCancelled) - { - WCHAR wcTemp[256]; - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" - m_wstrStageText=wcTemp; - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - } - break; - - case eSaveTransfer_GetFileData: - { - bSaveFileCreated = true; - StorageManager.GetSaveUniqueFileDir(pClass->m_downloadedUniqueFilename); - - if(pClass->m_saveTransferDownloadCancelled) - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - break; - } - PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - int idx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; - app.getRemoteStorage()->waitForStorageManagerIdle(); - bool bGettingOK = app.getRemoteStorage()->getSaveData(pClass->m_downloadedUniqueFilename, SaveTransferReturned, pClass); - if(bGettingOK) - { - pClass->m_eSaveTransferState = eSaveTransfer_GettingFileData; - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("app.getRemoteStorage()->getSaveData failed\n"); - - } - } - - case eSaveTransfer_GettingFileData: - { - WCHAR wcTemp[256]; - - int dataProgress = app.getRemoteStorage()->getDataProgress(); - pMinecraft->progressRenderer->progressStagePercentage(dataProgress); - - //swprintf(wcTemp, 256, L"Downloading data : %d", dataProgress);//app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,pClass->m_ulFileSize); - swprintf(wcTemp,256, app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),dataProgress); - m_wstrStageText=wcTemp; - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - if(pClass->m_saveTransferDownloadCancelled && bAbortCalled == false) - { - app.getRemoteStorage()->abort(); - bAbortCalled = true; - } - } - break; - case eSaveTransfer_FileDataRetrieved: - pClass->m_eSaveTransferState = eSaveTransfer_LoadSaveFromDisc; - break; - case eSaveTransfer_LoadSaveFromDisc: - { - if(pClass->m_saveTransferDownloadCancelled) - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - break; - } - - PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - int saveInfoIndex = -1; - for(int i=0;iiSaveC;i++) - { - if(strcmp(pSaveDetails->SaveInfoA[i].UTF8SaveFilename, pClass->m_downloadedUniqueFilename) == 0) - { - //found it - saveInfoIndex = i; - } - } - if(saveInfoIndex == -1) - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("CrossSaveGetSavesInfoCallback failed - couldn't find save\n"); - } - else - { -#ifdef __PS3__ - // ignore the CRC on PS3 - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex],&LoadCrossSaveDataCallback,pClass, true); -#else - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex],&LoadCrossSaveDataCallback,pClass); -#endif - if(eLoadStatus == C4JStorage::ESaveGame_Load) - { - pClass->m_eSaveTransferState = eSaveTransfer_LoadingSaveFromDisc; - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - } - } - } - break; - case eSaveTransfer_LoadingSaveFromDisc: - - break; - case eSaveTransfer_CreatingNewSave: - { - unsigned int fileSize = StorageManager.GetSaveSize(); - byteArray ba(fileSize); - StorageManager.GetSaveData(ba.data, &fileSize); - assert(ba.length == fileSize); - - - StorageManager.ResetSaveData(); - { - PBYTE pbThumbnailData=nullptr; - DWORD dwThumbnailDataSize=0; - - PBYTE pbDataSaveImage=nullptr; - DWORD dwDataSizeSaveImage=0; - - StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t - StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that - - BYTE bTextMetadata[88]; - ZeroMemory(bTextMetadata,88); - unsigned int remoteHostOptions = app.getRemoteStorage()->getSaveHostOptions(); - app.SetGameHostOption(eGameHostOption_All, remoteHostOptions ); - int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, remoteHostOptions, app.getRemoteStorage()->getSaveTexturePack() ); - - // set the icon and save image - StorageManager.SetSaveImages(pbThumbnailData,dwThumbnailDataSize,pbDataSaveImage,dwDataSizeSaveImage,bTextMetadata,iTextMetadataBytes); - } - - -#ifdef SPLIT_SAVES - ConsoleSaveFileOriginal oldFormatSave( wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform() ); - pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer ); - - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - pSave->Flush(false,false); - pClass->m_eSaveTransferState = eSaveTransfer_Saving; -#else - pSave = new ConsoleSaveFileOriginal( wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform() ); - pClass->m_eSaveTransferState = eSaveTransfer_Converting; - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_CONVERTING); -#endif - delete ba.data; - } - break; - case eSaveTransfer_Converting: - { - pSave->ConvertToLocalPlatform(); // check if we need to convert this file from PS3->PS4 - pClass->m_eSaveTransferState = eSaveTransfer_Saving; - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - StorageManager.SetSaveTitle(wSaveName); - StorageManager.SetSaveUniqueFilename(pClass->m_downloadedUniqueFilename); - - app.getRemoteStorage()->waitForStorageManagerIdle(); // we need to wait for the save system to be idle here, as Flush doesn't check for it. - pSave->Flush(false, false); - } - break; - case eSaveTransfer_Saving: - { - // On Durango/Orbis, we need to wait for all the asynchronous saving processes to complete before destroying the levels, as that will ultimately delete - // the directory level storage & therefore the ConsoleSaveSplit instance, which needs to be around until all the sub files have completed saving. -#if defined(_DURANGO) || defined(__ORBIS__) - while(StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle ) - { - Sleep(10); - StorageManager.Tick(); - } -#endif - - delete pSave; - - - pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC); - pClass->m_eSaveTransferState = eSaveTransfer_Succeeded; - } - break; - - case eSaveTransfer_Succeeded: - { - // if we've arrived here, the save has been created successfully - pClass->m_iState=e_SavesRepopulate; - pClass->updateTooltips(); - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - app.getRemoteStorage()->waitForStorageManagerIdle(); // wait for everything to complete before we hand control back to the player - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); - pClass->m_eSaveTransferState = eSaveTransfer_Finished; - } - break; - - case eSaveTransfer_Cancelled: // this is no longer used - { - assert(0); //pClass->m_eSaveTransferState = eSaveTransfer_Idle; - } - break; - case eSaveTransfer_Error: - { - if(bSaveFileCreated) - { - if(pClass->m_saveTransferDownloadCancelled) - { - WCHAR wcTemp[256]; - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" - m_wstrStageText=wcTemp; - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - } - // if the save file has already been created we have to delete it again if there's been an error - PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - int saveInfoIndex = -1; - for(int i=0;iiSaveC;i++) - { - if(strcmp(pSaveDetails->SaveInfoA[i].UTF8SaveFilename, pClass->m_downloadedUniqueFilename) == 0) - { - //found it - saveInfoIndex = i; - } - } - if(saveInfoIndex == -1) - { - app.DebugPrintf("eSaveTransfer_Error failed - couldn't find save\n"); - assert(0); - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; - } - else - { - // delete the save file - app.getRemoteStorage()->waitForStorageManagerIdle(); - C4JStorage::ESaveGameState eDeleteStatus = StorageManager.DeleteSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex],UIScene_LoadOrJoinMenu::CrossSaveDeleteOnErrorReturned,pClass); - if(eDeleteStatus == C4JStorage::ESaveGame_Delete) - { - pClass->m_eSaveTransferState = eSaveTransfer_ErrorDeletingSave; - } - else - { - app.DebugPrintf("StorageManager.DeleteSaveData failed!!\n"); - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; - } - } - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; - } - } - break; - - case eSaveTransfer_ErrorDeletingSave: - break; - case eSaveTransfer_ErrorMesssage: - { - app.getRemoteStorage()->waitForStorageManagerIdle(); // wait for everything to complete before we hand control back to the player - if(pClass->m_saveTransferDownloadCancelled) - { - pClass->m_eSaveTransferState = eSaveTransfer_Idle; - } - else - { - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - UINT errorMessage = IDS_SAVE_TRANSFER_DOWNLOADFAILED; - if(!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) - { - errorMessage = IDS_ERROR_NETWORK; // show "A network error has occurred." -#ifdef __ORBIS__ - if(!ProfileManager.isSignedInPSN(ProfileManager.GetPrimaryPad())) - { - errorMessage = IDS_PRO_NOTONLINE_TEXT; // show "not signed into PSN" - } -#endif -#ifdef __VITA__ - if(!ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad())) - { - errorMessage = IDS_PRO_NOTONLINE_TEXT; // show "not signed into PSN" - } -#endif - - } - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, errorMessage, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); - pClass->m_eSaveTransferState = eSaveTransfer_Finished; - } - if(bSaveFileCreated) // save file has been created, then deleted. - pClass->m_iState=e_SavesRepopulateAfterDelete; - else - pClass->m_iState=e_SavesRepopulate; - pClass->updateTooltips(); - } - break; - case eSaveTransfer_Finished: - { - } - // waiting to dismiss the dialog - break; - } - Sleep(50); - } - m_bSaveTransferRunning = false; -#ifdef __PS3__ - StorageManager.SetSaveTransferInProgress(false); -#endif - return 0; - -} - -void UIScene_LoadOrJoinMenu::SaveTransferReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; - - if(s == SonyRemoteStorage::e_getDataSucceeded) - { - pClass->m_eSaveTransferState = eSaveTransfer_FileDataRetrieved; - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("SaveTransferReturned failed with error code : 0x%08x\n", error_code); - } - -} -ConsoleSaveFile* UIScene_LoadOrJoinMenu::SonyCrossSaveConvert() -{ - return nullptr; -} - -void UIScene_LoadOrJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; - pClass->m_saveTransferDownloadCancelled = true; - ui.SetTooltips( DEFAULT_XUI_MENU_USER, -1, -1, -1, -1,-1,-1,-1,-1); // MGH - added - remove the "cancel" tooltip, so the player knows it's underway (really needs a "cancelling" message) -} - -#endif - - - -#ifdef SONY_REMOTE_STORAGE_UPLOAD - -void UIScene_LoadOrJoinMenu::LaunchSaveUpload() -{ - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc; - loadingParams->lpParam = (LPVOID)this; - - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->type = e_ProgressCompletion_NavigateBackToScene; - completionData->iPad = DEFAULT_XUI_MENU_USER; - loadingParams->completionData = completionData; - -// 4J-PB - Waiting for Sony to fix canceling a save upload - loadingParams->cancelFunc=&UIScene_LoadOrJoinMenu::CancelSaveUploadCallback; - loadingParams->m_cancelFuncParam = this; - loadingParams->cancelText=IDS_TOOLTIPS_CANCEL; - - ui.NavigateToScene(m_iPad,eUIScene_FullscreenProgress, loadingParams); - -} - -int UIScene_LoadOrJoinMenu::CrossSaveUploadFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) pParam; - pClass->m_eSaveUploadState = eSaveUpload_Idle; - - return 0; -} - - -int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter ) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParameter; - pClass->m_saveTransferUploadCancelled = false; - bool bAbortCalled = false; - Minecraft *pMinecraft=Minecraft::GetInstance(); - - // get the save file size - pMinecraft->progressRenderer->progressStagePercentage(0); - pMinecraft->progressRenderer->progressStart(IDS_TOOLTIPS_SAVETRANSFER_UPLOAD); - pMinecraft->progressRenderer->progressStage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD ); - - PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - int idx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; - bool bSettingOK = app.getRemoteStorage()->setSaveData(&pSaveDetails->SaveInfoA[idx], SaveUploadReturned, pClass); - - if(bSettingOK) - { - pClass->m_eSaveUploadState = eSaveUpload_UploadingFileData; - pMinecraft->progressRenderer->progressStagePercentage(0); - } - else - { - pClass->m_eSaveUploadState = eSaveUpload_Error; - } - - while(pClass->m_eSaveUploadState!=eSaveUpload_Idle) - { - switch(pClass->m_eSaveUploadState) - { - case eSaveUpload_Idle: - break; - case eSaveUpload_UploadingFileData: - { - WCHAR wcTemp[256]; - int dataProgress = app.getRemoteStorage()->getDataProgress(); - pMinecraft->progressRenderer->progressStagePercentage(dataProgress); - - //swprintf(wcTemp, 256, L"Uploading data : %d", dataProgress);//app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,pClass->m_ulFileSize); - swprintf(wcTemp,256, app.GetString(IDS_SAVETRANSFER_STAGE_PUT_DATA),dataProgress); - - m_wstrStageText=wcTemp; - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); -// 4J-PB - Waiting for Sony to fix canceling a save upload - if(pClass->m_saveTransferUploadCancelled && bAbortCalled == false) - { - // we only really want to be able to cancel during the download of data, if it's taking a long time - app.getRemoteStorage()->abort(); - bAbortCalled = true; - } - } - break; - case eSaveUpload_FileDataUploaded: - { - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); - pClass->m_eSaveUploadState = esaveUpload_Finished; - } - break; - case eSaveUpload_Cancelled: // this is no longer used - assert(0);// pClass->m_eSaveUploadState = eSaveUpload_Idle; - break; - case eSaveUpload_Error: - { - if(pClass->m_saveTransferUploadCancelled) - { - pClass->m_eSaveUploadState = eSaveUpload_Idle; - } - else - { - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); - pClass->m_eSaveUploadState = esaveUpload_Finished; - } - } - break; - case esaveUpload_Finished: - // waiting for dialog to be dismissed - break; - } - Sleep(50); - } - - return 0; - -} - -void UIScene_LoadOrJoinMenu::SaveUploadReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; - - if(pClass->m_saveTransferUploadCancelled) - { - UINT uiIDA[1] = { IDS_CONFIRM_OK }; - ui.RequestErrorMessage( IDS_CANCEL_UPLOAD_TITLE, IDS_CANCEL_UPLOAD_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), CrossSaveUploadFinishedCallback, pClass ); - pClass->m_eSaveUploadState=esaveUpload_Finished; - } - else - { - if(s == SonyRemoteStorage::e_setDataSucceeded) - pClass->m_eSaveUploadState = eSaveUpload_FileDataUploaded; - else if ( !pClass->m_saveTransferUploadCancelled ) - pClass->m_eSaveUploadState = eSaveUpload_Error; - } -} - -void UIScene_LoadOrJoinMenu::CancelSaveUploadCallback(LPVOID lpParam) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; - pClass->m_saveTransferUploadCancelled = true; - app.DebugPrintf("m_saveTransferUploadCancelled = true\n"); - ui.SetTooltips( DEFAULT_XUI_MENU_USER, -1, -1, -1, -1,-1,-1,-1,-1); // MGH - added - remove the "cancel" tooltip, so the player knows it's underway (really needs a "cancelling" message) - - pClass->m_bIgnoreInput = true; -} - -int UIScene_LoadOrJoinMenu::SaveTransferDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - // results switched for this dialog - if(result==C4JStorage::EMessage_ResultAccept) - { - // upload the save - pClass->LaunchSaveUpload(); - - pClass->m_bIgnoreInput=false; - } - else - { - pClass->m_bIgnoreInput=false; - } - return 0; -} -#endif // SONY_REMOTE_STORAGE_UPLOAD - - -#if defined _XBOX_ONE -void UIScene_LoadOrJoinMenu::LaunchSaveTransfer() -{ - SaveTransferStateContainer *stateContainer = new SaveTransferStateContainer(); - stateContainer->m_iProgress = 0; - stateContainer->m_bSaveTransferInProgress = false; - stateContainer->m_bSaveTransferCancelled = false; - stateContainer->m_iPad = m_iPad; - stateContainer->m_eSaveTransferState = C4JStorage::eSaveTransfer_Idle; - stateContainer->m_pClass = this; - - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc; - loadingParams->lpParam = (LPVOID)stateContainer; - - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->type = e_ProgressCompletion_NavigateBackToScene; - completionData->iPad = DEFAULT_XUI_MENU_USER; - completionData->bRequiresUserAction=TRUE; - loadingParams->completionData = completionData; - - loadingParams->cancelFunc=&UIScene_LoadOrJoinMenu::CancelSaveTransferCallback; - loadingParams->m_cancelFuncParam=stateContainer; - loadingParams->cancelText=IDS_TOOLTIPS_CANCEL; - - ui.NavigateToScene(m_iPad,eUIScene_FullscreenProgress, loadingParams); -} - - - -int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) -{ - Compression::UseDefaultThreadStorage(); - - SaveTransferStateContainer *pStateContainer = (SaveTransferStateContainer *) lpParameter; - Minecraft *pMinecraft=Minecraft::GetInstance(); - ConsoleSaveFile* pSave = nullptr; - - while(StorageManager.SaveTransferClearState()!=C4JStorage::eSaveTransfer_Idle) - { - Sleep(5); - } - - pStateContainer->m_bSaveTransferInProgress=true; - - UIScene_LoadOrJoinMenu::s_eSaveTransferFile = eSaveTransferFile_Marker; - RequestFileSize( pStateContainer, L"completemarker" ); - - while((pStateContainer->m_eSaveTransferState!=C4JStorage::eSaveTransfer_Idle) && pStateContainer->m_bSaveTransferInProgress && !pStateContainer->m_bSaveTransferCancelled) - { - switch(pStateContainer->m_eSaveTransferState) - { - case C4JStorage::eSaveTransfer_Idle: - break; - case C4JStorage::eSaveTransfer_FileSizeRetrieved: - switch(UIScene_LoadOrJoinMenu::s_eSaveTransferFile) - { - case eSaveTransferFile_Marker: - if(UIScene_LoadOrJoinMenu::s_ulFileSize == 0) - { - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_NONE_FOUND); - pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - } - else - { - RequestFileData( pStateContainer, L"completemarker" ); - } - break; - case eSaveTransferFile_Metadata: - RequestFileData( pStateContainer, L"metadata" ); - break; - case eSaveTransferFile_SaveData: - RequestFileData( pStateContainer, L"savedata" ); - break; - }; - break; - case C4JStorage::eSaveTransfer_GettingFileData: - - break; - case C4JStorage::eSaveTransfer_FileDataRetrieved: - switch(UIScene_LoadOrJoinMenu::s_eSaveTransferFile) - { - case eSaveTransferFile_Marker: - // MGH - the marker file now contains the save file version number - // if the version is higher than we handle, cancel the download. - if(UIScene_LoadOrJoinMenu::s_transferData[0] > SAVE_FILE_VERSION_NUMBER) - { - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_NONE_FOUND); - pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - } - else - { - UIScene_LoadOrJoinMenu::s_eSaveTransferFile = eSaveTransferFile_Metadata; - RequestFileSize( pStateContainer, L"metadata" ); - } - break; - case eSaveTransferFile_Metadata: - { - ByteArrayInputStream bais(UIScene_LoadOrJoinMenu::s_transferData); - DataInputStream dis(&bais); - - wstring saveTitle = dis.readUTF(); - StorageManager.SetSaveTitle(saveTitle.c_str()); - - wstring saveUniqueName = dis.readUTF(); - - // 4J Stu - Don't set this any more. We added it so that we could share the ban list data for this save - // However if the player downloads the same save multiple times, it will overwrite the previous version - // with that filname, and they could have made changes to it. - //StorageManager.SetSaveUniqueFilename((wchar_t *)saveUniqueName.c_str()); - - int thumbnailSize = dis.readInt(); - if(thumbnailSize > 0) - { - byteArray ba(thumbnailSize); - dis.readFully(ba); - - - - // retrieve the seed value from the image metadata, we need to change to host options, then set it back again - bool bHostOptionsRead = false; - unsigned int uiHostOptions = 0; - DWORD dwTexturePack; - int64_t seedVal; - - char szSeed[50]; - ZeroMemory(szSeed,50); - app.GetImageTextData(ba.data,ba.length,(unsigned char *)&szSeed,uiHostOptions,bHostOptionsRead,dwTexturePack); - sscanf_s(szSeed, "%I64d", &seedVal); - - app.SetGameHostOption(uiHostOptions, eGameHostOption_WorldSize, e_worldSize_Classic); // force the classic world size on, otherwise it's unknown and we can't expand - - - BYTE bTextMetadata[88]; - ZeroMemory(bTextMetadata,88); - - int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, seedVal, true, uiHostOptions, dwTexturePack); - // set the icon and save image - StorageManager.SetSaveImages(ba.data, ba.length, nullptr, 0, bTextMetadata, iTextMetadataBytes); - - delete ba.data; - } - - UIScene_LoadOrJoinMenu::s_transferData = byteArray(); - UIScene_LoadOrJoinMenu::s_eSaveTransferFile = eSaveTransferFile_SaveData; - RequestFileSize( pStateContainer, L"savedata" ); - } - break; - case eSaveTransferFile_SaveData: - { -#ifdef SPLIT_SAVES - if(!pStateContainer->m_bSaveTransferCancelled) - { - ConsoleSaveFileOriginal oldFormatSave( L"Temp name", UIScene_LoadOrJoinMenu::s_transferData.data, UIScene_LoadOrJoinMenu::s_transferData.length, false, SAVE_FILE_PLATFORM_X360 ); - pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer ); - - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); - } - pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Saving; - -#else - pSave = new ConsoleSaveFileOriginal( wSaveName, m_transferData.data, m_transferData.length, false, SAVE_FILE_PLATFORM_X360 ); - pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Converting; -#endif - delete UIScene_LoadOrJoinMenu::s_transferData.data; - UIScene_LoadOrJoinMenu::s_transferData = byteArray(); - } - break; - }; - - pStateContainer->m_iProgress=0; - break; - case C4JStorage::eSaveTransfer_Converting: -#if 0 - pSave->ConvertToLocalPlatform(); - - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); - - pStateContainer->m_iProgress+=1; - if(pStateContainer->m_iProgress==101) - { - pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Saving; - pStateContainer->m_iProgress=0; - break; - } - pMinecraft->progressRenderer->progressStagePercentage(pStateContainer->m_iProgress); -#endif - break; - case C4JStorage::eSaveTransfer_Saving: - // On Durango/Orbis, we need to wait for all the asynchronous saving processes to complete before destroying the levels, as that will ultimately delete - // the directory level storage & therefore the ConsoleSaveSplit instance, which needs to be around until all the sub files have completed saving. -#if defined(_DURANGO) || defined(__ORBIS__) - pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC); - - while(StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle ) - { - Sleep(10); - - // 4J Stu - DO NOT tick this here. The main thread should be the only place ticking the StorageManager. You WILL get crashes. - //StorageManager.Tick(); - } -#endif - - delete pSave; - -#ifdef _XBOX_ONE - pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_AND_CONVERT_COMPLETE); -#endif - - pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - - // wipe the list and repopulate it - if(!pStateContainer->m_bSaveTransferCancelled) pStateContainer->m_pClass->m_iState=e_SavesRepopulateAfterTransferDownload; - - //pClass->m_iProgress+=1; - //if(pClass->m_iProgress==101) - //{ - // pClass->m_iProgress=0; - // pClass->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - // pMinecraft->progressRenderer->progressStage( IDS_SAVE_TRANSFER_DOWNLOAD_AND_CONVERT_COMPLETE ); - - // break; - //} - //pMinecraft->progressRenderer->progressStagePercentage(pClass->m_iProgress); - - break; - } - Sleep(50); - } - - if(pStateContainer->m_bSaveTransferCancelled) - { - WCHAR wcTemp[256]; - - pStateContainer->m_bSaveTransferCancelled=false; - swprintf(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLED)); - m_wstrStageText=wcTemp; - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - - } - - pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - pStateContainer->m_bSaveTransferInProgress=false; - - delete pStateContainer; - - return 0; -} - -void UIScene_LoadOrJoinMenu::RequestFileSize( SaveTransferStateContainer *pClass, wchar_t *filename ) -{ - Minecraft *pMinecraft=Minecraft::GetInstance(); - - // get the save file size - pMinecraft->progressRenderer->progressStart(IDS_SAVETRANSFER_TITLE_GET); - pMinecraft->progressRenderer->progressStage( IDS_SAVETRANSFER_STAGE_GET_DETAILS ); - -#ifdef _DEBUG_MENUS_ENABLED - if(app.GetLoadSavesFromFolderEnabled()) - { - ZeroMemory(&m_debugTransferDetails, sizeof(C4JStorage::SAVETRANSFER_FILE_DETAILS) ); - - File targetFile( wstring(L"FakeTMSPP\\").append(filename) ); - if(targetFile.exists()) m_debugTransferDetails.ulFileLen = targetFile.length(); - - SaveTransferReturned(pClass,&m_debugTransferDetails); - } - else -#endif - { - do - { - pMinecraft->progressRenderer->progressStart(IDS_SAVETRANSFER_TITLE_GET); - pMinecraft->progressRenderer->progressStage( IDS_SAVETRANSFER_STAGE_GET_DETAILS ); - Sleep(1); - pClass->m_eSaveTransferState=StorageManager.SaveTransferGetDetails(pClass->m_iPad,C4JStorage::eGlobalStorage_TitleUser,filename,&UIScene_LoadOrJoinMenu::SaveTransferReturned,pClass); - } - while(pClass->m_eSaveTransferState == C4JStorage::eSaveTransfer_Busy && !pClass->m_bSaveTransferCancelled ); - } -} - -void UIScene_LoadOrJoinMenu::RequestFileData( SaveTransferStateContainer *pClass, wchar_t *filename ) -{ - Minecraft *pMinecraft=Minecraft::GetInstance(); - WCHAR wcTemp[256]; - - pMinecraft->progressRenderer->progressStagePercentage(0); - - swprintf(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,UIScene_LoadOrJoinMenu::s_ulFileSize); - m_wstrStageText=wcTemp; - - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - -#ifdef _DEBUG_MENUS_ENABLED - if(app.GetLoadSavesFromFolderEnabled()) - { - File targetFile( wstring(L"FakeTMSPP\\").append(filename) ); - if(targetFile.exists()) - { - HANDLE hSaveFile = CreateFile( targetFile.getPath().c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, nullptr); - - m_debugTransferDetails.pbData = new BYTE[m_debugTransferDetails.ulFileLen]; - - DWORD numberOfBytesRead = 0; - ReadFile( hSaveFile,m_debugTransferDetails.pbData,m_debugTransferDetails.ulFileLen,&numberOfBytesRead,nullptr); - assert(numberOfBytesRead == m_debugTransferDetails.ulFileLen); - - CloseHandle(hSaveFile); - - SaveTransferReturned(pClass,&m_debugTransferDetails); - } - } - else -#endif - { - do - { - pMinecraft->progressRenderer->progressStart(IDS_SAVETRANSFER_TITLE_GET); - pMinecraft->progressRenderer->progressStage( -1 ); - Sleep(1); - pClass->m_eSaveTransferState=StorageManager.SaveTransferGetData(pClass->m_iPad,C4JStorage::eGlobalStorage_TitleUser,filename,&UIScene_LoadOrJoinMenu::SaveTransferReturned,&UIScene_LoadOrJoinMenu::SaveTransferUpdateProgress,pClass,pClass); - } - while(pClass->m_eSaveTransferState == C4JStorage::eSaveTransfer_Busy && !pClass->m_bSaveTransferCancelled ); - } -} - -int UIScene_LoadOrJoinMenu::SaveTransferReturned(LPVOID lpParam,C4JStorage::SAVETRANSFER_FILE_DETAILS *pSaveTransferDetails) -{ - SaveTransferStateContainer* pClass = (SaveTransferStateContainer *) lpParam; - app.DebugPrintf("Save Transfer - size is %d\n",pSaveTransferDetails->ulFileLen); - - // if the file data is null, then assume this is the file size retrieval - if(pSaveTransferDetails->pbData==nullptr) - { - pClass->m_eSaveTransferState=C4JStorage::eSaveTransfer_FileSizeRetrieved; - UIScene_LoadOrJoinMenu::s_ulFileSize=pSaveTransferDetails->ulFileLen; - } - else - { - delete UIScene_LoadOrJoinMenu::s_transferData.data; - UIScene_LoadOrJoinMenu::s_transferData = byteArray(pSaveTransferDetails->pbData, UIScene_LoadOrJoinMenu::s_ulFileSize); - pClass->m_eSaveTransferState=C4JStorage::eSaveTransfer_FileDataRetrieved; - } - - return 0; -} - -int UIScene_LoadOrJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsigned long ulBytesReceived) -{ - WCHAR wcTemp[256]; - - SaveTransferStateContainer* pClass = (SaveTransferStateContainer *) lpParam; - Minecraft *pMinecraft=Minecraft::GetInstance(); - - if(pClass->m_bSaveTransferCancelled) // was cancelled - { - pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING); - swprintf(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING)); - m_wstrStageText=wcTemp; - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - } - else - { - unsigned int uiProgress=(unsigned int)(((float)ulBytesReceived/float(UIScene_LoadOrJoinMenu::s_ulFileSize))*100.0f); - - pMinecraft->progressRenderer->progressStagePercentage(uiProgress); - swprintf(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),((float)(ulBytesReceived))/1024000.0f,((float)UIScene_LoadOrJoinMenu::s_ulFileSize)/1024000.0f); - m_wstrStageText=wcTemp; - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - } - - return 0; -} - -void UIScene_LoadOrJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) -{ - SaveTransferStateContainer* pClass = (SaveTransferStateContainer *) lpParam; - - if(!pClass->m_bSaveTransferCancelled) - { - StorageManager.CancelSaveTransfer(UIScene_LoadOrJoinMenu::CancelSaveTransferCompleteCallback,pClass); - - pClass->m_bSaveTransferCancelled=true; - } - //pClass->m_bSaveTransferInProgress=false; -} - -int UIScene_LoadOrJoinMenu::CancelSaveTransferCompleteCallback(LPVOID lpParam) -{ - SaveTransferStateContainer* pClass = (SaveTransferStateContainer *) lpParam; - // change the state to idle to get the download thread to terminate - pClass->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - return 0; -} - -int UIScene_LoadOrJoinMenu::NeedSyncMessageReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_LoadOrJoinMenu *pClass = (UIScene_LoadOrJoinMenu *)pParam; - LoadMenuInitData *params = (LoadMenuInitData *)pParam; - - if( result == C4JStorage::EMessage_ResultAccept ) - { - // navigate to the settings scene - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadMenu, pClass->m_loadMenuInitData); - } - else - { - delete pClass->m_loadMenuInitData; - pClass->m_bIgnoreInput = false; - } - - return 0; -} - - -#endif - - -#ifdef _XBOX_ONE -void UIScene_LoadOrJoinMenu::HandleDLCLicenseChange() -{ - // may have installed Halloween on this menu - app.StartInstallDLCProcess(m_iPad); -} -#endif - -#if defined _XBOX_ONE || defined __ORBIS__ -int UIScene_LoadOrJoinMenu::CopySaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - - if(result==C4JStorage::EMessage_ResultAccept) - { - - LoadingInputParams *loadingParams = new LoadingInputParams(); - void *uniqueId = (LPVOID)pClass->GetCallbackUniqueId(); - loadingParams->func = &UIScene_LoadOrJoinMenu::CopySaveThreadProc; - loadingParams->lpParam = uniqueId; - loadingParams->waitForThreadToDelete = true; - - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->type = e_ProgressCompletion_NavigateBackToScene; - completionData->iPad = DEFAULT_XUI_MENU_USER; - loadingParams->completionData = completionData; - - loadingParams->cancelFunc=&UIScene_LoadOrJoinMenu::CancelCopySaveCallback; - loadingParams->m_cancelFuncParam=uniqueId; - loadingParams->cancelText=IDS_TOOLTIPS_CANCEL; - - ui.NavigateToScene(iPad,eUIScene_FullscreenProgress, loadingParams); - } - else - { - pClass->m_bIgnoreInput=false; - } - - return 0; -} - -int UIScene_LoadOrJoinMenu::CopySaveThreadProc( LPVOID lpParameter ) -{ - Minecraft *pMinecraft=Minecraft::GetInstance(); - pMinecraft->progressRenderer->progressStart(IDS_PROGRESS_COPYING_SAVE); - pMinecraft->progressRenderer->progressStage( -1 ); - - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParameter); - if( pClass ) - { - pClass->m_bCopying = true; - pClass->m_bCopyingCancelled = false; - ui.LeaveCallbackIdCriticalSection(); - // Copy save data takes two callbacks - one for completion, and one for progress. The progress callback also lets us cancel the operation, if we return false. - StorageManager.CopySaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC],UIScene_LoadOrJoinMenu::CopySaveDataReturned,UIScene_LoadOrJoinMenu::CopySaveDataProgress,lpParameter); - - bool bContinue = true; - do - { - Sleep(100); - ui.EnterCallbackIdCriticalSection(); - pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParameter); - if( pClass ) - { - bContinue = pClass->m_bCopying; - } - else - { - bContinue = false; - } - ui.LeaveCallbackIdCriticalSection(); - } while( bContinue ); - } - else - { - ui.LeaveCallbackIdCriticalSection(); - } - - return 0; -} - -int UIScene_LoadOrJoinMenu::CopySaveDataReturned(LPVOID lpParam, bool success, C4JStorage::ESaveGameState stat) -{ - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); - - if(pClass) - { - if(success) - { - pClass->m_bCopying = false; - // wipe the list and repopulate it - pClass->m_iState=e_SavesRepopulateAfterDelete; - ui.LeaveCallbackIdCriticalSection(); - } - else - { -#ifdef __ORBIS__ - UINT uiIDA[1]; - // you cancelled the save on exit after choosing exit and save? You go back to the Exit choices then. - uiIDA[0]=IDS_OK; - - if( stat == C4JStorage::ESaveGame_CopyCompleteFailLocalStorage ) - { - ui.LeaveCallbackIdCriticalSection(); - ui.RequestErrorMessage(IDS_COPYSAVE_FAILED_TITLE, IDS_COPYSAVE_FAILED_LOCAL, uiIDA, 1, ProfileManager.GetPrimaryPad(), CopySaveErrorDialogFinishedCallback, lpParam); - } - else if( stat == C4JStorage::ESaveGame_CopyCompleteFailQuota ) - { - ui.LeaveCallbackIdCriticalSection(); - ui.RequestErrorMessage(IDS_COPYSAVE_FAILED_TITLE, IDS_COPYSAVE_FAILED_QUOTA, uiIDA, 1, ProfileManager.GetPrimaryPad(), CopySaveErrorDialogFinishedCallback, lpParam); - } - else - { - pClass->m_bCopying = false; - ui.LeaveCallbackIdCriticalSection(); - } -#else - pClass->m_bCopying = false; - ui.LeaveCallbackIdCriticalSection(); -#endif - } - } - else - { - ui.LeaveCallbackIdCriticalSection(); - } - return 0; -} - -bool UIScene_LoadOrJoinMenu::CopySaveDataProgress(LPVOID lpParam, int percent) -{ - bool bContinue = false; - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); - if( pClass ) - { - bContinue = !pClass->m_bCopyingCancelled; - } - ui.LeaveCallbackIdCriticalSection(); - Minecraft *pMinecraft=Minecraft::GetInstance(); - pMinecraft->progressRenderer->progressStagePercentage(percent); - - return bContinue; -} - -void UIScene_LoadOrJoinMenu::CancelCopySaveCallback(LPVOID lpParam) -{ - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); - if( pClass ) - { - pClass->m_bCopyingCancelled = true; - } - ui.LeaveCallbackIdCriticalSection(); -} - -int UIScene_LoadOrJoinMenu::CopySaveErrorDialogFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)pParam); - if( pClass ) - { - pClass->m_bCopying = false; - } - ui.LeaveCallbackIdCriticalSection(); - - return 0; -} - -#endif // _XBOX_ONE #ifdef _WINDOWS64 // adding servers bellow diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h index 76a7ed43..ec0abe18 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h @@ -187,15 +187,6 @@ private: static int AddServerKeyboardCallback(LPVOID lpParam, bool bRes); #endif -#if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__) - static int MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int PSN_SignInReturned(void *pParam,bool bContinue, int iPad); - static void remoteStorageGetSaveCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code); -#endif - -#ifdef __ORBIS__ - //static int PSPlusReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); -#endif #ifdef _XBOX_ONE typedef struct _SaveTransferStateContainer { diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp index 6e341db4..27069599 100644 --- a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp @@ -160,13 +160,7 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) { // For returning to menus after exiting a game. if (ProfileManager.IsSignedIn(iPad) ) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); - #else - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); } } ProfileManager.SetLockedProfile(-1); @@ -538,108 +532,13 @@ int UIScene_MainMenu::MustSignInReturned(void *pParam, int iPad, C4JStorage::EMe { // if the user is valid, we should set the presence if(ProfileManager.IsSignedIn(i)) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); - #else - ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); } } return 0; } -#if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__) -int UIScene_MainMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; - - if(result==C4JStorage::EMessage_ResultAccept) - { -#ifdef __PS3__ - // we need to specify local game here to display local and LIVE profiles in the list - switch(pClass->m_eAction) - { - case eAction_RunLeaderboardsPSN: - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_MainMenu::Leaderboards_SignInReturned, pClass); - break; - case eAction_RunGamePSN: - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_MainMenu::CreateLoad_SignInReturned, pClass); - break; - case eAction_RunUnlockOrDLCPSN: - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_MainMenu::UnlockFullGame_SignInReturned, pClass); - break; - } -#elif defined __PSVITA__ - switch(pClass->m_eAction) - { - case eAction_RunLeaderboardsPSN: - //CD - Must force Ad-Hoc off if they want leaderboard PSN sign-in - //Save settings change - app.SetGameSettings(0, eGameSetting_PSVita_NetworkModeAdhoc, 0); - //Force off - CGameNetworkManager::setAdhocMode(false); - //Now Sign-in - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_MainMenu::Leaderboards_SignInReturned, pClass); - break; - case eAction_RunGamePSN: - if(CGameNetworkManager::usingAdhocMode()) - { - SQRNetworkManager_AdHoc_Vita::AttemptAdhocSignIn(&UIScene_MainMenu::CreateLoad_SignInReturned, pClass); - } - else - { - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_MainMenu::CreateLoad_SignInReturned, pClass); - - } - break; - case eAction_RunUnlockOrDLCPSN: - //CD - Must force Ad-Hoc off if they want commerce PSN sign-in - //Save settings change - app.SetGameSettings(0, eGameSetting_PSVita_NetworkModeAdhoc, 0); - //Force off - CGameNetworkManager::setAdhocMode(false); - //Now Sign-in - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_MainMenu::UnlockFullGame_SignInReturned, pClass); - break; - } -#else - switch(pClass->m_eAction) - { - case eAction_RunLeaderboardsPSN: - SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_MainMenu::Leaderboards_SignInReturned, pClass, true, iPad); - break; - case eAction_RunGamePSN: - SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_MainMenu::CreateLoad_SignInReturned, pClass, true, iPad); - break; - case eAction_RunUnlockOrDLCPSN: - SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_MainMenu::UnlockFullGame_SignInReturned, pClass, true, iPad); - break; - } - -#endif - } - else - { - if( pClass->m_eAction == eAction_RunGamePSN ) - { - if( result == C4JStorage::EMessage_Cancelled) - CreateLoad_SignInReturned(pClass, false, 0); - else - CreateLoad_SignInReturned(pClass, true, 0); - } - else - { - pClass->m_bIgnorePress=false; - } - } - - return 0; -} -#endif - #ifdef _XBOX_ONE int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad, int iController) #else @@ -651,11 +550,8 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue, if(bContinue) { // 4J-JEV: Don't we only need to update rich-presence if the sign-in status changes. - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); - #else - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); - #endif + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); + #if TO_BE_IMPLEMENTED if(app.GetTMSDLCInfoRead()) #endif @@ -695,13 +591,7 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue, { // if the user is valid, we should set the presence if(ProfileManager.IsSignedIn(i)) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); - #else - ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); } } @@ -729,12 +619,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in if(bContinue) { // 4J-JEV: We only need to update rich-presence if the sign-in status changes. - - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); - #else - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); - #endif + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); UINT uiIDA[1] = { IDS_OK }; @@ -754,21 +639,6 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in if(ProfileManager.IsFullVersion()) { bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); -#ifdef __PSVITA__ - if(CGameNetworkManager::usingAdhocMode()) - { - if(SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) - { - bSignedInLive = true; - } - else - { - // adhoc mode, but we didn't make the connection, turn off adhoc mode, and just go with whatever the regular online status is - CGameNetworkManager::setAdhocMode(false); - bSignedInLive = ProfileManager.IsSignedInLive(iPad); - } - } -#endif // Check if we're signed in to LIVE if(bSignedInLive) @@ -916,13 +786,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in { // if the user is valid, we should set the presence if(ProfileManager.IsSignedIn(i)) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); - #else - ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); } } @@ -940,11 +804,7 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,in if(bContinue) { // 4J-JEV: We only need to update rich-presence if the sign-in status changes. - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); - #else - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); - #endif + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); UINT uiIDA[1] = { IDS_OK }; @@ -994,13 +854,7 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,in { // if the user is valid, we should set the presence if(ProfileManager.IsSignedIn(i)) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); - #else - ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); } } @@ -1019,11 +873,7 @@ int UIScene_MainMenu::Achievements_SignInReturned(void *pParam,bool bContinue,in { pClass->m_bIgnorePress=false; // 4J-JEV: We only need to update rich-presence if the sign-in status changes. - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); - #else - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); - #endif + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); XShowAchievementsUI( ProfileManager.GetPrimaryPad() ); } @@ -1036,13 +886,7 @@ int UIScene_MainMenu::Achievements_SignInReturned(void *pParam,bool bContinue,in { // if the user is valid, we should set the presence if(ProfileManager.IsSignedIn(i)) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); - #else - ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); } } @@ -1060,11 +904,7 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void *pParam,bool bContinue, if (bContinue) { // 4J-JEV: We only need to update rich-presence if the sign-in status changes. - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); - #else - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); - #endif + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); pClass->RunUnlockOrDLC(iPad); } @@ -1077,13 +917,7 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void *pParam,bool bContinue, { // if the user is valid, we should set the presence if(ProfileManager.IsSignedIn(i)) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); - #else - ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); } } @@ -1110,9 +944,7 @@ int UIScene_MainMenu::XboxHelp_SignInReturned(void *pParam, bool bContinue, int { // if the user is valid, we should set the presence if(ProfileManager.IsSignedIn(i)) - { - ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MENUS); } } @@ -1582,55 +1414,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) } else if(!ProfileManager.IsSignedInLive(iPad)) { -#if defined __PS3__ || defined __PSVITA__ - m_eAction=eAction_RunLeaderboardsPSN; - // get them to sign in to online - UINT uiIDA[1]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); - -/* 4J-PB - Add this after release -#elif defined __PSVITA__ - m_eAction=eAction_RunLeaderboardsPSN; - // Determine why they're not "signed in live" - if (ProfileManager.IsSignedInPSN(iPad)) - { - // Signed in to PSN but not connected (no internet access) - UINT uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox(IDS_PRO_CURRENTLY_NOT_ONLINE_TITLE, IDS_PRO_PSNOFFLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable()); - } - else - { - // Not signed in to PSN - UINT uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable()); - return; - }*/ -#elif defined __ORBIS__ - m_eAction=eAction_RunLeaderboardsPSN; - // Determine why they're not "signed in live" - if (ProfileManager.isSignedInPSN(iPad)) - { - // Signed in to PSN but not connected (no internet access) - assert(!ProfileManager.isConnectedToPSN(iPad)); - - UINT uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); - } - else - { - // Not signed in to PSN - UINT uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this); - return; - } -#else ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); -#endif } else { @@ -1675,58 +1459,6 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) // Check if this means downloadable content if(ProfileManager.IsFullVersion()) { -#ifdef __ORBIS__ - // 4J-PB - Check if there is a patch for the game - m_errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); - - bool bPatchAvailable; - switch(m_errorCode) - { - case SCE_NP_ERROR_LATEST_PATCH_PKG_EXIST: - case SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED: - bPatchAvailable=true; - break; - default: - bPatchAvailable=false; - break; - } - - if(bPatchAvailable) - { - m_bIgnorePress=false; - - int32_t ret=sceErrorDialogInitialize(); - m_bErrorDialogRunning=true; - if ( ret==SCE_OK ) - { - SceErrorDialogParam param; - sceErrorDialogParamInitialize( ¶m ); - // 4J-PB - We want to display the option to get the patch now - param.errorCode = SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED;//pClass->m_errorCode; - ret = sceUserServiceGetInitialUser( ¶m.userId ); - if ( ret == SCE_OK ) - { - ret=sceErrorDialogOpen( ¶m ); - } - } - -// UINT uiIDA[1]; -// uiIDA[0]=IDS_OK; -// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,nullptr,this); - return; - } - - // Check if PSN is unavailable because of age restriction - if (m_errorCode == SCE_NP_ERROR_AGE_RESTRICTION) - { - m_bIgnorePress=false; - UINT uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, this); - - return; - } -#endif // downloadable content if(ProfileManager.IsSignedInLive(iPad)) { @@ -1800,39 +1532,9 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) } else { -#if defined(__PS3__) || defined(__PSVITA__) - m_eAction=eAction_RunUnlockOrDLCPSN; - // get them to sign in to online - UINT uiIDA[1]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - //uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); -#elif defined __ORBIS__ - m_eAction=eAction_RunUnlockOrDLCPSN; - // Determine why they're not "signed in live" - if (ProfileManager.isSignedInPSN(iPad)) - { - m_bIgnorePress=false; - // Signed in to PSN but not connected (no internet access) - assert(!ProfileManager.isConnectedToPSN(iPad)); - - UINT uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); - } - else - { - // Not signed in to PSN - UINT uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this); - return; - } -#else UINT uiIDA[1]; uiIDA[0]=IDS_OK; ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); -#endif } } else @@ -1845,39 +1547,9 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) } else if(!ProfileManager.IsSignedInLive(iPad)) { -#if defined(__PS3__) || defined(__PSVITA__) - m_eAction=eAction_RunUnlockOrDLCPSN; - // get them to sign in to online - UINT uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); -#elif defined __ORBIS__ - m_eAction=eAction_RunUnlockOrDLCPSN; - // Determine why they're not "signed in live" - if (ProfileManager.isSignedInPSN(iPad)) - { - m_bIgnorePress=false; - // Signed in to PSN but not connected (no internet access) - assert(!ProfileManager.isConnectedToPSN(iPad)); - - UINT uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); - } - else - { - // Not signed in to PSN - UINT uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this); - return; - } -#else UINT uiIDA[1]; uiIDA[0]=IDS_OK; ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); -#endif - } else { @@ -2173,25 +1845,4 @@ void UIScene_MainMenu::LoadTrial(void) void UIScene_MainMenu::handleUnlockFullVersion() { m_buttons[static_cast(eControl_UnlockOrDLC)].setLabel(IDS_DOWNLOADABLECONTENT,true); -} - - -#ifdef __PSVITA__ -int UIScene_MainMenu::SelectNetworkModeReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; - - if(result==C4JStorage::EMessage_ResultAccept) - { - app.DebugPrintf("Setting network mode to PSN\n"); - app.SetGameSettings(0, eGameSetting_PSVita_NetworkModeAdhoc, 0); - } - else if(result==C4JStorage::EMessage_ResultDecline) - { - app.DebugPrintf("Setting network mode to Adhoc\n"); - app.SetGameSettings(0, eGameSetting_PSVita_NetworkModeAdhoc, 1); - } - pClass->updateTooltips(); - return 0; -} -#endif //__PSVITA__ +} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.h b/Minecraft.Client/Common/UI/UIScene_MainMenu.h index 2b49a44b..fb4fec74 100644 --- a/Minecraft.Client/Common/UI/UIScene_MainMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_MainMenu.h @@ -12,11 +12,7 @@ private: eControl_Achievements, eControl_HelpAndOptions, eControl_UnlockOrDLC, -#ifndef _DURANGO eControl_Exit, -#else - eControl_XboxHelp, -#endif eControl_Count, }; @@ -37,11 +33,8 @@ private: UI_MAP_ELEMENT( m_buttons[(int)eControl_Achievements], "Button3") UI_MAP_ELEMENT( m_buttons[(int)eControl_HelpAndOptions], "Button4") UI_MAP_ELEMENT( m_buttons[(int)eControl_UnlockOrDLC], "Button5") -#ifndef _DURANGO UI_MAP_ELEMENT( m_buttons[(int)eControl_Exit], "Button6") -#else - UI_MAP_ELEMENT( m_buttons[(int)eControl_XboxHelp], "Button6") -#endif + UI_MAP_ELEMENT( m_controlTimer, "Timer") UI_END_MAP_ELEMENTS_AND_NAMES() @@ -49,13 +42,6 @@ private: bool m_bIgnorePress; bool m_bTrialVersion; bool m_bLoadTrialOnNetworkManagerReady; -#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - bool m_bLaunchFullVersionPurchase; -#endif - -#ifdef _XBOX_ONE - bool m_bWaitingForDLCInfo; -#endif float m_fScreenWidth,m_fScreenHeight; float m_fRawWidth,m_fRawHeight; @@ -80,14 +66,6 @@ private: eAction_RunAchievements, eAction_RunHelpAndOptions, eAction_RunUnlockOrDLC, -#if defined(__PS3__)|| defined(__PSVITA__) || defined(__ORBIS__) - eAction_RunLeaderboardsPSN, - eAction_RunGamePSN, - eAction_RunUnlockOrDLCPSN, -#elif defined _DURANGO - eAction_RunXboxHelp, -#endif - }; eActions m_eAction; @@ -147,49 +125,12 @@ private: static void LoadTrial(); -#ifdef _XBOX_ONE - static int ChooseUser_SignInReturned(void *pParam,bool bContinue, int iPad, int iController); - static int CreateLoad_SignInReturned(void *pParam,bool bContinue, int iPad, int iController); - static int HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad, int iController); - static int Achievements_SignInReturned(void *pParam,bool bContinue,int iPad, int iController); - static int MustSignInReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - - static int Leaderboards_SignInReturned(void* pParam, bool bContinue, int iPad, int iController); - static int UnlockFullGame_SignInReturned(void *pParam,bool bContinue,int iPad, int iController); - static int ExitGameReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - - - static int XboxHelp_SignInReturned(void *pParam, bool bContinue, int iPad, int iController); -#else - static int CreateLoad_SignInReturned(void *pParam,bool bContinue, int iPad); static int HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad); static int Achievements_SignInReturned(void *pParam,bool bContinue,int iPad); static int MustSignInReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); -#if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__) - static int MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result); -#endif static int Leaderboards_SignInReturned(void* pParam, bool bContinue, int iPad); static int UnlockFullGame_SignInReturned(void *pParam,bool bContinue,int iPad); static int ExitGameReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - -#ifdef __ORBIS__ - static void RefreshChatAndContentRestrictionsReturned_PlayGame(void *pParam); - static void RefreshChatAndContentRestrictionsReturned_Leaderboards(void *pParam); - - static int PlayOfflineReturned(void *pParam, int iPad, C4JStorage::EMessageResult result); -#endif -#endif - -#ifdef __PSVITA__ - static int SelectNetworkModeReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); -#endif - -#ifdef __ORBIS__ - //EPatchCheck m_ePatchCheckState; - bool m_bRunGameChosen; - int32_t m_errorCode; - bool m_bErrorDialogRunning; -#endif }; diff --git a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp index 779413cf..8e1bdc6a 100644 --- a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp @@ -281,13 +281,6 @@ void UIScene_PauseMenu::updateControlsVisibility() removeControl( &m_buttons[BUTTON_PAUSE_ACHIEVEMENTS], false ); #endif } -#ifdef __PSVITA__ - // MGH added - remove leaderboards in adhoc - if(CGameNetworkManager::usingAdhocMode()) - { - removeControl( &m_buttons[BUTTON_PAUSE_LEADERBOARDS], false ); - } -#endif if( !g_NetworkManager.IsHost() ) { @@ -347,10 +340,6 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, bool pressed case ACTION_MENU_CANCEL: if(pressed) { -#ifdef _DURANGO - //DurangoStatsDebugger::PrintStats(iPad); -#endif - if( iPad == ProfileManager.GetPrimaryPad() && g_NetworkManager.IsLocalGame() ) { app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)FALSE); @@ -376,102 +365,6 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, bool pressed } break; -#if TO_BE_IMPLEMENTED - case VK_PAD_X: - // Change device - if(bIsisPrimaryHost) - { - // we need a function to deal with the return from this - if it changes, we need to update the pause menu and tooltips - // Fix for #12531 - TCR 001: BAS Game Stability: When a player selects to change a storage - // device, and repeatedly backs out of the SD screen, disconnects from LIVE, and then selects a SD, the title crashes. - m_bIgnoreInput=true; - - StorageManager.SetSaveDevice(&UIScene_PauseMenu::DeviceSelectReturned,this,true); - } - rfHandled = TRUE; - break; -#endif - - case ACTION_MENU_Y: - { - -#if defined(__PS3__) || defined(__ORBIS__) - if(pressed && iPad == ProfileManager.GetPrimaryPad()) - { -#ifdef __ORBIS__ - // If a patch is available, can't view invites - if (CheckForPatch()) break; -#endif - - // Are we offline? - if(!ProfileManager.IsSignedInLive(iPad)) - { - m_eAction=eAction_ViewInvitesPSN; -#ifdef __ORBIS__ - int npAvailability = ProfileManager.getNPAvailability(iPad); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive is the npAvailability isn't SCE_OK - UINT uiIDA[1]; - uiIDA[0]=IDS_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); - } - else - // Determine why they're not "signed in live" - if (ProfileManager.isSignedInPSN(iPad)) - { - // Signed in to PSN but not connected (no internet access) - assert(!ProfileManager.isConnectedToPSN(iPad)); - - UINT uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); - } - else - { - // Not signed in to PSN - UINT uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, (LPVOID)GetCallbackUniqueId() ); - } -#else // __PS3__ - // get them to sign in to online - UINT uiIDA[1]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, (LPVOID)GetCallbackUniqueId() ); -#endif - } - else - { -#ifdef __ORBIS__ - SQRNetworkManager_Orbis::RecvInviteGUI(); -#else // __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); -#endif - } - } -#else -#if TO_BE_IMPLEMENTED - if(bUserisClientSide) - { - // 4J Stu - Added check in 1.8.2 bug fix (TU6) to stop repeat key presses - bool bCanScreenshot = true; - for(int j=0; j < XUSER_MAX_COUNT;++j) - { - if(app.GetXuiAction(j) == eAppAction_SocialPostScreenshot) - { - bCanScreenshot = false; - break; - } - } - if(bCanScreenshot) app.SetAction(pInputData->UserIndex,eAppAction_SocialPost); - } - rfHandled = TRUE; -#endif -#endif // __PS3__ - } - break; #ifdef _XBOX_ONE case ACTION_MENU_RIGHT_SCROLL: if( bDisplayBanTip ) @@ -516,114 +409,18 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) } else if(!ProfileManager.IsSignedInLive(m_iPad)) { -#ifdef __ORBIS__ - // If a patch is available, can't show leaderboard - if (CheckForPatch()) break; - - // Check for content restricted user - // Update error code - int errorCode = ProfileManager.getNPAvailability(m_iPad); - - // Check if PSN is unavailable because of age restriction - if (errorCode == SCE_NP_ERROR_AGE_RESTRICTION) - { - UINT uiIDA[1]; - uiIDA[0] = IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, m_iPad); - - break;; - } - -#endif - -#if defined __PS3__ || __PSVITA__ - // get them to sign in to online - m_eAction=eAction_ViewLeaderboardsPSN; - UINT uiIDA[1]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_PauseMenu::MustSignInReturnedPSN,(LPVOID)GetCallbackUniqueId() ); -#elif defined(__ORBIS__) - m_eAction=eAction_ViewLeaderboardsPSN; - int npAvailability = ProfileManager.getNPAvailability(m_iPad); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive is the npAvailability isn't SCE_OK - UINT uiIDA[1]; - uiIDA[0]=IDS_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, m_iPad); - } - else - // Determine why they're not "signed in live" - if (ProfileManager.isSignedInPSN(m_iPad)) - { - // Signed in to PSN but not connected (no internet access) - - // Id - assert(!ProfileManager.isConnectedToPSN(m_iPad)); - - UINT uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, m_iPad); - } - else - { - // Not signed in to PSN - UINT uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, m_iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, (LPVOID)GetCallbackUniqueId() ); - } -#else UINT uiIDA[1] = { IDS_OK }; ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, m_iPad); -#endif } else { bool bContentRestricted=false; -#if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(m_iPad,true,nullptr,&bContentRestricted,nullptr); -#endif - if(bContentRestricted) - { -#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms - // you can't see leaderboards - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, m_iPad); -#endif - } - else - { + + if(!bContentRestricted) ui.NavigateToScene(m_iPad, eUIScene_LeaderboardsMenu); - } } } break; -#ifdef _DURANGO - case BUTTON_PAUSE_XBOXHELP: - { - // 4J: Launch the crummy xbox help application. - WXS::User^ user = ProfileManager.GetUser(m_iPad); - Windows::Xbox::ApplicationModel::Help::Show(user); - } - break; -#elif TO_BE_IMPLEMENTED - case BUTTON_PAUSE_ACHIEVEMENTS: - - // guests can't look at achievements - if(ProfileManager.IsGuest(pNotifyPressData->UserIndex)) - { - UINT uiIDA[1]; - uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad()); - } - else - { - XShowAchievementsUI( pNotifyPressData->UserIndex ); - } - break; -#endif - case BUTTON_PAUSE_HELPANDOPTIONS: ui.NavigateToScene(m_iPad,eUIScene_HelpAndOptionsMenu); break; @@ -933,456 +730,7 @@ int UIScene_PauseMenu::BanGameDialogReturned(void *pParam,int iPad,C4JStorage::E } #endif -#if defined(__PS3__) || defined (__PSVITA__) || defined(__ORBIS__) -int UIScene_PauseMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)ui.GetSceneFromCallbackId((size_t)pParam); - if(result==C4JStorage::EMessage_ResultAccept && pClass) - { -#ifdef __PS3__ - switch(pClass->m_eAction) - { - case eAction_ViewLeaderboardsPSN: - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_PauseMenu::ViewLeaderboards_SignInReturned, pParam); - break; - case eAction_ViewInvitesPSN: - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_PauseMenu::ViewInvites_SignInReturned, pParam); - break; - case eAction_SaveGamePSN: - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_PauseMenu::SaveGame_SignInReturned, pParam); - break; - case eAction_BuyTexturePackPSN: - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_PauseMenu::BuyTexturePack_SignInReturned, pParam); - break; - } -#elif defined __PSVITA__ - switch(pClass->m_eAction) - { - case eAction_ViewLeaderboardsPSN: - //CD - Must force Ad-Hoc off if they want leaderboard PSN sign-in - //Save settings change - app.SetGameSettings(0, eGameSetting_PSVita_NetworkModeAdhoc, 0); - //Force off - CGameNetworkManager::setAdhocMode(false); - //Now Sign-in - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_PauseMenu::ViewLeaderboards_SignInReturned, pParam); - break; - case eAction_ViewInvitesPSN: - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_PauseMenu::ViewInvites_SignInReturned, pParam); - break; - case eAction_SaveGamePSN: - pClass->SetIgnoreInput(true); - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_PauseMenu::SaveGame_SignInReturned, pParam, true); - break; - case eAction_BuyTexturePackPSN: - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_PauseMenu::BuyTexturePack_SignInReturned, pParam); - break; - } -#else - switch(pClass->m_eAction) - { - case eAction_ViewLeaderboardsPSN: - SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_PauseMenu::ViewLeaderboards_SignInReturned, pClass, false, iPad); - break; - case eAction_ViewInvitesPSN: - SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_PauseMenu::ViewInvites_SignInReturned, pClass, false, iPad); - break; - case eAction_SaveGamePSN: - SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_PauseMenu::SaveGame_SignInReturned, pClass, false, iPad); - break; - case eAction_BuyTexturePackPSN: - SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_PauseMenu::BuyTexturePack_SignInReturned, pClass, false, iPad); - break; - } -#endif - } - - return 0; -} - -int UIScene_PauseMenu::ViewLeaderboards_SignInReturned(void *pParam,bool bContinue, int iPad) -{ - UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)ui.GetSceneFromCallbackId((size_t)pParam); - if(!pClass) return 0; - - if(bContinue==true) - { - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - - // guests can't look at leaderboards - if(ProfileManager.IsGuest(pClass->m_iPad)) - { - ui.RequestAlertMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad()); - } - else if(ProfileManager.IsSignedInLive(iPad)) - { -#ifndef __ORBIS__ - bool bContentRestricted=false; - ProfileManager.GetChatAndContentRestrictions(pClass->m_iPad,true,nullptr,&bContentRestricted,nullptr); - if(bContentRestricted) - { - // you can't see leaderboards - ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad()); - } - else -#endif - { - ui.NavigateToScene(pClass->m_iPad, eUIScene_LeaderboardsMenu); - } - } - } - - return 0; -} - -int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)ui.GetSceneFromCallbackId((size_t)pParam); - -#ifdef __ORBIS__ - // If a patch is available, can't proceed - if (!pClass || pClass->CheckForPatch()) return 0; -#endif - -#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - if(result==C4JStorage::EMessage_ResultAccept) - { - if(!ProfileManager.IsSignedInLive(iPad)) - { - if(pClass) pClass->m_eAction=eAction_SaveGamePSN; -#ifdef __ORBIS__// Check if PSN is unavailable because of age restriction - int npAvailability = ProfileManager.getNPAvailability(iPad); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive is the npAvailability isn't SCE_OK - UINT uiIDA[1]; - uiIDA[0]=IDS_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); - } - else - // Determine why they're not "signed in live" - if (ProfileManager.isSignedInPSN(iPad)) - { - // Signed in to PSN but not connected (no internet access) - assert(!ProfileManager.isConnectedToPSN(iPad)); - - UINT uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); - } - else - { - UINT uiIDA[1]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, pParam); - } -#else // __PS3__ - // You're not signed in to PSN! - UINT uiIDA[2]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 2, iPad,&UIScene_PauseMenu::MustSignInReturnedPSN,pParam); -#endif - } - else - { -#ifndef __ORBIS__ - // 4J-PB - need to check this user can access the store - bool bContentRestricted=false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); - if(bContentRestricted) - { - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); - } - else -#endif - { - // need to get info on the pack to see if the user has already downloaded it - TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; - - // retrieve the store name for the skin pack - DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); - const char *pchPackName=wstringtofilename(pDLCPack->getName()); - app.DebugPrintf("Texture Pack - %s\n",pchPackName); - SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - - if(pSONYDLCInfo!=nullptr) - { - char chName[42]; - char chKeyName[20]; - char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; - - memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); - // find the info on the skin pack - // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. - // So we assume the first sku for the product is the one we want - - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char - memset(chKeyName, 0, sizeof(chKeyName)); - strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); - -#ifdef __ORBIS__ - strcpy(chName, chKeyName); -#else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); -#endif - app.GetDLCSkuIDFromProductList(chName,chSkuID); - - // 4J-PB - need to check for an empty store -#if defined __ORBIS__ || defined __PSVITA__ || defined __PS3__ - if(app.CheckForEmptyStore(iPad)==false) -#endif - { - if(app.DLCAlreadyPurchased(chSkuID)) - { - app.DownloadAlreadyPurchased(chSkuID); - } - else - { - app.Checkout(chSkuID); - } - } - } - } - } - } -#endif // - - return 0; -} - -int UIScene_PauseMenu::BuyTexturePack_SignInReturned(void *pParam,bool bContinue, int iPad) -{ - if(bContinue==true) - { - // Check if we're signed in to LIVE - if(ProfileManager.IsSignedInLive(iPad)) - { -#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - -#ifndef __ORBIS__ - // 4J-PB - need to check this user can access the store - bool bContentRestricted=false; - ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); - if(bContentRestricted) - { - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); - } - else -#endif - { - // need to get info on the pack to see if the user has already downloaded it - TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; - - // retrieve the store name for the skin pack - DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); - const char *pchPackName=wstringtofilename(pDLCPack->getName()); - app.DebugPrintf("Texture Pack - %s\n",pchPackName); - SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - - if(pSONYDLCInfo!=nullptr) - { - char chName[42]; - char chKeyName[20]; - char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; - - memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); - // find the info on the skin pack - // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. - // So we assume the first sku for the product is the one we want - - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char - memset(chKeyName, 0, sizeof(chKeyName)); - strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); - -#ifdef __ORBIS__ - strcpy(chName, chKeyName); -#else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); -#endif - app.GetDLCSkuIDFromProductList(chName,chSkuID); - - // 4J-PB - need to check for an empty store -#if defined __ORBIS__ || defined __PSVITA__ || defined __PS3__ - if(app.CheckForEmptyStore(iPad)==false) -#endif - { - if(app.DLCAlreadyPurchased(chSkuID)) - { - app.DownloadAlreadyPurchased(chSkuID); - } - else - { - app.Checkout(chSkuID); - } - } - } - } -#else - // TO BE IMPEMENTED FOR ORBIS -#endif - } - } - return 0; -} - -int UIScene_PauseMenu::ViewInvites_SignInReturned(void *pParam,bool bContinue, int iPad) -{ - if(bContinue==true) - { - // Check if we're signed in to LIVE - if(ProfileManager.IsSignedInLive(iPad)) - { -#ifdef __ORBIS__ - SQRNetworkManager_Orbis::RecvInviteGUI(); -#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__ - PSVITA_STUBBED; -#endif - } - } - return 0; -} - - -int UIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - // Exit with or without saving - // Decline means save in this dialog - if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption) - { - if( result==C4JStorage::EMessage_ResultDecline ) // Save - { - // 4J-PB - Is the player trying to save but they are using a trial texturepack ? - if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) - { - TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; - - DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); - if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) - { -#ifdef _XBOX - // upsell - ULONGLONG ullOfferID_Full; - // get the dlc texture pack - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; - - app.GetDLCFullOfferIDForPackID(pDLCTexPack->getDLCParentPackId(),&ullOfferID_Full); - - // tell sentient about the upsell of the full version of the skin pack - TelemetryManager->RecordUpsellPresented(iPad, eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); -#endif - - UINT uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_OK; - uiIDA[1]=IDS_CONFIRM_CANCEL; - - // Give the player a warning about the trial version of the texture pack - ui.RequestAlertMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad() ,&UIScene_PauseMenu::WarningTrialTexturePackReturned, pParam); - - return S_OK; - } - } - - // does the save exist? - bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); - // 4J-PB - we check if the save exists inside the libs - // we need to ask if they are sure they want to overwrite the existing game - if(bSaveExists) - { - UINT uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_CANCEL; - uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&IUIScene_PauseMenu::ExitGameAndSaveReturned, pParam); - return 0; - } - else - { -#if defined(_XBOX_ONE) || defined(__ORBIS__) - StorageManager.SetSaveDisabled(false); -#endif - MinecraftServer::getInstance()->setSaveOnExit( true ); - } - } - else - { - // been a few requests for a confirm on exit without saving - UINT uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_CANCEL; - uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_TITLE_DECLINE_SAVE_GAME, IDS_CONFIRM_DECLINE_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&IUIScene_PauseMenu::ExitGameDeclineSaveReturned, pParam); - return 0; - } - - app.SetAction(iPad,eAppAction_ExitWorld); - } - return 0; -} - -#endif - void UIScene_PauseMenu::SetIgnoreInput(bool ignoreInput) { m_bIgnoreInput = ignoreInput; -} - -#ifdef _XBOX_ONE -void UIScene_PauseMenu::HandleDLCLicenseChange() -{ -} -#endif - -#ifdef __ORBIS__ -bool UIScene_PauseMenu::CheckForPatch() -{ - int npAvailability = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); - - bool bPatchAvailable; - switch(npAvailability) - { - case SCE_NP_ERROR_LATEST_PATCH_PKG_EXIST: - case SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED: - bPatchAvailable=true; - break; - default: - bPatchAvailable=false; - break; - } - - if(bPatchAvailable) - { - int32_t ret = sceErrorDialogInitialize(); - if ( ret==SCE_OK ) - { - m_bErrorDialogRunning = true; - - SceErrorDialogParam param; - sceErrorDialogParamInitialize( ¶m ); - // 4J-PB - We want to display the option to get the patch now - param.errorCode = SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED;//pClass->m_errorCode; - ret = sceUserServiceGetInitialUser( ¶m.userId ); - if ( ret == SCE_OK ) - { - ret = sceErrorDialogOpen( ¶m ); - } - else - { - sceErrorDialogTerminate(); - } - } - } - - return bPatchAvailable; -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_PauseMenu.h b/Minecraft.Client/Common/UI/UIScene_PauseMenu.h index f1bd53aa..854b6aa5 100644 --- a/Minecraft.Client/Common/UI/UIScene_PauseMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_PauseMenu.h @@ -91,15 +91,6 @@ protected: private: void PerformActionSaveGame(); -#if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__) - static int MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int ViewLeaderboards_SignInReturned(void *pParam,bool bContinue, int iPad); - static int ViewInvites_SignInReturned(void *pParam,bool bContinue, int iPad); - static int BuyTexturePack_SignInReturned(void *pParam,bool bContinue, int iPad); - static int WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); -#endif - protected: #ifdef _XBOX_ONE static int BanGameDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index bf8771a6..f8474016 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -487,15 +487,6 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) UINT uiIDA[1]; uiIDA[0]=IDS_OK; -#ifdef __ORBIS__ - // Check if PSN is unavailable because of age restriction - int npAvailability = ProfileManager.getNPAvailability(iPad); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); - } - else -#endif // We need to upsell the full version if(ProfileManager.IsGuest(iPad)) { @@ -1499,33 +1490,6 @@ void UIScene_SkinSelectMenu::HandleDLCMountingComplete() void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) { - // need to be signed in to live. get them to sign in to online -#if defined(__PS3__) - SQRNetworkManager_PS3::AttemptPSNSignIn(nullptr, this); - -#elif defined(__PSVITA__) - if(CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) - { - // we're in adhoc mode, we really need to ask before disconnecting - UINT uiIDA[2]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_CANCEL; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_SkinSelectMenu::MustSignInReturned,nullptr); - } - else - { - SQRNetworkManager_Vita::AttemptPSNSignIn(nullptr, this); - } - -#elif defined(__ORBIS__) - SQRNetworkManager_Orbis::AttemptPSNSignIn(nullptr, this, false, iPad); - -#elif defined(_DURANGO) - - UINT uiIDA[1] = { IDS_CONFIRM_OK }; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad ); - -#endif } int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) diff --git a/Minecraft.Client/LocalPlayer.cpp b/Minecraft.Client/LocalPlayer.cpp index f4e55979..c6f51f32 100644 --- a/Minecraft.Client/LocalPlayer.cpp +++ b/Minecraft.Client/LocalPlayer.cpp @@ -510,11 +510,8 @@ void LocalPlayer::aiStep() // Check if the player is idle and the rich presence needs updated if( !m_bIsIdle && InputManager.GetIdleSeconds( m_iPad ) > PLAYER_IDLE_TIME ) { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_IDLE); - #else - ProfileManager.SetCurrentGameActivity(m_iPad,CONTEXT_PRESENCE_IDLE,false); - #endif + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_IDLE); + m_bIsIdle = true; } else if ( m_bIsIdle && InputManager.GetIdleSeconds( m_iPad ) < PLAYER_IDLE_TIME ) @@ -524,40 +521,16 @@ void LocalPlayer::aiStep() { // only do it for this player here - each player will run this code if(g_NetworkManager.IsLocalGame()) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); - #else - ProfileManager.SetCurrentGameActivity(m_iPad,CONTEXT_PRESENCE_MULTIPLAYEROFFLINE,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYEROFFLINE); else - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); - #else - ProfileManager.SetCurrentGameActivity(m_iPad,CONTEXT_PRESENCE_MULTIPLAYER,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER); } else { if(g_NetworkManager.IsLocalGame()) - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE); - #else - ProfileManager.SetCurrentGameActivity(m_iPad,CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE); else - { - #ifdef _WINDOWS64 - g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1P); - #else - ProfileManager.SetCurrentGameActivity(m_iPad,CONTEXT_PRESENCE_MULTIPLAYER_1P,false); - #endif - } + g_DiscordPresence.SetCurrentGameActivity(CONTEXT_PRESENCE_MULTIPLAYER_1P); } updateRichPresence(); m_bIsIdle = false; diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 244aeefe..686e9eec 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -1746,27 +1746,6 @@ void Minecraft::run_middle() #ifndef _XBOX ui.HidePressStart(); #endif - -#ifdef __ORBIS__ - int npAvailability = ProfileManager.getNPAvailability(i); - - // Check if PSN is unavailable because of age restriction - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - UINT uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, i); - } - else if (ProfileManager.IsSignedIn(i) && !ProfileManager.IsSignedInLive(i)) - { - // You're not signed in to PSN! - UINT uiIDA[2]; - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1] = IDS_CANCEL; - ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, i,&Minecraft::MustSignInReturnedPSN, this); - } - else -#endif { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; @@ -4380,13 +4359,6 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt PlayerUID playerXUIDOnline = INVALID_XUID; ProfileManager.GetXUID(iPrimaryPlayer,&playerXUIDOffline,false); ProfileManager.GetXUID(iPrimaryPlayer,&playerXUIDOnline,true); -#ifdef __PSVITA__ - if(CGameNetworkManager::usingAdhocMode() && playerXUIDOnline.getOnlineID()[0] == 0) - { - // player doesn't have an online UID, set it from the player name - playerXUIDOnline.setForAdhoc(); - } -#endif #ifdef _WINDOWS64 // On Windows, the implementation has been changed to use a per-client pseudo XUID based on `uid.dat`. // To maintain player data compatibility with existing worlds, the world host (the first player) will use the previous embedded pseudo XUID. @@ -5262,19 +5234,4 @@ ColourTable *Minecraft::getColourTable() } return colours; -} - -#if defined __ORBIS__ -int Minecraft::MustSignInReturnedPSN(void *pParam, int iPad, C4JStorage::EMessageResult result) -{ - Minecraft* pMinecraft = (Minecraft *)pParam; - - if(result == C4JStorage::EMessage_ResultAccept) - { - SQRNetworkManager_Orbis::AttemptPSNSignIn(&Minecraft::InGame_SignInReturned, pMinecraft, false, iPad); - } - - return 0; -} -#endif - +} \ No newline at end of file diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index 2c5203d8..6c1755d7 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -344,8 +344,4 @@ public: unsigned int getCurrentTexturePackId(); ColourTable *getColourTable(); - -#if defined __ORBIS__ - static int MustSignInReturnedPSN(void *pParam, int iPad, C4JStorage::EMessageResult result); -#endif };