From 25e6f7159e971a72c58154e0908a6760f51e5758 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 12:24:36 -0500 Subject: [PATCH] split out platform/profile to its own folder --- targets/app/common/DLC/DLCManager.cpp | 6 +- targets/app/common/DLC/DLCPack.cpp | 4 +- targets/app/common/DLCController.cpp | 8 +- targets/app/common/Game.cpp | 16 +- targets/app/common/Game.h | 6 +- .../LevelGenerationOptions.cpp | 8 +- targets/app/common/GameSettingsManager.cpp | 54 +++--- targets/app/common/GameSettingsManager.h | 6 +- targets/app/common/Game_XuiActions.cpp | 118 ++++++------ targets/app/common/MenuController.cpp | 10 +- .../app/common/Network/GameNetworkManager.cpp | 142 +++++++------- targets/app/common/NetworkController.cpp | 32 ++-- targets/app/common/SaveManager.cpp | 6 +- targets/app/common/SkinManager.cpp | 4 +- .../app/common/Tutorial/Tasks/StatTask.cpp | 6 +- targets/app/common/Tutorial/Tutorial.cpp | 8 +- .../All Platforms/IUIScene_CraftingMenu.cpp | 12 +- .../common/UI/All Platforms/IUIScene_HUD.cpp | 10 +- .../UI/All Platforms/IUIScene_PauseMenu.cpp | 38 ++-- .../UI/All Platforms/IUIScene_PauseMenu.h | 2 +- .../UI/Components/UIComponent_Tooltips.cpp | 6 +- .../Components/UIComponent_TutorialPopup.cpp | 10 +- .../app/common/UI/Components/UIScene_HUD.cpp | 10 +- .../Debug/UIScene_DebugCreateSchematic.cpp | 4 +- .../UI/Scenes/Debug/UIScene_DebugOverlay.cpp | 28 +-- .../Scenes/Debug/UIScene_DebugSetCamera.cpp | 4 +- .../IUIScene_StartGame.cpp | 6 +- .../UIScene_CreateWorldMenu.cpp | 90 ++++----- .../Frontend Menu screens/UIScene_EULA.cpp | 4 +- .../UIScene_JoinMenu.cpp | 40 ++-- .../UIScene_LaunchMoreOptionsMenu.cpp | 16 +- .../UIScene_LeaderboardsMenu.cpp | 6 +- .../UIScene_LoadMenu.cpp | 62 +++--- .../UIScene_LoadOrJoinMenu.cpp | 50 ++--- .../UIScene_MainMenu.cpp | 176 +++++++++--------- .../UIScene_SaveMessage.cpp | 4 +- .../UIScene_TrialExitUpsell.cpp | 4 +- .../UIScene_HelpAndOptionsMenu.cpp | 10 +- .../UIScene_SettingsGraphicsMenu.cpp | 4 +- .../Help & Options/UIScene_SettingsMenu.cpp | 8 +- .../UIScene_SettingsOptionsMenu.cpp | 6 +- .../Help & Options/UIScene_SettingsUIMenu.cpp | 4 +- .../Help & Options/UIScene_SkinSelectMenu.cpp | 8 +- .../Containers/UIScene_AnvilMenu.cpp | 2 +- .../Containers/UIScene_BrewingStandMenu.cpp | 2 +- .../Containers/UIScene_EnchantingMenu.cpp | 2 +- .../Containers/UIScene_FurnaceMenu.cpp | 2 +- .../Containers/UIScene_TradingMenu.cpp | 2 +- .../UIScene_CraftingMenu.cpp | 2 +- .../UIScene_DeathMenu.cpp | 4 +- .../In-Game Menu Screens/UIScene_EndPoem.cpp | 8 +- .../UIScene_InGameInfoMenu.cpp | 4 +- .../UIScene_PauseMenu.cpp | 30 +-- .../UI/Scenes/UIScene_ConnectingProgress.cpp | 12 +- .../UI/Scenes/UIScene_FullscreenProgress.cpp | 6 +- .../common/UI/Scenes/UIScene_MessageBox.cpp | 4 +- .../UI/Scenes/UIScene_QuadrantSignin.cpp | 22 +-- targets/app/common/UI/UIController.cpp | 46 ++--- targets/app/common/UI/UIGroup.cpp | 16 +- targets/app/linux/LinuxGame.cpp | 4 +- targets/app/linux/Linux_Minecraft.cpp | 14 +- targets/app/windows/Windows64_App.cpp | 4 +- .../app/windows/src/Windows64_Minecraft.cpp | 14 +- targets/minecraft/client/Minecraft.cpp | 86 ++++----- targets/minecraft/client/gui/Screen.cpp | 2 +- .../client/multiplayer/ClientConnection.cpp | 26 +-- .../minecraft/client/player/LocalPlayer.cpp | 18 +- targets/minecraft/server/MinecraftServer.cpp | 4 +- targets/minecraft/server/MinecraftServer.h | 2 +- targets/minecraft/server/PlayerList.cpp | 6 +- targets/minecraft/stats/StatsCounter.cpp | 6 +- targets/platform/PlatformServices.cpp | 2 +- targets/platform/PlatformServices.h | 2 - targets/platform/meson.build | 2 +- .../platform/{ => profile}/IPlatformProfile.h | 26 ++- .../platform/{ => profile}/ProfileConstants.h | 0 targets/platform/profile/profile.h | 3 + .../stub/StubProfile.cpp} | 53 +++--- .../Profile.h => profile/stub/StubProfile.h} | 30 +-- 79 files changed, 761 insertions(+), 763 deletions(-) rename targets/platform/{ => profile}/IPlatformProfile.h (87%) rename targets/platform/{ => profile}/ProfileConstants.h (100%) create mode 100644 targets/platform/profile/profile.h rename targets/platform/{sdl2/Profile.cpp => profile/stub/StubProfile.cpp} (78%) rename targets/platform/{sdl2/Profile.h => profile/stub/StubProfile.h} (81%) diff --git a/targets/app/common/DLC/DLCManager.cpp b/targets/app/common/DLC/DLCManager.cpp index 795ac9508..a9dedfd62 100644 --- a/targets/app/common/DLC/DLCManager.cpp +++ b/targets/app/common/DLC/DLCManager.cpp @@ -13,7 +13,7 @@ #include #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Storage.h" #include "DLCFile.h" #include "DLCPack.h" @@ -361,12 +361,12 @@ unsigned int DLCManager::checkForCorruptDLCAndAlert( C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA, 1, - ProfileManager.GetPrimaryPad(), nullptr, nullptr, wchFormat); + PlatformProfile.GetPrimaryPad(), nullptr, nullptr, wchFormat); } else { C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC_MULTIPLE, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); } } diff --git a/targets/app/common/DLC/DLCPack.cpp b/targets/app/common/DLC/DLCPack.cpp index 0347f9bcc..5eb690ac4 100644 --- a/targets/app/common/DLC/DLCPack.cpp +++ b/targets/app/common/DLC/DLCPack.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "DLCAudioFile.h" #include "DLCCapeFile.h" #include "DLCColourTableFile.h" @@ -332,7 +332,7 @@ bool DLCPack::hasPurchasedFile(DLCManager::EDLCType type, return false; } #if !defined(_CONTENT_PACKAGE) - if (app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) & + if (app.GetGameSettingsDebugMask(PlatformProfile.GetPrimaryPad()) & (1L << eDebugSetting_UnlockAllDLC)) { return true; } else diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index c29963d71..b7f1d50ee 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -10,7 +10,7 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "platform/sdl2/Storage.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/XboxStubs.h" #include @@ -413,8 +413,8 @@ unsigned int DLCController::addDLCRequest(eDLCMarketplaceType eType, } bool DLCController::retrieveNextDLCContent() { - int primPad = ProfileManager.GetPrimaryPad(); - if (primPad == -1 || !ProfileManager.IsSignedInLive(primPad)) { + int primPad = PlatformProfile.GetPrimaryPad(); + if (primPad == -1 || !PlatformProfile.IsSignedInLive(primPad)) { return true; } @@ -437,7 +437,7 @@ bool DLCController::retrieveNextDLCContent() { pCurrent->dwType); #endif C4JStorage::EDLCStatus status = StorageManager.GetDLCOffers( - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), [this](int iOfferC, std::uint32_t dwType, int pad) { return dlcOffersReturned(iOfferC, dwType, pad); }, diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 5f1446e92..5b0cb2de6 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -3,7 +3,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" #include "app/common/App_Defines.h" @@ -240,7 +240,7 @@ int Game::BannedLevelDialogReturned( if (result == C4JStorage::EMessage_ResultAccept) { } else { - if (iPad == ProfileManager.GetPrimaryPad()) { + if (iPad == PlatformProfile.GetPrimaryPad()) { pApp->SetAction(iPad, eAppAction_ExitWorld); } else { pApp->SetAction(iPad, eAppAction_ExitPlayer); @@ -253,7 +253,7 @@ int Game::BannedLevelDialogReturned( #if defined(_DEBUG_MENUS_ENABLED) bool Game::DebugArtToolsOn() { return m_debugOptions.debugArtToolsOn( - GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())); + GetGameSettingsDebugMask(PlatformProfile.GetPrimaryPad())); } #endif @@ -318,7 +318,7 @@ int Game::GetLocalPlayerCount(void) { // // 4J-PB - out for now for DaveK so he doesn't get the // birthday cape #ifdef _CONTENT_PACKAGE // C4JStorage::ETMSStatus eTMSStatus; -// eTMSStatus=StorageManager.ReadTMSFile(ProfileManager.GetPrimaryPad(),C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic, +// eTMSStatus=StorageManager.ReadTMSFile(PlatformProfile.GetPrimaryPad(),C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic, // L"Default_Cape.png",&pBuffer, &dwSize); // if(eTMSStatus==C4JStorage::ETMSStatus_Idle) // { @@ -608,7 +608,7 @@ int32_t Game::RegisterConfigValues(wchar_t* pType, int iValue) { // AUTOSAVE void Game::SetAutosaveTimerTime(void) { - int settingValue = GetGameSettings(ProfileManager.GetPrimaryPad(), eGameSetting_Autosave); + int settingValue = GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Autosave); m_saveManager.setAutosaveTimerTime(settingValue); } @@ -624,7 +624,7 @@ float Game::getTrialTimer(void) { bool Game::IsLocalMultiplayerAvailable() { unsigned int connectedControllers = 0; for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (PlatformInput.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) + if (PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i)) ++connectedControllers; } @@ -637,7 +637,7 @@ bool Game::IsLocalMultiplayerAvailable() { // iOtherConnectedControllers = // PlatformInput.GetConnectedGamepadCount(); // if((PlatformInput.IsPadConnected(userIndex) || - // ProfileManager.IsSignedIn(userIndex))) + // PlatformProfile.IsSignedIn(userIndex))) // { // --iOtherConnectedControllers; // } @@ -645,7 +645,7 @@ bool Game::IsLocalMultiplayerAvailable() { // for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) // { // if( (i!=userIndex) && (PlatformInput.IsPadConnected(i) || - // ProfileManager.IsSignedIn(i)) ) + // PlatformProfile.IsSignedIn(i)) ) // { // iOtherConnectedControllers++; // } diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 16901e30b..beb528a7c 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -4,7 +4,7 @@ #include #include "util/Timer.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Storage.h" // using namespace std; @@ -344,11 +344,11 @@ public: } static int DefaultOptionsCallback(void* pParam, - C_4JProfile::PROFILESETTINGS* pSettings, + IPlatformProfile::PROFILESETTINGS* pSettings, const int iPad) { return GameSettingsManager::defaultOptionsCallback(pParam, pSettings, iPad); } - int SetDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings, + int SetDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings, const int iPad) { return m_gameSettingsManager.setDefaultOptions(pSettings, iPad); } diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index 476557a6b..cf60b3801 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -31,7 +31,7 @@ #include "minecraft/world/level/levelgen/structure/BoundingBox.h" #include "minecraft/world/phys/AABB.h" #include "platform/PlatformServices.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Storage.h" #include "strings.h" #include "util/StringHelpers.h" @@ -552,7 +552,7 @@ void LevelGenerationOptions::loadBaseSaveData() { if (mountIndex > -1) { if (StorageManager.MountInstalledDLC( - ProfileManager.GetPrimaryPad(), mountIndex, + PlatformProfile.GetPrimaryPad(), mountIndex, [this](int pad, std::uint32_t err, std::uint32_t lic) { return onPackMounted(pad, err, lic); }, @@ -560,7 +560,7 @@ void LevelGenerationOptions::loadBaseSaveData() { // corrupt DLC setLoadedData(); app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n", - mountIndex, ProfileManager.GetPrimaryPad()); + mountIndex, PlatformProfile.GetPrimaryPad()); } else { m_bLoadingData = true; app.DebugPrintf("Attempted to mount DLC data for LGO %d\n", @@ -568,7 +568,7 @@ void LevelGenerationOptions::loadBaseSaveData() { } } else { setLoadedData(); - app.SetAction(ProfileManager.GetPrimaryPad(), + app.SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_ReloadTexturePack); } } diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index 769d903a5..d34c8915d 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -35,26 +35,26 @@ GameSettingsManager::GameSettingsManager() { void GameSettingsManager::initGameSettings() { for (int i = 0; i < XUSER_MAX_COUNT; i++) { GameSettingsA[i] = - (GAME_SETTINGS*)ProfileManager.GetGameDefinedProfileData(i); + (GAME_SETTINGS*)PlatformProfile.GetGameDefinedProfileData(i); // clear the flag to say the settings have changed GameSettingsA[i]->bSettingsChanged = false; #if defined(_WINDOWS64) - C_4JProfile::PROFILESETTINGS* pProfileSettings = - ProfileManager.GetDashboardProfileSettings(i); - memset(pProfileSettings, 0, sizeof(C_4JProfile::PROFILESETTINGS)); + IPlatformProfile::PROFILESETTINGS* pProfileSettings = + PlatformProfile.GetDashboardProfileSettings(i); + memset(pProfileSettings, 0, sizeof(IPlatformProfile::PROFILESETTINGS)); setDefaultOptions(pProfileSettings, i); #else - C_4JProfile::PROFILESETTINGS* pProfileSettings = - ProfileManager.GetDashboardProfileSettings(i); - memset(pProfileSettings, 0, sizeof(C_4JProfile::PROFILESETTINGS)); + IPlatformProfile::PROFILESETTINGS* pProfileSettings = + PlatformProfile.GetDashboardProfileSettings(i); + memset(pProfileSettings, 0, sizeof(IPlatformProfile::PROFILESETTINGS)); setDefaultOptions(pProfileSettings, i); #endif } } int GameSettingsManager::setDefaultOptions( - C_4JProfile::PROFILESETTINGS* pSettings, const int iPad) { + IPlatformProfile::PROFILESETTINGS* pSettings, const int iPad) { setGameSettings(iPad, eGameSetting_MusicVolume, DEFAULT_VOLUME_LEVEL); setGameSettings(iPad, eGameSetting_SoundFXVolume, DEFAULT_VOLUME_LEVEL); setGameSettings(iPad, eGameSetting_Gamma, 50); @@ -133,7 +133,7 @@ int GameSettingsManager::setDefaultOptions( } int GameSettingsManager::defaultOptionsCallback( - void* pParam, C_4JProfile::PROFILESETTINGS* pSettings, const int iPad) { + void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings, const int iPad) { Game* pApp = (Game*)pParam; pApp->DebugPrintf("Setting default options for player %d", iPad); @@ -249,27 +249,27 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { Minecraft* pMinecraft = Minecraft::GetInstance(); switch (eVal) { case eGameSetting_MusicVolume: - if (iPad == ProfileManager.GetPrimaryPad()) { + if (iPad == PlatformProfile.GetPrimaryPad()) { pMinecraft->options->set( Options::Option::MUSIC, ((float)GameSettingsA[iPad]->ucMusicVolume) / 100.0f); } break; case eGameSetting_SoundFXVolume: - if (iPad == ProfileManager.GetPrimaryPad()) { + if (iPad == PlatformProfile.GetPrimaryPad()) { pMinecraft->options->set( Options::Option::SOUND, ((float)GameSettingsA[iPad]->ucSoundFXVolume) / 100.0f); } break; case eGameSetting_Gamma: - if (iPad == ProfileManager.GetPrimaryPad()) { + if (iPad == PlatformProfile.GetPrimaryPad()) { float fVal = ((float)GameSettingsA[iPad]->ucGamma) * 327.68f; RenderManager.UpdateGamma((unsigned short)fVal); } break; case eGameSetting_Difficulty: - if (iPad == ProfileManager.GetPrimaryPad()) { + if (iPad == PlatformProfile.GetPrimaryPad()) { pMinecraft->options->toggle( Options::Option::DIFFICULTY, GameSettingsA[iPad]->usBitmaskValues & 0x03); @@ -282,7 +282,7 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { bool bInGame = pMinecraft->level != nullptr; if (bInGame && g_NetworkManager.IsHost() && - (iPad == ProfileManager.GetPrimaryPad())) { + (iPad == PlatformProfile.GetPrimaryPad())) { app.SetXuiServerAction( iPad, eXuiServerAction_ServerSettingChanged_Difficulty); } @@ -290,7 +290,7 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { app.DebugPrintf( "NOT ACTIONING DIFFICULTY - Primary pad is %d, This pad is " "%d\n", - ProfileManager.GetPrimaryPad(), iPad); + PlatformProfile.GetPrimaryPad(), iPad); } break; case eGameSetting_Sensitivity_InGame: @@ -336,7 +336,7 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { } break; case eGameSetting_SplitScreenVertical: - if (iPad == ProfileManager.GetPrimaryPad()) { + if (iPad == PlatformProfile.GetPrimaryPad()) { pMinecraft->updatePlayerViewportAssignments(); } break; @@ -345,7 +345,7 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { // Game Host only if (bInGame && g_NetworkManager.IsHost() && - (iPad == ProfileManager.GetPrimaryPad())) { + (iPad == PlatformProfile.GetPrimaryPad())) { app.SetGameHostOption( eGameHostOption_Gamertags, ((GameSettingsA[iPad]->usBitmaskValues & 0x0008) != 0) ? 1 @@ -403,7 +403,7 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { bool bInGame = pMinecraft->level != nullptr; if (bInGame && g_NetworkManager.IsHost() && - (iPad == ProfileManager.GetPrimaryPad())) { + (iPad == PlatformProfile.GetPrimaryPad())) { app.SetGameHostOption( eGameHostOption_BedrockFog, getGameSettings(iPad, eGameSetting_BedrockFog) ? 1 : 0); @@ -484,7 +484,7 @@ void GameSettingsManager::setGameSettings(int iPad, eGameSetting eVal, case eGameSetting_MusicVolume: if (GameSettingsA[iPad]->ucMusicVolume != ucVal) { GameSettingsA[iPad]->ucMusicVolume = ucVal; - if (iPad == ProfileManager.GetPrimaryPad()) { + if (iPad == PlatformProfile.GetPrimaryPad()) { actionGameSettings(iPad, eVal); } GameSettingsA[iPad]->bSettingsChanged = true; @@ -493,7 +493,7 @@ void GameSettingsManager::setGameSettings(int iPad, eGameSetting eVal, case eGameSetting_SoundFXVolume: if (GameSettingsA[iPad]->ucSoundFXVolume != ucVal) { GameSettingsA[iPad]->ucSoundFXVolume = ucVal; - if (iPad == ProfileManager.GetPrimaryPad()) { + if (iPad == PlatformProfile.GetPrimaryPad()) { actionGameSettings(iPad, eVal); } GameSettingsA[iPad]->bSettingsChanged = true; @@ -502,7 +502,7 @@ void GameSettingsManager::setGameSettings(int iPad, eGameSetting eVal, case eGameSetting_Gamma: if (GameSettingsA[iPad]->ucGamma != ucVal) { GameSettingsA[iPad]->ucGamma = ucVal; - if (iPad == ProfileManager.GetPrimaryPad()) { + if (iPad == PlatformProfile.GetPrimaryPad()) { actionGameSettings(iPad, eVal); } GameSettingsA[iPad]->bSettingsChanged = true; @@ -513,7 +513,7 @@ void GameSettingsManager::setGameSettings(int iPad, eGameSetting eVal, (ucVal & 0x03)) { GameSettingsA[iPad]->usBitmaskValues &= ~0x03; GameSettingsA[iPad]->usBitmaskValues |= ucVal & 0x03; - if (iPad == ProfileManager.GetPrimaryPad()) { + if (iPad == PlatformProfile.GetPrimaryPad()) { actionGameSettings(iPad, eVal); } GameSettingsA[iPad]->bSettingsChanged = true; @@ -864,7 +864,7 @@ void GameSettingsManager::setGameSettings(int iPad, eGameSetting eVal, } unsigned char GameSettingsManager::getGameSettings(eGameSetting eVal) { - int iPad = ProfileManager.GetPrimaryPad(); + int iPad = PlatformProfile.GetPrimaryPad(); return getGameSettings(iPad, eVal); } @@ -979,13 +979,13 @@ void GameSettingsManager::checkGameSettingsChanged(bool bOverride5MinuteTimer, if (iPad == XUSER_INDEX_ANY) { for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (GameSettingsA[i]->bSettingsChanged) { - ProfileManager.WriteToProfile(i, true, bOverride5MinuteTimer); + PlatformProfile.WriteToProfile(i, true, bOverride5MinuteTimer); GameSettingsA[i]->bSettingsChanged = false; } } } else { if (GameSettingsA[iPad]->bSettingsChanged) { - ProfileManager.WriteToProfile(iPad, true, bOverride5MinuteTimer); + PlatformProfile.WriteToProfile(iPad, true, bOverride5MinuteTimer); GameSettingsA[iPad]->bSettingsChanged = false; } } @@ -1011,7 +1011,7 @@ void GameSettingsManager::actionDebugMask(int iPad, bool bSetAllClear) {} unsigned int GameSettingsManager::getGameSettingsDebugMask( int iPad, bool bOverridePlayer) { if (iPad == -1) { - iPad = ProfileManager.GetPrimaryPad(); + iPad = PlatformProfile.GetPrimaryPad(); } if (iPad < 0) iPad = 0; @@ -1046,7 +1046,7 @@ void GameSettingsManager::actionDebugMask(int iPad, bool bSetAllClear) { if (bSetAllClear) ulBitmask = 0L; - if (ProfileManager.GetPrimaryPad() != iPad) return; + if (PlatformProfile.GetPrimaryPad() != iPad) return; for (int i = 0; i < eDebugSetting_Max; i++) { switch (i) { diff --git a/targets/app/common/GameSettingsManager.h b/targets/app/common/GameSettingsManager.h index 4db558432..d3b437f6f 100644 --- a/targets/app/common/GameSettingsManager.h +++ b/targets/app/common/GameSettingsManager.h @@ -3,7 +3,7 @@ #include #include "app/common/App_structs.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/XboxStubs.h" class GameSettingsManager { @@ -15,9 +15,9 @@ public: const unsigned short usVersion, const int iPad); static int defaultOptionsCallback(void* pParam, - C_4JProfile::PROFILESETTINGS* pSettings, + IPlatformProfile::PROFILESETTINGS* pSettings, const int iPad); - int setDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings, + int setDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings, const int iPad); void setGameSettings(int iPad, eGameSetting eVal, unsigned char ucVal); diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index 0517349bc..93a438579 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -28,7 +28,7 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/stats/StatsCounter.h" #include "platform/PlatformTypes.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Storage.h" #include "util/StringHelpers.h" #include "app/common/Audio/SoundEngine.h" @@ -71,7 +71,7 @@ void Game::HandleXuiActions(void) { switch (eAction) { // // the renderer will capture a screenshot // case eAppAction_SocialPost: - // if (ProfileManager.IsFullVersion()) { + // if (PlatformProfile.IsFullVersion()) { // // Facebook Share // if (CSocialManager::Instance() // ->IsTitleAllowedToPostImages() && @@ -159,12 +159,12 @@ void Game::HandleXuiActions(void) { // Hide the other players scenes ui.ShowOtherPlayersBaseScene( - ProfileManager.GetPrimaryPad(), false); + PlatformProfile.GetPrimaryPad(), false); // int saveOrCheckpointId = 0; // bool validSave = // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); - // SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), + // SentientManager.RecordLevelSaveOrCheckpoint(PlatformProfile.GetPrimaryPad(), // saveOrCheckpointId); LoadingInputParams* loadingParams = @@ -184,9 +184,9 @@ void Game::HandleXuiActions(void) { completionData->bShowLogo = true; completionData->type = e_ProgressCompletion_NavigateBackToScene; - completionData->iPad = ProfileManager.GetPrimaryPad(); + completionData->iPad = PlatformProfile.GetPrimaryPad(); - if (ui.IsSceneInStack(ProfileManager.GetPrimaryPad(), + if (ui.IsSceneInStack(PlatformProfile.GetPrimaryPad(), eUIScene_EndPoem)) { completionData->scene = eUIScene_EndPoem; } else { @@ -197,7 +197,7 @@ void Game::HandleXuiActions(void) { // 4J Stu - Xbox only - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams, eUILayer_Fullscreen, eUIGroup_Fullscreen); @@ -215,22 +215,22 @@ void Game::HandleXuiActions(void) { // app.CloseAllPlayersXuiScenes(); // Hide the other players scenes - ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), + ui.ShowOtherPlayersBaseScene(PlatformProfile.GetPrimaryPad(), false); // This just allows it to be shown if (pMinecraft - ->localgameModes[ProfileManager.GetPrimaryPad()] != + ->localgameModes[PlatformProfile.GetPrimaryPad()] != nullptr) pMinecraft - ->localgameModes[ProfileManager.GetPrimaryPad()] + ->localgameModes[PlatformProfile.GetPrimaryPad()] ->getTutorial() ->showTutorialPopup(false); // int saveOrCheckpointId = 0; // bool validSave = // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); - // SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), + // SentientManager.RecordLevelSaveOrCheckpoint(PlatformProfile.GetPrimaryPad(), // saveOrCheckpointId); LoadingInputParams* loadingParams = @@ -246,13 +246,13 @@ void Game::HandleXuiActions(void) { completionData->bShowLogo = true; completionData->type = e_ProgressCompletion_AutosaveNavigateBack; - completionData->iPad = ProfileManager.GetPrimaryPad(); - // completionData->bAutosaveWasMenuDisplayed=ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad()); + completionData->iPad = PlatformProfile.GetPrimaryPad(); + // completionData->bAutosaveWasMenuDisplayed=ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad()); loadingParams->completionData = completionData; // 4J Stu - Xbox only - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams, eUILayer_Fullscreen, eUIGroup_Fullscreen); @@ -265,7 +265,7 @@ void Game::HandleXuiActions(void) { // Since the player is exiting, let's flush any profile // writes for them, and hope we're not breaking TCR // 136... - ProfileManager.ForceQueuedProfileWrites(i); + PlatformProfile.ForceQueuedProfileWrites(i); // not required - it's done within the // removeLocalPlayerIdx @@ -285,7 +285,7 @@ void Game::HandleXuiActions(void) { // Make sure we've not got this player selected as // current - this shouldn't be the case anyway pMinecraft->setLocalPlayerIdx( - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); pMinecraft->removeLocalPlayerIdx(i); // Wipe out the tooltips @@ -303,12 +303,12 @@ void Game::HandleXuiActions(void) { if ((iPlayer != i) && pMinecraft->localplayers[iPlayer]) { if (g_NetworkManager.IsLocalGame()) { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( iPlayer, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); } else { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( iPlayer, CONTEXT_PRESENCE_MULTIPLAYER, false); @@ -321,12 +321,12 @@ void Game::HandleXuiActions(void) { if ((iPlayer != i) && pMinecraft->localplayers[iPlayer]) { if (g_NetworkManager.IsLocalGame()) { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( iPlayer, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, false); } else { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( iPlayer, CONTEXT_PRESENCE_MULTIPLAYER_1P, false); @@ -342,7 +342,7 @@ void Game::HandleXuiActions(void) { int iPlayerC = g_NetworkManager.GetPlayerCount(); // Since the player is exiting, let's flush any profile // writes for them, and hope we're not breaking TCR 136... - ProfileManager.ForceQueuedProfileWrites(i); + PlatformProfile.ForceQueuedProfileWrites(i); // if there are any tips showing, we need to close them pMinecraft->gui->clearMessages(i); @@ -350,7 +350,7 @@ void Game::HandleXuiActions(void) { // Make sure we've not got this player selected as current - // this shouldn't be the case anyway pMinecraft->setLocalPlayerIdx( - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); pMinecraft->removeLocalPlayerIdx(i); // Wipe out the tooltips @@ -367,12 +367,12 @@ void Game::HandleXuiActions(void) { if ((iPlayer != i) && pMinecraft->localplayers[iPlayer]) { if (g_NetworkManager.IsLocalGame()) { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( iPlayer, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); } else { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( iPlayer, CONTEXT_PRESENCE_MULTIPLAYER, false); } @@ -384,12 +384,12 @@ void Game::HandleXuiActions(void) { if ((iPlayer != i) && pMinecraft->localplayers[iPlayer]) { if (g_NetworkManager.IsLocalGame()) { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( iPlayer, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, false); } else { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( iPlayer, CONTEXT_PRESENCE_MULTIPLAYER_1P, false); } @@ -434,11 +434,11 @@ void Game::HandleXuiActions(void) { // In a split screen, only the primary player actually // quits the game, others just remove their players - if (i != ProfileManager.GetPrimaryPad()) { + if (i != PlatformProfile.GetPrimaryPad()) { // Make sure we've not got this player selected as // current - this shouldn't be the case anyway pMinecraft->setLocalPlayerIdx( - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); pMinecraft->removeLocalPlayerIdx(i); SetAction(i, eAppAction_Idle); @@ -456,13 +456,13 @@ void Game::HandleXuiActions(void) { if (g_NetworkManager.IsLocalGame()) { app.SetRichPresenceContext( j, CONTEXT_GAME_STATE_BLANK); - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( j, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); } else { app.SetRichPresenceContext( j, CONTEXT_GAME_STATE_BLANK); - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( j, CONTEXT_PRESENCE_MULTIPLAYER, false); } } @@ -470,11 +470,11 @@ void Game::HandleXuiActions(void) { } else { app.SetRichPresenceContext(i, CONTEXT_GAME_STATE_BLANK); if (g_NetworkManager.IsLocalGame()) { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( i, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, false); } else { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( i, CONTEXT_PRESENCE_MULTIPLAYER_1P, false); } } @@ -524,7 +524,7 @@ void Game::HandleXuiActions(void) { completionData->iPad = DEFAULT_XUI_MENU_USER; loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); } break; @@ -566,7 +566,7 @@ void Game::HandleXuiActions(void) { completionData->iPad = DEFAULT_XUI_MENU_USER; loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); } @@ -823,7 +823,7 @@ void Game::HandleXuiActions(void) { ui.HideAllGameUIElements(); // set the state back to pre-game - ProfileManager.ResetProfileProcessState(); + PlatformProfile.ResetProfileProcessState(); if (g_NetworkManager.IsLeavingGame()) { // 4J Stu - If we are already leaving the game, then we @@ -867,7 +867,7 @@ void Game::HandleXuiActions(void) { e_ProgressCompletion_NavigateToHomeMenu; loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); } @@ -875,7 +875,7 @@ void Game::HandleXuiActions(void) { case eAppAction_PrimaryPlayerSignedOutReturned_Menus: SetAction(i, eAppAction_Idle); // set the state back to pre-game - ProfileManager.ResetProfileProcessState(); + PlatformProfile.ResetProfileProcessState(); // clear the save device StorageManager.SetSaveDeviceSelected(i, false); @@ -888,7 +888,7 @@ void Game::HandleXuiActions(void) { case eAppAction_EthernetDisconnectedReturned_Menus: SetAction(i, eAppAction_Idle); // set the state back to pre-game - ProfileManager.ResetProfileProcessState(); + PlatformProfile.ResetProfileProcessState(); ui.UpdatePlayerBasePositions(); @@ -927,7 +927,7 @@ void Game::HandleXuiActions(void) { // Check the player really wants to do this if (!StorageManager.GetSaveDisabled() && - i == ProfileManager.GetPrimaryPad() && + i == PlatformProfile.GetPrimaryPad() && g_NetworkManager.IsHost() && GetGameStarted()) { uiIDA[0] = IDS_CONFIRM_CANCEL; uiIDA[1] = IDS_EXIT_GAME_SAVE; @@ -1018,7 +1018,7 @@ void Game::HandleXuiActions(void) { completionData->type = e_ProgressCompletion_NoAction; loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); } @@ -1043,15 +1043,15 @@ void Game::HandleXuiActions(void) { app.DebugPrintf( "Changing Primary Pad on an invite accept - pad was " "%d, and is now %d\n", - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), inviteData->dwUserIndex); - ProfileManager.SetLockedProfile(inviteData->dwUserIndex); - ProfileManager.SetPrimaryPad(inviteData->dwUserIndex); + PlatformProfile.SetLockedProfile(inviteData->dwUserIndex); + PlatformProfile.SetPrimaryPad(inviteData->dwUserIndex); // change the minecraft player name Minecraft::GetInstance()->user->name = - convStringToWstring(ProfileManager.GetGamertag( - ProfileManager.GetPrimaryPad())); + convStringToWstring(PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad())); bool success = g_NetworkManager.JoinGameFromInviteInfo( inviteData->dwUserIndex, // dwUserIndex @@ -1069,7 +1069,7 @@ void Game::HandleXuiActions(void) { uiIDA[0] = IDS_CONFIRM_OK; ui.RequestErrorMessage( IDS_CONNECTION_FAILED, IDS_CONNECTION_LOST_SERVER, - uiIDA, 1, ProfileManager.GetPrimaryPad()); + uiIDA, 1, PlatformProfile.GetPrimaryPad()); ui.NavigateToHomeMenu(); ui.UpdatePlayerBasePositions(); @@ -1097,12 +1097,12 @@ void Game::HandleXuiActions(void) { ui.HideAllGameUIElements(); if (!ui.IsSceneInStack( - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), eUIScene_EndPoem)) { ui.CloseAllPlayersScenes(); } ui.ShowOtherPlayersBaseScene( - ProfileManager.GetPrimaryPad(), true); + PlatformProfile.GetPrimaryPad(), true); // Remove this line to fix: // #49084 - TU5: Code: Gameplay: The title crashes @@ -1125,7 +1125,7 @@ void Game::HandleXuiActions(void) { completionData->bShowLogo = true; completionData->iPad = DEFAULT_XUI_MENU_USER; if (ui.IsSceneInStack( - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), eUIScene_EndPoem)) { completionData->type = e_ProgressCompletion_NavigateBackToScene; @@ -1136,7 +1136,7 @@ void Game::HandleXuiActions(void) { } loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); } @@ -1148,7 +1148,7 @@ void Game::HandleXuiActions(void) { } break; case eAppAction_SetDefaultOptions: SetAction(i, eAppAction_Idle); - SetDefaultOptions((C_4JProfile::PROFILESETTINGS*)param, i); + SetDefaultOptions((IPlatformProfile::PROFILESETTINGS*)param, i); // if the profile data has been changed, then force a // profile write It seems we're allowed to break the 5 @@ -1161,7 +1161,7 @@ void Game::HandleXuiActions(void) { // If the remote server save has already finished, don't // complete the action if (GetGameStarted()) { - SetAction(ProfileManager.GetPrimaryPad(), + SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_Idle); break; } @@ -1187,7 +1187,7 @@ void Game::HandleXuiActions(void) { completionData->bShowBackground = true; completionData->bShowLogo = true; completionData->iPad = DEFAULT_XUI_MENU_USER; - if (ui.IsSceneInStack(ProfileManager.GetPrimaryPad(), + if (ui.IsSceneInStack(PlatformProfile.GetPrimaryPad(), eUIScene_EndPoem)) { completionData->type = e_ProgressCompletion_NavigateBackToScene; @@ -1201,7 +1201,7 @@ void Game::HandleXuiActions(void) { loadingParams->cancelFunc = &Game::ExitGameFromRemoteSave; loadingParams->cancelText = IDS_TOOLTIPS_EXIT; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); } break; @@ -1214,7 +1214,7 @@ void Game::HandleXuiActions(void) { C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); if (result != C4JStorage::EMessage_Busy) SetAction(i, eAppAction_Idle); } break; @@ -1245,7 +1245,7 @@ void Game::HandleXuiActions(void) { !g_NetworkManager.IsLeavingGame()) { // primary player would exit the world, secondary would // exit the player - if (ProfileManager.GetPrimaryPad() == i) { + if (PlatformProfile.GetPrimaryPad() == i) { SetAction(i, eAppAction_ExitWorld); } else { SetAction(i, eAppAction_ExitPlayer); @@ -1341,7 +1341,7 @@ void Game::HandleXuiActions(void) { ui.RequestErrorMessage( IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), &Game::TexturePackDialogReturned, this); SetAction(i, eAppAction_Idle); } @@ -1437,8 +1437,8 @@ void Game::HandleXuiActions(void) { // selected // // ensure we've applied // this player's settings - // app.ApplyGameSettingsChanged(ProfileManager.GetPrimaryPad()); - // app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MultiGameJoinLoad); + // app.ApplyGameSettingsChanged(PlatformProfile.GetPrimaryPad()); + // app.NavigateToScene(PlatformProfile.GetPrimaryPad(),eUIScene_MultiGameJoinLoad); // } break; default: diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index 4b8884e87..79bf9ea90 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -18,7 +18,7 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/HopperTileEntity.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Storage.h" #include @@ -489,17 +489,17 @@ int MenuController::remoteSaveThreadProc(void* lpParameter) { pMinecraft->progressRenderer->progressStagePercentage(0); while (!app.GetGameStarted() && - app.GetXuiAction(ProfileManager.GetPrimaryPad()) == + app.GetXuiAction(PlatformProfile.GetPrimaryPad()) == eAppAction_WaitRemoteServerSaveComplete) { pMinecraft->tickAllConnections(); std::this_thread::sleep_for(std::chrono::milliseconds(100)); } - if (app.GetXuiAction(ProfileManager.GetPrimaryPad()) != + if (app.GetXuiAction(PlatformProfile.GetPrimaryPad()) != eAppAction_WaitRemoteServerSaveComplete) { return ERROR_CANCELLED; } - app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_Idle); + app.SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_Idle); ui.UpdatePlayerBasePositions(); @@ -509,7 +509,7 @@ int MenuController::remoteSaveThreadProc(void* lpParameter) { } void MenuController::exitGameFromRemoteSave(void* lpParameter) { - int primaryPad = ProfileManager.GetPrimaryPad(); + int primaryPad = PlatformProfile.GetPrimaryPad(); unsigned int uiIDA[3]; uiIDA[0] = IDS_CONFIRM_CANCEL; diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 97cb21b6a..f9138db5e 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -10,7 +10,7 @@ #include #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" #include "minecraft/GameEnums.h" @@ -108,7 +108,7 @@ bool CGameNetworkManager::_RunNetworkGame(void* lpParameter) { success = s_pPlatformNetworkManager->_RunNetworkGame(); if (!success) { - app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ExitWorld, + app.SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_ExitWorld, (void*)true); return true; } @@ -118,7 +118,7 @@ bool CGameNetworkManager::_RunNetworkGame(void* lpParameter) { app.SetGameStarted(true); - // app.CloseXuiScenes(ProfileManager.GetPrimaryPad()); + // app.CloseXuiScenes(PlatformProfile.GetPrimaryPad()); return success; } @@ -268,10 +268,10 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, } else { INetworkPlayer* pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( - ProfileManager.GetLockedProfile()); + PlatformProfile.GetLockedProfile()); if (pNetworkPlayer == nullptr) { MinecraftServer::HaltServer(); - app.DebugPrintf("%d\n", ProfileManager.GetLockedProfile()); + app.DebugPrintf("%d\n", PlatformProfile.GetLockedProfile()); // If the player is nullptr here then something went wrong in the // session setup, and continuing will end up in a crash return false; @@ -341,33 +341,33 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, if (connection->isStarted() && !connection->isClosed()) { createdConnections.push_back(connection); - int primaryPad = ProfileManager.GetPrimaryPad(); + int primaryPad = PlatformProfile.GetPrimaryPad(); app.SetRichPresenceContext(primaryPad, CONTEXT_GAME_STATE_BLANK); if (GetPlayerCount() > 1) // Are we offline or online, and how many players are there { if (IsLocalGame()) - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( primaryPad, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); else - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( primaryPad, CONTEXT_PRESENCE_MULTIPLAYER, false); } else { if (IsLocalGame()) - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( primaryPad, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, false); else - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( primaryPad, CONTEXT_PRESENCE_MULTIPLAYER_1P, false); } // ALL OTHER LOCAL PLAYERS for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { // Already have setup the primary pad - if (idx == ProfileManager.GetPrimaryPad()) continue; + if (idx == PlatformProfile.GetPrimaryPad()) continue; if (GetLocalPlayerByUserIndex(idx) != nullptr && - !ProfileManager.IsSignedIn(idx)) { + !PlatformProfile.IsSignedIn(idx)) { INetworkPlayer* pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx); Socket* socket = pNetworkPlayer->GetSocket(); @@ -396,13 +396,13 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, minecraft->addPendingLocalConnection(idx, connection); // minecraft->createExtraLocalPlayer(idx, (convStringToWstring( - // ProfileManager.GetGamertag(idx) )).c_str(), idx, connection); + // PlatformProfile.GetGamertag(idx) )).c_str(), idx, connection); // Open the socket on the server end to accept incoming data Socket::addIncomingSocket(socket); connection->send(std::shared_ptr(new PreLoginPacket( - convStringToWstring(ProfileManager.GetGamertag(idx))))); + convStringToWstring(PlatformProfile.GetGamertag(idx))))); createdConnections.push_back(connection); @@ -427,11 +427,11 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, app.DebugPrintf("<***> %d %d %d %d %d\n", IsInSession(), !connection->isStarted(), !connection->isClosed(), - ProfileManager.IsSignedIn(idx), + PlatformProfile.IsSignedIn(idx), !g_NetworkManager.IsLeavingGame()); // TODO - This SHOULD be something just like the code above but // temporarily changing here so that we don't have to depend on - // the profilemanager behaviour + // the platformprofile behaviour } while (IsInSession() && !connection->isStarted() && !connection->isClosed() && !g_NetworkManager.IsLeavingGame()); @@ -443,13 +443,13 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, // get closed at the end of the thread if (g_NetworkManager.IsLeavingGame() || !IsInSession()) break; - if (ProfileManager.IsSignedIn(idx) && !connection->isClosed()) { + if (PlatformProfile.IsSignedIn(idx) && !connection->isClosed()) { app.SetRichPresenceContext(idx, CONTEXT_GAME_STATE_BLANK); if (IsLocalGame()) - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( idx, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); else - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( idx, CONTEXT_PRESENCE_MULTIPLAYER, false); } else { connection->close(); @@ -639,13 +639,13 @@ CGameNetworkManager::eJoinGameResult CGameNetworkManager::JoinGame( app.SetTutorialMode(false); g_NetworkManager.SetLocalGame(false); - int primaryUserIndex = ProfileManager.GetLockedProfile(); + int primaryUserIndex = PlatformProfile.GetLockedProfile(); // 4J-PB - clear any previous connection errors Minecraft::GetInstance()->clearConnectionFailed(); // Make sure that the Primary Pad is in by default - localUsersMask |= GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); + localUsersMask |= GetLocalPlayerMask(PlatformProfile.GetPrimaryPad()); return (eJoinGameResult)(s_pPlatformNetworkManager->JoinGame( searchResult, localUsersMask, primaryUserIndex)); @@ -666,8 +666,8 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam, if (bContinue == true) { app.DebugPrintf("JoinFromInvite_SignInReturned, iPad %d\n", iPad); // It's possible that the player has not signed in - they can back out - if (ProfileManager.IsSignedIn(iPad) && - ProfileManager.IsSignedInLive(iPad)) { + if (PlatformProfile.IsSignedIn(iPad) && + PlatformProfile.IsSignedInLive(iPad)) { app.DebugPrintf( "JoinFromInvite_SignInReturned, passed sign-in tests\n"); int localUsersMask = 0; @@ -675,9 +675,9 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam, bool noPrivileges = false; for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { - if (ProfileManager.IsSignedIn(index)) { + if (PlatformProfile.IsSignedIn(index)) { ++joiningUsers; - if (!ProfileManager.AllowedToPlayMultiplayer(index)) + if (!PlatformProfile.AllowedToPlayMultiplayer(index)) noPrivileges = true; localUsersMask |= GetLocalPlayerMask(index); } @@ -701,24 +701,24 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam, ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); } else { - ProfileManager.SetLockedProfile(iPad); - ProfileManager.SetPrimaryPad(iPad); + PlatformProfile.SetLockedProfile(iPad); + PlatformProfile.SetPrimaryPad(iPad); g_NetworkManager.SetLocalGame(false); // If the player was signed in before selecting play, we'll not // have read the profile yet, so query the sign-in status to get // this to happen - ProfileManager.QuerySigninStatus(); + PlatformProfile.QuerySigninStatus(); // 4J-PB - clear any previous connection errors Minecraft::GetInstance()->clearConnectionFailed(); // change the minecraft player name Minecraft::GetInstance()->user->name = convStringToWstring( - ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); + PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad())); bool success = g_NetworkManager.JoinGameFromInviteInfo( iPad, // dwUserIndex @@ -731,8 +731,8 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam, } else { app.DebugPrintf( "JoinFromInvite_SignInReturned, failed sign-in tests :%d %d\n", - ProfileManager.IsSignedIn(iPad), - ProfileManager.IsSignedInLive(iPad)); + PlatformProfile.IsSignedIn(iPad), + PlatformProfile.IsSignedInLive(iPad)); } } return 0; @@ -875,12 +875,12 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); - while (app.GetXuiServerAction(ProfileManager.GetPrimaryPad()) != + while (app.GetXuiServerAction(PlatformProfile.GetPrimaryPad()) != eXuiServerAction_Idle && !MinecraftServer::serverHalted()) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); } - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)true); // wait for the server to be in a non-ticking state @@ -937,7 +937,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { int localUsersMask = 0; char numLocalPlayers = 0; for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { - if (ProfileManager.IsSignedIn(index) && + if (PlatformProfile.IsSignedIn(index) && pMinecraft->localplayers[index] != nullptr) { numLocalPlayers++; localUsersMask |= GetLocalPlayerMask(index); @@ -956,7 +956,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { // Restore the network player of all the server players that are local if (pServer != nullptr) { for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { - if (ProfileManager.IsSignedIn(index) && + if (PlatformProfile.IsSignedIn(index) && pMinecraft->localplayers[index] != nullptr) { PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid(); @@ -1008,7 +1008,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { // Start the game again app.SetGameStarted(true); - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)false); app.SetChangingSessionType(false); app.SetReallyChangingSessionType(false); @@ -1048,13 +1048,13 @@ void CGameNetworkManager::StateChange_AnyToJoining() { Minecraft::GetInstance()->clearPendingClientTextureRequests(); ConnectionProgressParams* param = new ConnectionProgressParams(); - param->iPad = ProfileManager.GetPrimaryPad(); + param->iPad = PlatformProfile.GetPrimaryPad(); param->stringId = -1; param->showTooltips = false; param->setFailTimer = true; param->timerTime = CONNECTING_PROGRESS_CHECK_TIME; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_ConnectingProgress, param); } @@ -1068,7 +1068,7 @@ void CGameNetworkManager::StateChange_JoiningToIdle( case IPlatformNetwork::JOIN_FAILED_INSUFFICIENT_PRIVILEGES: disconnectReason = DisconnectPacket::eDisconnect_NoMultiplayerPrivilegesJoin; - app.SetAction(ProfileManager.GetPrimaryPad(), + app.SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_FailedToJoinNoPrivileges); break; default: @@ -1077,7 +1077,7 @@ void CGameNetworkManager::StateChange_JoiningToIdle( break; }; Minecraft::GetInstance()->connectionDisconnected( - ProfileManager.GetPrimaryPad(), disconnectReason); + PlatformProfile.GetPrimaryPad(), disconnectReason); } void CGameNetworkManager::StateChange_AnyToStarting() { @@ -1091,10 +1091,10 @@ void CGameNetworkManager::StateChange_AnyToStarting() { completionData->bShowBackground = true; completionData->bShowLogo = true; completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; - completionData->iPad = ProfileManager.GetPrimaryPad(); + completionData->iPad = PlatformProfile.GetPrimaryPad(); loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); } } @@ -1106,7 +1106,7 @@ void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying) { for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { INetworkPlayer* pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(i); - if (pNetworkPlayer != nullptr && ProfileManager.IsSignedIn(i)) { + if (pNetworkPlayer != nullptr && PlatformProfile.IsSignedIn(i)) { app.DebugPrintf( "Stats save for an offline game for the player at index " "%d\n", @@ -1127,7 +1127,7 @@ void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying) { // The host has notified that the game is about to end if (app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None) app.SetDisconnectReason(DisconnectPacket::eDisconnect_Quitting); - app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ExitWorld, + app.SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_ExitWorld, (void*)true); } } @@ -1221,17 +1221,17 @@ void CGameNetworkManager::PlayerJoining(INetworkPlayer* pNetworkPlayer) { app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BLANK); if (multiplayer) { if (localgame) - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( iPad, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); else - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( iPad, CONTEXT_PRESENCE_MULTIPLAYER, false); } else { if (localgame) - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( iPad, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, false); else - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( iPad, CONTEXT_PRESENCE_MULTIPLAYER_1P, false); } } @@ -1240,14 +1240,14 @@ void CGameNetworkManager::PlayerJoining(INetworkPlayer* pNetworkPlayer) { void CGameNetworkManager::PlayerLeaving(INetworkPlayer* pNetworkPlayer) { if (pNetworkPlayer->IsLocal()) { - ProfileManager.SetCurrentGameActivity(pNetworkPlayer->GetUserIndex(), + PlatformProfile.SetCurrentGameActivity(pNetworkPlayer->GetUserIndex(), CONTEXT_PRESENCE_IDLE, false); } } void CGameNetworkManager::HostChanged() { // Disable host migration - app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ExitWorld, + app.SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_ExitWorld, (void*)true); } @@ -1263,7 +1263,7 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, bool noPrivileges = false; for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { - if (ProfileManager.IsSignedIn(index)) { + if (PlatformProfile.IsSignedIn(index)) { // 4J-PB we shouldn't bring any inactive players into the game, // except for the invited player (who may be an inactive player) 4J // Stu - If we are not in a game, then bring in all players signed @@ -1271,7 +1271,7 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, if (index == userIndex || pMinecraft->localplayers[index] != nullptr) { ++joiningUsers; - if (!ProfileManager.AllowedToPlayMultiplayer(index)) + if (!PlatformProfile.AllowedToPlayMultiplayer(index)) noPrivileges = true; localUsersMask |= GetLocalPlayerMask(index); } @@ -1284,8 +1284,8 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, bool bContentRestricted = false; bool pccAllowed = true; bool pccFriendsAllowed = true; - ProfileManager.AllowedPlayerCreatedContent( - ProfileManager.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); + PlatformProfile.AllowedPlayerCreatedContent( + PlatformProfile.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); if (!pccAllowed && !pccFriendsAllowed) noUGC = true; if (noUGC) { @@ -1303,7 +1303,7 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, // invite from the dashboard // StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, // IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, - // uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, + // uiIDA,1,PlatformProfile.GetPrimaryPad(),nullptr,nullptr, // app.GetStringTable()); ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, @@ -1336,7 +1336,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( // We are in the root menus somewhere { - ProfileManager.SetPrimaryPad(userIndex); + PlatformProfile.SetPrimaryPad(userIndex); // 4J Stu - If we accept an invite from the main menu before going to // play game we need to load the DLC These checks are done within the @@ -1348,11 +1348,11 @@ void CGameNetworkManager::HandleInviteWhenInMenus( // stuck in a soft-locked state after selecting the guest account when // prompted The locked profile should not be changed if we are in menus // as the main player might sign out in the sign-in ui - // ProfileManager.SetLockedProfile(-1); + // PlatformProfile.SetLockedProfile(-1); if (!app.IsLocalMultiplayerAvailable()) { bool noPrivileges = - !ProfileManager.AllowedToPlayMultiplayer(userIndex); + !PlatformProfile.AllowedToPlayMultiplayer(userIndex); if (noPrivileges) { unsigned int uiIDA[1]; @@ -1360,10 +1360,10 @@ void CGameNetworkManager::HandleInviteWhenInMenus( ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); } else { - ProfileManager.SetLockedProfile(userIndex); - ProfileManager.SetPrimaryPad(userIndex); + PlatformProfile.SetLockedProfile(userIndex); + PlatformProfile.SetPrimaryPad(userIndex); int localUsersMask = 0; localUsersMask |= GetLocalPlayerMask(userIndex); @@ -1371,7 +1371,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( // If the player was signed in before selecting play, we'll not // have read the profile yet, so query the sign-in status to get // this to happen - ProfileManager.QuerySigninStatus(); + PlatformProfile.QuerySigninStatus(); // 4J-PB - clear any previous connection errors Minecraft::GetInstance()->clearConnectionFailed(); @@ -1380,7 +1380,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( // change the minecraft player name Minecraft::GetInstance()->user->name = convStringToWstring( - ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); + PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad())); bool success = g_NetworkManager.JoinGameFromInviteInfo( userIndex, localUsersMask, pInviteInfo); @@ -1398,7 +1398,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( }; info.requireOnline = true; app.DebugPrintf("Using fullscreen layer\n"); - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_QuadrantSignin, &info, eUILayer_Alert, eUIGroup_Fullscreen); } @@ -1426,23 +1426,23 @@ void CGameNetworkManager::HandleDisconnect(bool bLostRoomOnly) { } int CGameNetworkManager::GetPrimaryPad() { - return ProfileManager.GetPrimaryPad(); + return PlatformProfile.GetPrimaryPad(); } int CGameNetworkManager::GetLockedProfile() { - return ProfileManager.GetLockedProfile(); + return PlatformProfile.GetLockedProfile(); } bool CGameNetworkManager::IsSignedInLive(int playerIdx) { - return ProfileManager.IsSignedInLive(playerIdx); + return PlatformProfile.IsSignedInLive(playerIdx); } bool CGameNetworkManager::AllowedToPlayMultiplayer(int playerIdx) { - return ProfileManager.AllowedToPlayMultiplayer(playerIdx); + return PlatformProfile.AllowedToPlayMultiplayer(playerIdx); } char* CGameNetworkManager::GetOnlineName(int playerIdx) { - return ProfileManager.GetGamertag(playerIdx); + return PlatformProfile.GetGamertag(playerIdx); } void CGameNetworkManager::ServerReadyCreate(bool create) { @@ -1504,7 +1504,7 @@ void CGameNetworkManager::ServerStoppedWait() { RenderManager.StartFrame(); result = m_hServerStoppedEvent->waitForSignal(20); // Tick some simple things - ProfileManager.Tick(); + PlatformProfile.Tick(); StorageManager.Tick(); PlatformInput.Tick(); RenderManager.Tick(); diff --git a/targets/app/common/NetworkController.cpp b/targets/app/common/NetworkController.cpp index 3189229b6..367f90252 100644 --- a/targets/app/common/NetworkController.cpp +++ b/targets/app/common/NetworkController.cpp @@ -18,7 +18,7 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Storage.h" #include "app/common/Audio/SoundEngine.h" @@ -121,7 +121,7 @@ int NetworkController::ethernetDisconnectReturned( void NetworkController::profileReadErrorCallback(void* pParam) { Game* pApp = (Game*)pParam; - int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); + int iPrimaryPlayer = PlatformProfile.GetPrimaryPad(); pApp->SetAction(iPrimaryPlayer, eAppAction_ProfileReadError); } @@ -219,7 +219,7 @@ int NetworkController::signoutExitWorldThreadProc(void* lpParameter) { } void NetworkController::clearSignInChangeUsersMask() { - int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); + int iPrimaryPlayer = PlatformProfile.GetPrimaryPad(); if (m_uiLastSignInData != 0) { if (iPrimaryPlayer >= 0) { @@ -234,9 +234,9 @@ void NetworkController::signInChangeCallback(void* pParam, bool bPrimaryPlayerChanged, unsigned int uiSignInData) { Game* pApp = (Game*)pParam; - int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); + int iPrimaryPlayer = PlatformProfile.GetPrimaryPad(); - if ((ProfileManager.GetLockedProfile() != -1) && iPrimaryPlayer != -1) { + if ((PlatformProfile.GetLockedProfile() != -1) && iPrimaryPlayer != -1) { if (((uiSignInData & (1 << iPrimaryPlayer)) == 0) || bPrimaryPlayerChanged) { pApp->SetAction(iPrimaryPlayer, eAppAction_PrimaryPlayerSignedOut); @@ -251,7 +251,7 @@ void NetworkController::signInChangeCallback(void* pParam, bool hasGuestIdChanged = false; for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { unsigned int guestNumber = 0; - if (ProfileManager.IsSignedIn(i)) { + if (PlatformProfile.IsSignedIn(i)) { XUSER_SIGNIN_INFO info; XUserGetSigninInfo( i, XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, &info); @@ -274,12 +274,12 @@ void NetworkController::signInChangeCallback(void* pParam, uiIDA[0] = IDS_CONFIRM_OK; ui.RequestErrorMessage(IDS_GUEST_ORDER_CHANGED_TITLE, IDS_GUEST_ORDER_CHANGED_TEXT, uiIDA, - 1, ProfileManager.GetPrimaryPad()); + 1, PlatformProfile.GetPrimaryPad()); } bool switchToOffline = false; - if (!ProfileManager.IsSignedInLive( - ProfileManager.GetLockedProfile()) && + if (!PlatformProfile.IsSignedInLive( + PlatformProfile.GetLockedProfile()) && !g_NetworkManager.IsLocalGame()) { switchToOffline = true; } @@ -309,7 +309,7 @@ void NetworkController::signInChangeCallback(void* pParam, if (bPlayerChanged && (!bPlayerSignedIn || (bPlayerSignedIn && - !ProfileManager.AreXUIDSEqual( + !PlatformProfile.AreXUIDSEqual( pApp->m_networkController .m_currentSigninInfo[i] .xuid, @@ -338,8 +338,8 @@ void NetworkController::signInChangeCallback(void* pParam, g_NetworkManager.HandleSignInChange(); } else if (pApp->GetLiveLinkRequired() && - !ProfileManager.IsSignedInLive( - ProfileManager.GetLockedProfile())) { + !PlatformProfile.IsSignedInLive( + PlatformProfile.GetLockedProfile())) { { pApp->SetAction(iPrimaryPlayer, eAppAction_EthernetDisconnected); @@ -396,7 +396,7 @@ void NetworkController::notificationsCallback(void* pParam, break; case XN_LIVE_CONTENT_INSTALLED: { app.ClearDLCInstalled(); - ui.HandleDLCInstalled(ProfileManager.GetPrimaryPad()); + ui.HandleDLCInstalled(PlatformProfile.GetPrimaryPad()); } break; case XN_SYS_STORAGEDEVICESCHANGED: { } break; @@ -453,7 +453,7 @@ int NetworkController::exitAndJoinFromInviteSaveDialogReturned( uiIDA[1] = IDS_CONFIRM_OK; ui.RequestErrorMessage( IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), &NetworkController::exitAndJoinFromInviteAndSaveReturned, pClass); return 0; @@ -466,13 +466,13 @@ int NetworkController::exitAndJoinFromInviteSaveDialogReturned( uiIDA[1] = IDS_CONFIRM_OK; ui.RequestErrorMessage( IDS_TITLE_DECLINE_SAVE_GAME, IDS_CONFIRM_DECLINE_SAVE_GAME, - uiIDA, 2, ProfileManager.GetPrimaryPad(), + uiIDA, 2, PlatformProfile.GetPrimaryPad(), &NetworkController::exitAndJoinFromInviteDeclineSaveReturned, pClass); return 0; } - app.SetAction(ProfileManager.GetPrimaryPad(), + app.SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_ExitAndJoinFromInviteConfirmed); } return 0; diff --git a/targets/app/common/SaveManager.cpp b/targets/app/common/SaveManager.cpp index cde5e2d64..2af9ec1ff 100644 --- a/targets/app/common/SaveManager.cpp +++ b/targets/app/common/SaveManager.cpp @@ -6,7 +6,7 @@ #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/server/MinecraftServer.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" void SaveManager::setAutosaveTimerTime(int settingValue) { m_uiAutosaveTimer = @@ -35,7 +35,7 @@ void SaveManager::lock() { if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) { - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)true); } @@ -54,7 +54,7 @@ void SaveManager::unlock() { if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) { - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)false); } diff --git a/targets/app/common/SkinManager.cpp b/targets/app/common/SkinManager.cpp index 5030df7ec..e104a5443 100644 --- a/targets/app/common/SkinManager.cpp +++ b/targets/app/common/SkinManager.cpp @@ -17,7 +17,7 @@ #include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/world/entity/player/Player.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" SkinManager::SkinManager() : m_xuidNotch(INVALID_XUID) { for (int i = 0; i < XUSER_MAX_COUNT; i++) { @@ -183,7 +183,7 @@ void SkinManager::validateFavoriteSkins(int iPad, bool SkinManager::isXuidNotch(PlayerUID xuid) { if (m_xuidNotch != INVALID_XUID && xuid != INVALID_XUID) { - return ProfileManager.AreXUIDSEqual(xuid, m_xuidNotch); + return PlatformProfile.AreXUIDSEqual(xuid, m_xuidNotch); } return false; } diff --git a/targets/app/common/Tutorial/Tasks/StatTask.cpp b/targets/app/common/Tutorial/Tasks/StatTask.cpp index 007c4b252..1cba2d63a 100644 --- a/targets/app/common/Tutorial/Tasks/StatTask.cpp +++ b/targets/app/common/Tutorial/Tasks/StatTask.cpp @@ -1,6 +1,6 @@ #include "StatTask.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "minecraft/client/Minecraft.h" #include "minecraft/stats/StatsCounter.h" @@ -14,7 +14,7 @@ StatTask::StatTask(Tutorial* tutorial, int descriptionId, Minecraft* minecraft = Minecraft::GetInstance(); targetValue = - minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue(stat) + + minecraft->stats[PlatformProfile.GetPrimaryPad()]->getTotalValue(stat) + variance; } @@ -23,7 +23,7 @@ bool StatTask::isCompleted() { Minecraft* minecraft = Minecraft::GetInstance(); bIsCompleted = - minecraft->stats[ProfileManager.GetPrimaryPad()]->getTotalValue(stat) >= + minecraft->stats[PlatformProfile.GetPrimaryPad()]->getTotalValue(stat) >= (unsigned int)targetValue; return bIsCompleted; } \ No newline at end of file diff --git a/targets/app/common/Tutorial/Tutorial.cpp b/targets/app/common/Tutorial/Tutorial.cpp index 1da388404..af24d08ea 100644 --- a/targets/app/common/Tutorial/Tutorial.cpp +++ b/targets/app/common/Tutorial/Tutorial.cpp @@ -7,7 +7,7 @@ #include #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" @@ -1969,7 +1969,7 @@ Tutorial::~Tutorial() { void Tutorial::debugResetPlayerSavedProgress(int iPad) { GAME_SETTINGS* pGameSettings = - (GAME_SETTINGS*)ProfileManager.GetGameDefinedProfileData(iPad); + (GAME_SETTINGS*)PlatformProfile.GetGameDefinedProfileData(iPad); memset(pGameSettings->ucTutorialCompletion, 0, TUTORIAL_PROFILE_STORAGE_BYTES); pGameSettings->uiSpecialTutorialBitmask = 0; @@ -1994,7 +1994,7 @@ void Tutorial::setCompleted(int completableId) { completableIndex < TUTORIAL_PROFILE_STORAGE_BITS) { // Set the bit for this position GAME_SETTINGS* pGameSettings = - (GAME_SETTINGS*)ProfileManager.GetGameDefinedProfileData(m_iPad); + (GAME_SETTINGS*)PlatformProfile.GetGameDefinedProfileData(m_iPad); int arrayIndex = completableIndex >> 3; int bitIndex = 7 - (completableIndex % 8); pGameSettings->ucTutorialCompletion[arrayIndex] |= 1 << bitIndex; @@ -2023,7 +2023,7 @@ bool Tutorial::getCompleted(int completableId) { // Read the bit for this position // Retrieve the data pointer from the profile GAME_SETTINGS* pGameSettings = - (GAME_SETTINGS*)ProfileManager.GetGameDefinedProfileData(m_iPad); + (GAME_SETTINGS*)PlatformProfile.GetGameDefinedProfileData(m_iPad); int arrayIndex = completableIndex >> 3; int bitIndex = 7 - (completableIndex % 8); return (pGameSettings->ucTutorialCompletion[arrayIndex] & diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index f545eed7a..d3ef721d0 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -8,7 +8,7 @@ #include #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "minecraft/GameEnums.h" #include "app/common/Console_Debug_enum.h" @@ -199,7 +199,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) { // Force a make if the debug is on if (app.DebugSettingsOn() && app.GetGameSettingsDebugMask( - ProfileManager.GetPrimaryPad()) & + PlatformProfile.GetPrimaryPad()) & (1L << eDebugSetting_CraftAnything)) { if (CanBeMadeA[m_iCurrentSlotHIndex].iCount != 0) { int iSlot = iVSlotIndexA[m_iCurrentSlotVIndex]; @@ -907,7 +907,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() { unsigned int uiAlpha; if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) & + app.GetGameSettingsDebugMask(PlatformProfile.GetPrimaryPad()) & (1L << eDebugSetting_CraftAnything)) { uiAlpha = 31; } else { @@ -1054,7 +1054,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots() { unsigned int uiAlpha; if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) & + app.GetGameSettingsDebugMask(PlatformProfile.GetPrimaryPad()) & (1L << eDebugSetting_CraftAnything)) { uiAlpha = 31; } else { @@ -1171,7 +1171,7 @@ void IUIScene_CraftingMenu::DisplayIngredients() { setCraftingOutputSlotItem(getPad(), pTempItemInst); if (app.DebugSettingsOn() && - app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad()) & + app.GetGameSettingsDebugMask(PlatformProfile.GetPrimaryPad()) & (1L << eDebugSetting_CraftAnything)) { setCraftingOutputSlotRedBox(false); } else { @@ -1212,7 +1212,7 @@ void IUIScene_CraftingMenu::DisplayIngredients() { // recipe if (app.DebugSettingsOn() && app.GetGameSettingsDebugMask( - ProfileManager.GetPrimaryPad()) & + PlatformProfile.GetPrimaryPad()) & (1L << eDebugSetting_CraftAnything)) { setIngredientSlotRedBox(index, false); } else { diff --git a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp index f16a119db..5363e3683 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" @@ -77,10 +77,10 @@ void IUIScene_HUD::updateFrameTick() { } SetHudSize(iGuiScale); - SetDisplayName(ProfileManager.GetDisplayName(iPad)); + SetDisplayName(PlatformProfile.GetDisplayName(iPad)); - SetTooltipsEnabled(((ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad())) || - (app.GetGameSettings(ProfileManager.GetPrimaryPad(), + SetTooltipsEnabled(((ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad())) || + (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Tooltips) != 0))); SetActiveSlot(pMinecraft->localplayers[iPad]->inventory->selected); @@ -137,7 +137,7 @@ void IUIScene_HUD::updateFrameTick() { } } - unsigned char ucAlpha = app.GetGameSettings(ProfileManager.GetPrimaryPad(), + unsigned char ucAlpha = app.GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_InterfaceOpacity); float fVal; diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp index 301b7a922..24269ddad 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp @@ -9,7 +9,7 @@ #include #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" @@ -76,7 +76,7 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned( ui.RequestAlertMessage( IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), &IUIScene_PauseMenu::WarningTrialTexturePackReturned, pParam); @@ -96,7 +96,7 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned( uiIDA[1] = IDS_CONFIRM_OK; ui.RequestAlertMessage( IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameAndSaveReturned, pParam); return 0; } else { @@ -109,7 +109,7 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned( uiIDA[1] = IDS_CONFIRM_OK; ui.RequestAlertMessage( IDS_TITLE_DECLINE_SAVE_GAME, IDS_CONFIRM_DECLINE_SAVE_GAME, - uiIDA, 2, ProfileManager.GetPrimaryPad(), + uiIDA, 2, PlatformProfile.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameDeclineSaveReturned, pParam); return 0; } @@ -132,7 +132,7 @@ int IUIScene_PauseMenu::ExitGameAndSaveReturned( // int32_t saveOrCheckpointId = 0; // bool validSave = // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); - // SentientManager.RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), + // SentientManager.RecordLevelSaveOrCheckpoint(PlatformProfile.GetPrimaryPad(), // saveOrCheckpointId); if (pScene) pScene->SetIgnoreInput(true); MinecraftServer::getInstance()->setSaveOnExit(true); @@ -141,7 +141,7 @@ int IUIScene_PauseMenu::ExitGameAndSaveReturned( } else { // has someone disconnected the ethernet here, causing the pause menu to // shut? - if (ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad())) { + if (ui.IsPauseMenuDisplayed(PlatformProfile.GetPrimaryPad())) { unsigned int uiIDA[3]; // you cancelled the save on exit after choosing exit and save? You // go back to the Exit choices then. @@ -153,12 +153,12 @@ int IUIScene_PauseMenu::ExitGameAndSaveReturned( ui.RequestAlertMessage( IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameSaveDialogReturned, pParam); } else { ui.RequestAlertMessage( IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameSaveDialogReturned, pParam); } } @@ -180,7 +180,7 @@ int IUIScene_PauseMenu::ExitGameDeclineSaveReturned( } else { // has someone disconnected the ethernet here, causing the pause menu to // shut? - if (ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad())) { + if (ui.IsPauseMenuDisplayed(PlatformProfile.GetPrimaryPad())) { unsigned int uiIDA[3]; // you cancelled the save on exit after choosing exit and save? You // go back to the Exit choices then. @@ -192,12 +192,12 @@ int IUIScene_PauseMenu::ExitGameDeclineSaveReturned( ui.RequestAlertMessage( IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameSaveDialogReturned, pParam); } else { ui.RequestAlertMessage( IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameSaveDialogReturned, pParam); } } @@ -213,10 +213,10 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned( int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) { bool bAutosave = (bool)lpParameter; if (bAutosave) { - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_AutoSaveGame); } else { - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_SaveGame); } @@ -230,7 +230,7 @@ int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) { app.SetGameStarted(false); - while (app.GetXuiServerAction(ProfileManager.GetPrimaryPad()) != + while (app.GetXuiServerAction(PlatformProfile.GetPrimaryPad()) != eXuiServerAction_Idle && !MinecraftServer::serverHalted()) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); @@ -272,7 +272,7 @@ void IUIScene_PauseMenu::_ExitWorld(void* lpParameter) { if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession()) { if (lpParameter != nullptr) { // 4J-PB - check if we have lost connection to Live - // if (ProfileManager.GetLiveConnectionStatus() != + // if (PlatformProfile.GetLiveConnectionStatus() != // XONLINE_S_LOGON_CONNECTION_ESTABLISHED) { // exitReasonStringId = IDS_CONNECTION_LOST_LIVE; // } else { @@ -336,10 +336,10 @@ void IUIScene_PauseMenu::_ExitWorld(void* lpParameter) { // that is most likely the cause of the disconnection so don't // display a message box. This will allow the message box requested // by the libraries to be brought up - if (ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) + if (PlatformProfile.IsSignedIn(PlatformProfile.GetPrimaryPad())) ui.RequestErrorMessage(exitReasonTitleId, exitReasonStringId, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); exitReasonStringId = -1; // 4J - Force a disconnection, this handles the situation that the @@ -375,7 +375,7 @@ void IUIScene_PauseMenu::_ExitWorld(void* lpParameter) { g_NetworkManager.LeaveGame(false); } else { if (lpParameter != nullptr && - ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) { + PlatformProfile.IsSignedIn(PlatformProfile.GetPrimaryPad())) { switch (app.GetDisconnectReason()) { case DisconnectPacket::eDisconnect_Kicked: exitReasonStringId = IDS_DISCONNECTED_KICKED; @@ -417,7 +417,7 @@ void IUIScene_PauseMenu::_ExitWorld(void* lpParameter) { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; ui.RequestErrorMessage(exitReasonTitleId, exitReasonStringId, uiIDA, - 1, ProfileManager.GetPrimaryPad()); + 1, PlatformProfile.GetPrimaryPad()); exitReasonStringId = -1; } } diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h index 02a778471..366cf6a4d 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h @@ -1,6 +1,6 @@ #pragma once -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Storage.h" #include "app/common/DLC/DLCPack.h" diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp index 0014b18d3..d8ecb30e7 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp @@ -1,6 +1,6 @@ #include "UIComponent_Tooltips.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -120,7 +120,7 @@ void UIComponent_Tooltips::tick() { UIScene::tick(); // set the opacity of the tooltip items - unsigned char ucAlpha = app.GetGameSettings(ProfileManager.GetPrimaryPad(), + unsigned char ucAlpha = app.GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_InterfaceOpacity); float fVal; @@ -167,7 +167,7 @@ void UIComponent_Tooltips::tick() { void UIComponent_Tooltips::render(S32 width, S32 height, C4JRender::eViewportType viewport) { - if ((ProfileManager.GetLockedProfile() != -1) && + if ((PlatformProfile.GetLockedProfile() != -1) && !ui.GetMenuDisplayed(m_iPad) && (app.GetGameSettings(m_iPad, eGameSetting_Tooltips) == 0 || app.GetGameSettings(m_iPad, eGameSetting_DisplayHUD) == 0)) { diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp index 254070b62..87a926c46 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" @@ -67,12 +67,12 @@ void UIComponent_TutorialPopup::UpdateTutorialPopup() { // has the Splitscreen Gamertag visibility been changed? Re-Adjust Layout to // prevent overlaps! if (m_bSplitscreenGamertagVisible != - (bool)(app.GetGameSettings(ProfileManager.GetPrimaryPad(), + (bool)(app.GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_DisplaySplitscreenGamertags) != 0)) { m_bSplitscreenGamertagVisible = (bool)(app.GetGameSettings( - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), eGameSetting_DisplaySplitscreenGamertags) != 0); handleReload(); } @@ -83,7 +83,7 @@ void UIComponent_TutorialPopup::handleReload() { IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_boolean; value[0].boolval = - (bool)((app.GetGameSettings(ProfileManager.GetPrimaryPad(), + (bool)((app.GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_DisplaySplitscreenGamertags) != 0) && !m_bContainerMenuVisible); // 4J - TomK - Offset for splitscreen @@ -232,7 +232,7 @@ void UIComponent_TutorialPopup::_SetDescription(UIScene* interactScene, // Layout function (so we can offset it to stay clear of the gamertag) m_bSplitscreenGamertagVisible = (bool)(app.GetGameSettings( - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), eGameSetting_DisplaySplitscreenGamertags) != 0); IggyDataValue result; IggyDataValue value[1]; diff --git a/targets/app/common/UI/Components/UIScene_HUD.cpp b/targets/app/common/UI/Components/UIScene_HUD.cpp index 1af9a6776..4f5ce3bfc 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.cpp +++ b/targets/app/common/UI/Components/UIScene_HUD.cpp @@ -4,7 +4,7 @@ #include #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Components/UIComponent_Chat.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -169,7 +169,7 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion* region) { std::shared_ptr item = invSlot->getItem(); if (item != nullptr) { unsigned char ucAlpha = app.GetGameSettings( - ProfileManager.GetPrimaryPad(), eGameSetting_InterfaceOpacity); + PlatformProfile.GetPrimaryPad(), eGameSetting_InterfaceOpacity); float fVal; if (ucAlpha < 80) { @@ -257,12 +257,12 @@ void UIScene_HUD::handleReload() { } SetHudSize(iGuiScale); - SetDisplayName(ProfileManager.GetDisplayName(m_iPad)); + SetDisplayName(PlatformProfile.GetDisplayName(m_iPad)); repositionHud(); - SetTooltipsEnabled(((ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad())) || - (app.GetGameSettings(ProfileManager.GetPrimaryPad(), + SetTooltipsEnabled(((ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad())) || + (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Tooltips) != 0))); } diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index 74d318b85..6172541a8 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -5,7 +5,7 @@ #include "platform/input/InputActions.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -116,7 +116,7 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId) { else if (m_data->endZ < 0 && m_data->endZ % 2 == 0) m_data->endZ += 1; - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_ExportSchematic, (void*)m_data); diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index 187e32296..f9ddf23d8 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -6,7 +6,7 @@ #include #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -199,17 +199,17 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) { // app.SetXuiServerAction(m_iPad, eXuiServerAction_DropItem, (void // *)m_itemIds[id]); ClientConnection* conn = Minecraft::GetInstance()->getConnection( - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); conn->send(GiveItemCommand::preparePacket( std::dynamic_pointer_cast( Minecraft::GetInstance() - ->localplayers[ProfileManager.GetPrimaryPad()]), + ->localplayers[PlatformProfile.GetPrimaryPad()]), m_itemIds[id])); } break; case eControl_Mobs: { int id = childId; if (id < m_mobFactories.size()) { - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_SpawnMob, (void*)m_mobFactories[id]); } @@ -217,50 +217,50 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) { case eControl_Enchantments: { int id = childId; ClientConnection* conn = Minecraft::GetInstance()->getConnection( - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); conn->send(EnchantItemCommand::preparePacket( std::dynamic_pointer_cast( Minecraft::GetInstance() - ->localplayers[ProfileManager.GetPrimaryPad()]), + ->localplayers[PlatformProfile.GetPrimaryPad()]), m_enchantmentIdAndLevels[id].first, m_enchantmentIdAndLevels[id].second)); } break; case eControl_Schematic: { #ifndef _CONTENT_PACKAGE - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_DebugCreateSchematic, nullptr, eUILayer_Debug); #endif } break; case eControl_SetCamera: { #ifndef _CONTENT_PACKAGE - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_DebugSetCamera, nullptr, eUILayer_Debug); #endif } break; case eControl_Rain: { - // app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_ToggleRain); + // app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(),eXuiServerAction_ToggleRain); ClientConnection* conn = Minecraft::GetInstance()->getConnection( - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); conn->send(ToggleDownfallCommand::preparePacket()); } break; case eControl_Thunder: - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_ToggleThunder); break; case eControl_ResetTutorial: Tutorial::debugResetPlayerSavedProgress( - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); break; case eControl_SetDay: { ClientConnection* conn = Minecraft::GetInstance()->getConnection( - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); conn->send(TimeCommand::preparePacket(false)); } break; case eControl_SetNight: { ClientConnection* conn = Minecraft::GetInstance()->getConnection( - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); conn->send(TimeCommand::preparePacket(true)); } break; }; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index 290445a84..855d9fa3d 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -7,7 +7,7 @@ #include "platform/input/InputActions.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -109,7 +109,7 @@ void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) { switch ((int)controlId) { case eControl_Teleport: - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_SetCameraLocation, (void*)currentPosition); break; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp index 05a5cfc53..897fc2d5e 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/App_structs.h" #include "app/common/DLC/DLCManager.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -228,7 +228,7 @@ void IUIScene_StartGame::UpdateCurrentTexturePack(int iSlot) { // Give the player a warning about the texture pack missing ui.RequestErrorMessage(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 3, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), & : TexturePackDialogReturned, this); // do set the texture pack id, and on the user pressing create world, @@ -258,7 +258,7 @@ int IUIScene_StartGame::UnlockTexturePackReturned( IUIScene_StartGame* pScene = (IUIScene_StartGame*)pParam; if (result == C4JStorage::EMessage_ResultAccept) { - if (ProfileManager.IsSignedIn(iPad)) { + if (PlatformProfile.IsSignedIn(iPad)) { // the license change coming in when the offer has been installed // will cause this scene to refresh } diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp index 698ab0179..7f900f8b7 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp @@ -9,7 +9,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" @@ -112,8 +112,8 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void* initData, m_pDLCPack = nullptr; m_bRebuildTouchBoxes = false; - m_bMultiplayerAllowed = ProfileManager.IsSignedInLive(m_iPad) && - ProfileManager.AllowedToPlayMultiplayer(m_iPad); + m_bMultiplayerAllowed = PlatformProfile.IsSignedInLive(m_iPad) && + PlatformProfile.AllowedToPlayMultiplayer(m_iPad); // 4J-PB - read the settings for the online flag. We'll only save this // setting if the user changed it. bool bGameSetting_Online = @@ -125,9 +125,9 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void* initData, // create, but this matches the behaviour of load game, and lets the player // know why they can't play online, instead of just greying out the online // setting in the More Options #ifdef 0 - // if(ProfileManager.IsSignedInLive( m_iPad )) + // if(PlatformProfile.IsSignedInLive( m_iPad )) // { - // ProfileManager.GetChatAndContentRestrictions(m_iPad,true,&bChatRestricted,&bContentRestricted,nullptr); + // PlatformProfile.GetChatAndContentRestrictions(m_iPad,true,&bChatRestricted,&bContentRestricted,nullptr); // } // #endif @@ -159,7 +159,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void* initData, m_checkboxOnline.SetEnable(true); // 4J-PB - to stop an offline game being able to select the online flag - if (ProfileManager.IsSignedInLive(m_iPad) == false) { + if (PlatformProfile.IsSignedInLive(m_iPad) == false) { m_checkboxOnline.SetEnable(false); } @@ -438,7 +438,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() { // Give the player a warning about the texture pack missing ui.RequestAlertMessage(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), &TexturePackDialogReturned, this); return; } @@ -483,7 +483,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() { unsigned int uiIDA[1]; uiIDA[0]=IDS_OK; - if(!ProfileManager.IsSignedInLive(m_iPad)) + if(!PlatformProfile.IsSignedInLive(m_iPad)) { // need to be signed in to live ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, @@ -531,8 +531,8 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id) { switch (id) { case GAME_CREATE_ONLINE_TIMER_ID: { bool bMultiplayerAllowed = - ProfileManager.IsSignedInLive(m_iPad) && - ProfileManager.AllowedToPlayMultiplayer(m_iPad); + PlatformProfile.IsSignedInLive(m_iPad) && + PlatformProfile.AllowedToPlayMultiplayer(m_iPad); if (bMultiplayerAllowed != m_bMultiplayerAllowed) { if (bMultiplayerAllowed) { @@ -574,21 +574,21 @@ void UIScene_CreateWorldMenu::handleGainFocus(bool navBack) { void UIScene_CreateWorldMenu::checkStateAndStartGame() { - int primaryPad = ProfileManager.GetPrimaryPad(); + int primaryPad = PlatformProfile.GetPrimaryPad(); bool isSignedInLive = true; bool isOnlineGame = m_MoreOptionsParams.bOnlineGame; int iPadNotSignedInLive = -1; bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable(); for (unsigned int i = 0; i < XUSER_MAX_COUNT; i++) { - if (ProfileManager.IsSignedIn(i) && + if (PlatformProfile.IsSignedIn(i) && (i == primaryPad || isLocalMultiplayerAvailable)) { - if (isSignedInLive && !ProfileManager.IsSignedInLive(i)) { + if (isSignedInLive && !PlatformProfile.IsSignedInLive(i)) { // Record the first non signed in live pad iPadNotSignedInLive = i; } - isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(i); + isSignedInLive = isSignedInLive && PlatformProfile.IsSignedInLive(i); } } @@ -599,7 +599,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, - uiIDA, 1, ProfileManager.GetPrimaryPad()); + uiIDA, 1, PlatformProfile.GetPrimaryPad()); return; } @@ -623,22 +623,22 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { // the sign-in UI again int connectedControllers = 0; for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (PlatformInput.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) + if (PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i)) ++connectedControllers; } // Check if user-created content is allowed, as we cannot play // multiplayer if it's not // bool isClientSide = - // ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && + // PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && // m_MoreOptionsParams.bOnlineGame; bool noUGC = false; bool pccAllowed = true; bool pccFriendsAllowed = true; bool bContentRestricted = false; - ProfileManager.AllowedPlayerCreatedContent( - ProfileManager.GetPrimaryPad(), false, &pccAllowed, + PlatformProfile.AllowedPlayerCreatedContent( + PlatformProfile.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); noUGC = !pccAllowed && !pccFriendsAllowed; @@ -655,15 +655,15 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { m_bIgnoreInput = false; ui.RequestContentRestrictedMessageBox(); } else { - // ProfileManager.RequestSignInUI(false, false, false, true, + // PlatformProfile.RequestSignInUI(false, false, false, true, // false,&CScene_MultiGameCreate::StartGame_SignInReturned, - // this,ProfileManager.GetPrimaryPad()); + // this,PlatformProfile.GetPrimaryPad()); SignInInfo info; info.Func = [this](bool bContinue, int pad) { return StartGame_SignInReturned(this, bContinue, pad); }; info.requireOnline = m_MoreOptionsParams.bOnlineGame; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_QuadrantSignin, &info); } } else { @@ -694,7 +694,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, #endif bool isClientSide = - ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && + PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; bool isPrivate = pClass->m_MoreOptionsParams.bInviteOnly ? true : false; @@ -894,33 +894,33 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam, if (bContinue == true) { // It's possible that the player has not signed in - they can back out - if (ProfileManager.IsSignedIn(pClass->m_iPad)) { + if (PlatformProfile.IsSignedIn(pClass->m_iPad)) { bool isOnlineGame = - ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && + PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; // bool isOnlineGame = pClass->m_MoreOptionsParams.bOnlineGame; - int primaryPad = ProfileManager.GetPrimaryPad(); + int primaryPad = PlatformProfile.GetPrimaryPad(); bool noPrivileges = false; int localUsersMask = 0; - bool isSignedInLive = ProfileManager.IsSignedInLive(primaryPad); + bool isSignedInLive = PlatformProfile.IsSignedInLive(primaryPad); int iPadNotSignedInLive = -1; bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable(); for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (ProfileManager.IsSignedIn(i) && + if (PlatformProfile.IsSignedIn(i) && ((i == primaryPad) || isLocalMultiplayerAvailable)) { - if (isSignedInLive && !ProfileManager.IsSignedInLive(i)) { + if (isSignedInLive && !PlatformProfile.IsSignedInLive(i)) { // Record the first non signed in live pad iPadNotSignedInLive = i; } - if (!ProfileManager.AllowedToPlayMultiplayer(i)) + if (!PlatformProfile.AllowedToPlayMultiplayer(i)) noPrivileges = true; localUsersMask |= CGameNetworkManager::GetLocalPlayerMask(i); isSignedInLive = - isSignedInLive && ProfileManager.IsSignedInLive(i); + isSignedInLive && PlatformProfile.IsSignedInLive(i); } } @@ -932,7 +932,7 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam, uiIDA[0] = IDS_CONFIRM_OK; ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); return 0; } @@ -942,8 +942,8 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam, bool pccAllowed = true; bool pccFriendsAllowed = true; - ProfileManager.AllowedPlayerCreatedContent( - ProfileManager.GetPrimaryPad(), false, &pccAllowed, + PlatformProfile.AllowedPlayerCreatedContent( + PlatformProfile.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); if (!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -955,7 +955,7 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam, ui.RequestAlertMessage( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); } else { pClass->m_bIgnoreInput = false; unsigned int uiIDA[1]; @@ -963,7 +963,7 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam, ui.RequestAlertMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); } } else { // This is NOT called from a storage manager thread, and is in @@ -983,40 +983,40 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned( if (result == C4JStorage::EMessage_ResultAccept) { bool isClientSide = - ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && + PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; // 4J Stu - If we only have one controller connected, then don't show // the sign-in UI again int connectedControllers = 0; for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (PlatformInput.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) + if (PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i)) ++connectedControllers; } if (isClientSide && app.IsLocalMultiplayerAvailable()) { - // ProfileManager.RequestSignInUI(false, false, false, true, + // PlatformProfile.RequestSignInUI(false, false, false, true, // false,&UIScene_CreateWorldMenu::StartGame_SignInReturned, - // pClass,ProfileManager.GetPrimaryPad()); + // pClass,PlatformProfile.GetPrimaryPad()); SignInInfo info; info.Func = [pClass](bool bContinue, int pad) { return StartGame_SignInReturned(pClass, bContinue, pad); }; info.requireOnline = pClass->m_MoreOptionsParams.bOnlineGame; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_QuadrantSignin, &info); } else { // Check if user-created content is allowed, as we cannot play // multiplayer if it's not bool isClientSide = - ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && + PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; bool noUGC = false; bool pccAllowed = true; bool pccFriendsAllowed = true; - ProfileManager.AllowedPlayerCreatedContent( - ProfileManager.GetPrimaryPad(), false, &pccAllowed, + PlatformProfile.AllowedPlayerCreatedContent( + PlatformProfile.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); if (!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -1027,7 +1027,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned( ui.RequestAlertMessage( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); } else { CreateGame(pClass, 0); } diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp index 8c1776f40..e9b9a972e 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp @@ -6,7 +6,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -46,7 +46,7 @@ UIScene_EULA::UIScene_EULA(int iPad, void* initData, UILayer* parentLayer) // 4J-PB - If we have a signed in user connected, let's get the DLC now for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if ((PlatformInput.IsPadConnected(i) || ProfileManager.IsSignedIn(i))) { + if ((PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i))) { if (!app.DLCInstallProcessCompleted() && !app.DLCInstallPending()) { app.StartInstallDLCProcess(i); break; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp index 5ba2df3ff..196f1bde0 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp @@ -6,7 +6,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" @@ -293,15 +293,15 @@ void UIScene_JoinMenu::StartSharedLaunchFlow() { if (!app.IsLocalMultiplayerAvailable()) { JoinGame(this); } else { - // ProfileManager.RequestSignInUI(false, false, false, true, + // PlatformProfile.RequestSignInUI(false, false, false, true, // false,&UIScene_JoinMenu::StartGame_SignInReturned, - // this,ProfileManager.GetPrimaryPad()); + // this,PlatformProfile.GetPrimaryPad()); SignInInfo info; info.Func = [this](bool bContinue, int pad) { return StartGame_SignInReturned(this, bContinue, pad); }; info.requireOnline = true; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_QuadrantSignin, &info); } } @@ -315,7 +315,7 @@ int UIScene_JoinMenu::StartGame_SignInReturned(void* pParam, bool bContinue, } if (bContinue == true && pClass != nullptr && - ProfileManager.IsSignedIn(iPad)) { + PlatformProfile.IsSignedIn(iPad)) { JoinGame(pClass); } @@ -336,35 +336,35 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { bool isSignedInLive = true; int iPadNotSignedInLive = -1; - ProfileManager.SetLockedProfile(0); // TEMP! + PlatformProfile.SetLockedProfile(0); // TEMP! // If we're in SD mode, then only the primary player gets to play if (app.IsLocalMultiplayerAvailable()) { for (unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { - if (ProfileManager.IsSignedIn(index)) { - if (isSignedInLive && !ProfileManager.IsSignedInLive(index)) { + if (PlatformProfile.IsSignedIn(index)) { + if (isSignedInLive && !PlatformProfile.IsSignedInLive(index)) { // Record the first non signed in live pad iPadNotSignedInLive = index; } - if (!ProfileManager.AllowedToPlayMultiplayer(index)) + if (!PlatformProfile.AllowedToPlayMultiplayer(index)) noPrivileges = true; dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index); isSignedInLive = - isSignedInLive && ProfileManager.IsSignedInLive(index); + isSignedInLive && PlatformProfile.IsSignedInLive(index); } } } else { - if (ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) { - if (!ProfileManager.AllowedToPlayMultiplayer( - ProfileManager.GetPrimaryPad())) + if (PlatformProfile.IsSignedIn(PlatformProfile.GetPrimaryPad())) { + if (!PlatformProfile.AllowedToPlayMultiplayer( + PlatformProfile.GetPrimaryPad())) noPrivileges = true; dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask( - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); isSignedInLive = - ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()); + PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()); } } @@ -377,7 +377,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { uiIDA[0] = IDS_CONFIRM_OK; ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); } return; } @@ -388,8 +388,8 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { bool pccAllowed = true; bool pccFriendsAllowed = true; - ProfileManager.AllowedPlayerCreatedContent( - ProfileManager.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); + PlatformProfile.AllowedPlayerCreatedContent( + PlatformProfile.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); if (!pccAllowed && !pccFriendsAllowed) noUGC = true; if (noUGC) { @@ -408,7 +408,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { uiIDA[0] = IDS_CONFIRM_OK; ui.RequestErrorMessage(IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); } else { CGameNetworkManager::eJoinGameResult result = g_NetworkManager.JoinGame( pClass->m_selectedSession, dwLocalUsersMask); @@ -434,7 +434,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { uiIDA[0] = IDS_CONFIRM_OK; ui.RequestErrorMessage(IDS_CONNECTION_FAILED, exitReasonStringId, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); exitReasonStringId = -1; ui.NavigateToHomeMenu(); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp index 189f29393..4109cae26 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp @@ -6,7 +6,7 @@ #include "platform/input/InputActions.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" @@ -74,8 +74,8 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu( #endif m_bMultiplayerAllowed = - ProfileManager.IsSignedInLive(m_params->iPad) && - ProfileManager.AllowedToPlayMultiplayer(m_params->iPad); + PlatformProfile.IsSignedInLive(m_params->iPad) && + PlatformProfile.AllowedToPlayMultiplayer(m_params->iPad); bool bOnlineGame, bInviteOnly, bAllowFriendsOfFriends; bOnlineGame = m_params->bOnlineGame; @@ -83,7 +83,7 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu( bAllowFriendsOfFriends = m_params->bAllowFriendsOfFriends; // 4J-PB - to stop an offline game being able to select the online flag - if (ProfileManager.IsSignedInLive(m_params->iPad) == false) { + if (PlatformProfile.IsSignedInLive(m_params->iPad) == false) { m_checkboxes[eLaunchCheckbox_Online].SetEnable(false); } @@ -263,8 +263,8 @@ void UIScene_LaunchMoreOptionsMenu::tick() { UIScene::tick(); bool bMultiplayerAllowed = - ProfileManager.IsSignedInLive(m_params->iPad) && - ProfileManager.AllowedToPlayMultiplayer(m_params->iPad); + PlatformProfile.IsSignedInLive(m_params->iPad) && + PlatformProfile.AllowedToPlayMultiplayer(m_params->iPad); if (bMultiplayerAllowed != m_bMultiplayerAllowed) { m_checkboxes[eLaunchCheckbox_Online].SetEnable(bMultiplayerAllowed); @@ -520,9 +520,9 @@ void UIScene_LaunchMoreOptionsMenu::handleTimerComplete(int id) { case GAME_CREATE_ONLINE_TIMER_ID: { bool bMultiplayerAllowed - = ProfileManager.IsSignedInLive(m_params->iPad) + = PlatformProfile.IsSignedInLive(m_params->iPad) && - ProfileManager.AllowedToPlayMultiplayer(m_params->iPad); + PlatformProfile.AllowedToPlayMultiplayer(m_params->iPad); if (bMultiplayerAllowed != m_bMultiplayerAllowed) { diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp index 9b8356a95..672f68b84 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp @@ -9,7 +9,7 @@ #include #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Leaderboards/LeaderboardInterface.h" #include "app/common/Leaderboards/LeaderboardManager.h" @@ -375,7 +375,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { } break; case IPlatformLeaderboard::eFM_MyScore: { PlayerUID uid; - ProfileManager.GetXUID(ProfileManager.GetPrimaryPad(), &uid, true); + PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, true); m_interface.ReadStats_MyScore( this, m_currentDifficulty, (IPlatformLeaderboard::EStatsType)m_currentLeaderboard, @@ -383,7 +383,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { } break; case IPlatformLeaderboard::eFM_Friends: { PlayerUID uid; - ProfileManager.GetXUID(ProfileManager.GetPrimaryPad(), &uid, true); + PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, true); m_interface.ReadStats_Friends( this, m_currentDifficulty, (IPlatformLeaderboard::EStatsType)m_currentLeaderboard, diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp index 763c88654..e9206060b 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp @@ -6,7 +6,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" @@ -123,8 +123,8 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void* initData, m_seed = 0; m_bIsCorrupt = false; - m_bMultiplayerAllowed = ProfileManager.IsSignedInLive(m_iPad) && - ProfileManager.AllowedToPlayMultiplayer(m_iPad); + m_bMultiplayerAllowed = PlatformProfile.IsSignedInLive(m_iPad) && + PlatformProfile.AllowedToPlayMultiplayer(m_iPad); // 4J-PB - read the settings for the online flag. We'll only save this // setting if the user changed it. bool bGameSetting_Online = @@ -159,7 +159,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void* initData, m_checkboxOnline.SetEnable(true); // 4J-PB - to stop an offline game being able to select the online flag - if (ProfileManager.IsSignedInLive(m_iPad) == false) { + if (PlatformProfile.IsSignedInLive(m_iPad) == false) { m_checkboxOnline.SetEnable(false); } @@ -447,7 +447,7 @@ void UIScene_LoadMenu::tick() { return StartGame_SignInReturned(this, bContinue, pad); }; info.requireOnline = m_MoreOptionsParams.bOnlineGame; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_QuadrantSignin, &info); } @@ -574,7 +574,7 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() { // Give the player a warning about the texture pack missing ui.RequestAlertMessage(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), &TexturePackDialogReturned, this); return; } @@ -619,7 +619,7 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() { unsigned int uiIDA[1]; uiIDA[0]=IDS_OK; - if(!ProfileManager.IsSignedInLive(m_iPad)) + if(!PlatformProfile.IsSignedInLive(m_iPad)) { // need to be signed in to live ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, @@ -689,8 +689,8 @@ void UIScene_LoadMenu::handleTimerComplete(int id) { switch (id) { case GAME_CREATE_ONLINE_TIMER_ID: { bool bMultiplayerAllowed = - ProfileManager.IsSignedInLive(m_iPad) && - ProfileManager.AllowedToPlayMultiplayer(m_iPad); + PlatformProfile.IsSignedInLive(m_iPad) && + PlatformProfile.AllowedToPlayMultiplayer(m_iPad); if (bMultiplayerAllowed != m_bMultiplayerAllowed) { if (bMultiplayerAllowed) { @@ -917,22 +917,22 @@ int UIScene_LoadMenu::LoadDataComplete(void* pParam) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; if (!pClass->m_bIsCorrupt) { - int iPrimaryPad = ProfileManager.GetPrimaryPad(); + int iPrimaryPad = PlatformProfile.GetPrimaryPad(); bool isSignedInLive = true; bool isOnlineGame = pClass->m_MoreOptionsParams.bOnlineGame; int iPadNotSignedInLive = -1; bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable(); for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (ProfileManager.IsSignedIn(i) && + if (PlatformProfile.IsSignedIn(i) && ((i == iPrimaryPad) || isLocalMultiplayerAvailable)) { - if (isSignedInLive && !ProfileManager.IsSignedInLive(i)) { + if (isSignedInLive && !PlatformProfile.IsSignedInLive(i)) { // Record the first non signed in live pad iPadNotSignedInLive = i; } isSignedInLive = - isSignedInLive && ProfileManager.IsSignedInLive(i); + isSignedInLive && PlatformProfile.IsSignedInLive(i); } } @@ -944,7 +944,7 @@ int UIScene_LoadMenu::LoadDataComplete(void* pParam) { uiIDA[0] = IDS_CONFIRM_OK; ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); return 0; } @@ -954,8 +954,8 @@ int UIScene_LoadMenu::LoadDataComplete(void* pParam) { bool pccAllowed = true; bool pccFriendsAllowed = true; bool bContentRestricted = false; - ProfileManager.AllowedPlayerCreatedContent( - ProfileManager.GetPrimaryPad(), false, &pccAllowed, + PlatformProfile.AllowedPlayerCreatedContent( + PlatformProfile.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); noUGC = !pccAllowed && !pccFriendsAllowed; @@ -974,7 +974,7 @@ int UIScene_LoadMenu::LoadDataComplete(void* pParam) { pClass->m_bIgnoreInput = false; } else { int localUsersMask = CGameNetworkManager::GetLocalPlayerMask( - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); // No guest problems so we don't need to force a sign-in of // players here @@ -1073,7 +1073,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, } bool isClientSide = - ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && + PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; bool isPrivate = @@ -1176,7 +1176,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, completionData->iPad = DEFAULT_XUI_MENU_USER; loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); } @@ -1202,30 +1202,30 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void* pParam, bool bContinue, if (bContinue == true) { // It's possible that the player has not signed in - they can back out - if (ProfileManager.IsSignedIn(pClass->m_iPad)) { - int primaryPad = ProfileManager.GetPrimaryPad(); + if (PlatformProfile.IsSignedIn(pClass->m_iPad)) { + int primaryPad = PlatformProfile.GetPrimaryPad(); bool noPrivileges = false; int localUsersMask = 0; - bool isSignedInLive = ProfileManager.IsSignedInLive(primaryPad); + bool isSignedInLive = PlatformProfile.IsSignedInLive(primaryPad); bool isOnlineGame = pClass->m_MoreOptionsParams.bOnlineGame; int iPadNotSignedInLive = -1; bool isLocalMultiplayerAvailable = app.IsLocalMultiplayerAvailable(); for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (ProfileManager.IsSignedIn(i) && + if (PlatformProfile.IsSignedIn(i) && ((i == primaryPad) || isLocalMultiplayerAvailable)) { - if (isSignedInLive && !ProfileManager.IsSignedInLive(i)) { + if (isSignedInLive && !PlatformProfile.IsSignedInLive(i)) { // Record the first non signed in live pad iPadNotSignedInLive = i; } - if (!ProfileManager.AllowedToPlayMultiplayer(i)) + if (!PlatformProfile.AllowedToPlayMultiplayer(i)) noPrivileges = true; localUsersMask |= CGameNetworkManager::GetLocalPlayerMask(i); isSignedInLive = - isSignedInLive && ProfileManager.IsSignedInLive(i); + isSignedInLive && PlatformProfile.IsSignedInLive(i); } } @@ -1237,7 +1237,7 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void* pParam, bool bContinue, uiIDA[0] = IDS_CONFIRM_OK; ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); return 0; } @@ -1247,8 +1247,8 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void* pParam, bool bContinue, bool pccAllowed = true; bool pccFriendsAllowed = true; - ProfileManager.AllowedPlayerCreatedContent( - ProfileManager.GetPrimaryPad(), false, &pccAllowed, + PlatformProfile.AllowedPlayerCreatedContent( + PlatformProfile.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); if (!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -1261,7 +1261,7 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void* pParam, bool bContinue, ui.RequestAlertMessage( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); } else { pClass->m_bIgnoreInput = false; pClass->setVisible(true); @@ -1270,7 +1270,7 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void* pParam, bool bContinue, ui.RequestAlertMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); } } else { // This is NOT called from a storage manager thread, and is in diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp index 1eb606ab5..88e565f95 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp @@ -8,7 +8,7 @@ #include "platform/input/InputActions.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" @@ -115,8 +115,8 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void* initData, m_bSaveTransferInProgress = false; m_eAction = eAction_None; - m_bMultiplayerAllowed = ProfileManager.IsSignedInLive(m_iPad) && - ProfileManager.AllowedToPlayMultiplayer(m_iPad); + m_bMultiplayerAllowed = PlatformProfile.IsSignedInLive(m_iPad) && + PlatformProfile.AllowedToPlayMultiplayer(m_iPad); int iLB = -1; @@ -226,7 +226,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips() { // available // if(app.getRemoteStorage()->saveIsAvailable()) { - bool bSignedInLive = ProfileManager.IsSignedInLive(m_iPad); + bool bSignedInLive = PlatformProfile.IsSignedInLive(m_iPad); if (bSignedInLive) { iX = IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD; } @@ -296,8 +296,8 @@ void UIScene_LoadOrJoinMenu::handleGainFocus(bool navBack) { if (navBack) { app.SetLiveLinkRequired(true); - m_bMultiplayerAllowed = ProfileManager.IsSignedInLive(m_iPad) && - ProfileManager.AllowedToPlayMultiplayer(m_iPad); + m_bMultiplayerAllowed = PlatformProfile.IsSignedInLive(m_iPad) && + PlatformProfile.AllowedToPlayMultiplayer(m_iPad); // re-enable button presses m_bIgnoreInput = false; @@ -704,7 +704,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, // Save Transfer #if defined(SONY_REMOTE_STORAGE_DOWNLOAD) { - bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); + bool bSignedInLive = PlatformProfile.IsSignedInLive(iPad); if (bSignedInLive) { LaunchSaveTransfer(); } @@ -742,8 +742,8 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, uiIDA[2] = IDS_TOOLTIPS_DELETESAVE; int numOptions = 3; #if defined(SONY_REMOTE_STORAGE_UPLOAD) - if (ProfileManager.IsSignedInLive( - ProfileManager.GetPrimaryPad())) { + if (PlatformProfile.IsSignedInLive( + PlatformProfile.GetPrimaryPad())) { numOptions = 4; uiIDA[3] = IDS_TOOLTIPS_SAVETRANSFER_UPLOAD; } @@ -911,7 +911,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) { params->saveDetails = nullptr; // navigate to the settings scene - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_LoadMenu, params); } } else { @@ -937,7 +937,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) { { // navigate to the settings scene - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_LoadMenu, params); } } @@ -1011,7 +1011,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) { m_controlJoinTimer.setVisible(false); m_bIgnoreInput = true; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_JoinMenu, + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_JoinMenu, m_initData); } } @@ -1068,7 +1068,7 @@ void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions* levelGen) { completionData->iPad = DEFAULT_XUI_MENU_USER; loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); } @@ -1264,8 +1264,8 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) { switch (id) { case JOIN_LOAD_ONLINE_TIMER_ID: { bool bMultiplayerAllowed = - ProfileManager.IsSignedInLive(m_iPad) && - ProfileManager.AllowedToPlayMultiplayer(m_iPad); + PlatformProfile.IsSignedInLive(m_iPad) && + PlatformProfile.AllowedToPlayMultiplayer(m_iPad); if (bMultiplayerAllowed != m_bMultiplayerAllowed) { if (bMultiplayerAllowed) { // m_CheckboxOnline.SetEnable(true); @@ -1336,7 +1336,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk( completionData->iPad = DEFAULT_XUI_MENU_USER; loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); } @@ -1401,7 +1401,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud() { completionData->iPad = DEFAULT_XUI_MENU_USER; loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); } @@ -1680,7 +1680,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { ui.RequestAlertMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_WRONG_VERSION, uiIDA, 1, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), RemoteSaveNotFoundCallback, pClass); } } else { @@ -1691,7 +1691,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { ui.RequestAlertMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_NOT_AVAILABLE_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), RemoteSaveNotFoundCallback, pClass); } } @@ -1988,7 +1988,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { // player ui.RequestErrorMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, - uiIDA, 1, ProfileManager.GetPrimaryPad(), + uiIDA, 1, PlatformProfile.GetPrimaryPad(), CrossSaveFinishedCallback, pClass); pClass->m_eSaveTransferState = eSaveTransfer_Finished; } break; @@ -2071,14 +2071,14 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; uint32_t errorMessage = IDS_SAVE_TRANSFER_DOWNLOADFAILED; - if (!ProfileManager.IsSignedInLive( - ProfileManager.GetPrimaryPad())) { + if (!PlatformProfile.IsSignedInLive( + PlatformProfile.GetPrimaryPad())) { errorMessage = IDS_ERROR_NETWORK; // show "A network error has // occurred." #if defined(__VITA__) - if (!ProfileManager.IsSignedInPSN( - ProfileManager.GetPrimaryPad())) { + if (!PlatformProfile.IsSignedInPSN( + PlatformProfile.GetPrimaryPad())) { errorMessage = IDS_PRO_NOTONLINE_TEXT; // show "not signed // into PSN" @@ -2087,7 +2087,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { } ui.RequestErrorMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, errorMessage, uiIDA, 1, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), CrossSaveFinishedCallback, pClass); pClass->m_eSaveTransferState = eSaveTransfer_Finished; } diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp index 070c56eb8..4db7251e5 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp @@ -8,7 +8,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" @@ -145,13 +145,13 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) { if (!navBack) { for (int iPad = 0; iPad < MAX_LOCAL_PLAYERS; iPad++) { // For returning to menus after exiting a game. - if (ProfileManager.IsSignedIn(iPad)) { - ProfileManager.SetCurrentGameActivity( + if (PlatformProfile.IsSignedIn(iPad)) { + PlatformProfile.SetCurrentGameActivity( iPad, CONTEXT_PRESENCE_MENUS, false); } } } - ProfileManager.SetLockedProfile(-1); + PlatformProfile.SetLockedProfile(-1); m_bIgnorePress = false; updateTooltips(); @@ -214,8 +214,8 @@ void UIScene_MainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, switch (key) { case ACTION_MENU_OK: if (pressed) { - ProfileManager.SetPrimaryPad(iPad); - ProfileManager.SetLockedProfile(-1); + PlatformProfile.SetPrimaryPad(iPad); + PlatformProfile.SetLockedProfile(-1); sendInputToMovie(key, repeat, pressed, released); } break; @@ -228,7 +228,7 @@ void UIScene_MainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, } void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) { - int primaryPad = ProfileManager.GetPrimaryPad(); + int primaryPad = PlatformProfile.GetPrimaryPad(); std::function signInReturnedFunc; @@ -294,9 +294,9 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) { // Note: if no sign in returned func, assume this isn't required if (signInReturnedFunc) { - if (ProfileManager.IsSignedIn(primaryPad)) { + if (PlatformProfile.IsSignedIn(primaryPad)) { if (confirmUser) { - ProfileManager.RequestSignInUI(false, false, true, false, true, + PlatformProfile.RequestSignInUI(false, false, true, false, true, signInReturnedFunc, primaryPad); } else { @@ -403,7 +403,7 @@ int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, // in the list switch (pClass->m_eAction) { case eAction_RunGame: - ProfileManager.RequestSignInUI( + PlatformProfile.RequestSignInUI( false, true, false, false, true, [pClass](bool b, int p) { return CreateLoad_SignInReturned(pClass, b, p); @@ -411,7 +411,7 @@ int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, iPad); break; case eAction_RunHelpAndOptions: - ProfileManager.RequestSignInUI( + PlatformProfile.RequestSignInUI( false, false, true, false, true, [pClass](bool b, int p) { return HelpAndOptions_SignInReturned(pClass, b, p); @@ -419,7 +419,7 @@ int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, iPad); break; case eAction_RunLeaderboards: - ProfileManager.RequestSignInUI( + PlatformProfile.RequestSignInUI( false, false, true, false, true, [pClass](bool b, int p) { return Leaderboards_SignInReturned(pClass, b, p); @@ -427,7 +427,7 @@ int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, iPad); break; case eAction_RunAchievements: - ProfileManager.RequestSignInUI( + PlatformProfile.RequestSignInUI( false, false, true, false, true, [pClass](bool b, int p) { return Achievements_SignInReturned(pClass, b, p); @@ -435,7 +435,7 @@ int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, iPad); break; case eAction_RunUnlockOrDLC: - ProfileManager.RequestSignInUI( + PlatformProfile.RequestSignInUI( false, false, true, false, true, [pClass](bool b, int p) { return UnlockFullGame_SignInReturned(pClass, b, p); @@ -448,11 +448,11 @@ int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, } else { pClass->m_bIgnorePress = false; // unlock the profile - ProfileManager.SetLockedProfile(-1); + PlatformProfile.SetLockedProfile(-1); for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence - if (ProfileManager.IsSignedIn(i)) { - ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, + if (PlatformProfile.IsSignedIn(i)) { + PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); } } @@ -468,14 +468,14 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void* pParam, if (bContinue) { // 4J-JEV: Don't we only need to update rich-presence if the sign-in // status changes. - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, + PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); #if TO_BE_IMPLEMENTED if (app.GetTMSDLCInfoRead()) #endif { - ProfileManager.SetLockedProfile(ProfileManager.GetPrimaryPad()); + PlatformProfile.SetLockedProfile(PlatformProfile.GetPrimaryPad()); proceedToScene(iPad, eUIScene_HelpAndOptionsMenu); } #if TO_BE_IMPLEMENTED @@ -500,11 +500,11 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void* pParam, } else { pClass->m_bIgnorePress = false; // unlock the profile - ProfileManager.SetLockedProfile(-1); + PlatformProfile.SetLockedProfile(-1); for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence - if (ProfileManager.IsSignedIn(i)) { - ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, + if (PlatformProfile.IsSignedIn(i)) { + PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); } } @@ -520,24 +520,24 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, if (bContinue) { // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, + PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); unsigned int uiIDA[1] = {IDS_OK}; - if (ProfileManager.IsGuest(ProfileManager.GetPrimaryPad())) { + if (PlatformProfile.IsGuest(PlatformProfile.GetPrimaryPad())) { pClass->m_bIgnorePress = false; ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } else { - ProfileManager.SetLockedProfile(ProfileManager.GetPrimaryPad()); + PlatformProfile.SetLockedProfile(PlatformProfile.GetPrimaryPad()); // change the minecraft player name Minecraft::GetInstance()->user->name = convStringToWstring( - ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); + PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad())); { - bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); + bool bSignedInLive = PlatformProfile.IsSignedInLive(iPad); // Check if we're signed in to LIVE if (bSignedInLive) { @@ -545,7 +545,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, if (!app.DLCInstallProcessCompleted()) app.StartInstallDLCProcess(iPad); - if (ProfileManager.IsGuest(iPad)) { + if (PlatformProfile.IsGuest(iPad)) { pClass->m_bIgnorePress = false; ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, @@ -564,14 +564,14 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, // ensure we've applied this player's settings app.ApplyGameSettingsChanged( - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); // check for DLC // start timer to track DLC check finished pClass->m_Timer.SetShow(true); XuiSetTimer(pClass->m_hObj, DLC_INSTALLED_TIMER_ID, DLC_INSTALLED_TIMER_TIME); - // app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MultiGameJoinLoad); + // app.NavigateToScene(PlatformProfile.GetPrimaryPad(),eUIScene_MultiGameJoinLoad); } } else { // Changing to async TMS calls @@ -595,29 +595,29 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, #else Minecraft* pMinecraft = Minecraft::GetInstance(); pMinecraft->user->name = - convStringToWstring(ProfileManager.GetGamertag( - ProfileManager.GetPrimaryPad())); + convStringToWstring(PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad())); // ensure we've applied this player's settings app.ApplyGameSettingsChanged(iPad); - proceedToScene(ProfileManager.GetPrimaryPad(), + proceedToScene(PlatformProfile.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); #endif } } else { #if TO_BE_IMPLEMENTED // offline - ProfileManager.DisplayOfflineProfile( + PlatformProfile.DisplayOfflineProfile( [pClass](bool b, int p) { return CScene_Main::CreateLoad_OfflineProfileReturned( pClass, b, p); }, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); #else app.DebugPrintf( "Offline Profile returned not implemented\n"); - proceedToScene(ProfileManager.GetPrimaryPad(), + proceedToScene(PlatformProfile.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); #endif } @@ -627,11 +627,11 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, pClass->m_bIgnorePress = false; // unlock the profile - ProfileManager.SetLockedProfile(-1); + PlatformProfile.SetLockedProfile(-1); for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence - if (ProfileManager.IsSignedIn(i)) { - ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, + if (PlatformProfile.IsSignedIn(i)) { + PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); } } @@ -646,18 +646,18 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, if (bContinue) { // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, + PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); unsigned int uiIDA[1] = {IDS_OK}; // guests can't look at leaderboards - if (ProfileManager.IsGuest(ProfileManager.GetPrimaryPad())) { + if (PlatformProfile.IsGuest(PlatformProfile.GetPrimaryPad())) { pClass->m_bIgnorePress = false; ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); - } else if (!ProfileManager.IsSignedInLive( - ProfileManager.GetPrimaryPad())) { + } else if (!PlatformProfile.IsSignedInLive( + PlatformProfile.GetPrimaryPad())) { pClass->m_bIgnorePress = false; ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1); @@ -672,22 +672,22 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, uiIDA[0] = IDS_CONFIRM_OK; ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); #endif } else { - ProfileManager.SetLockedProfile(ProfileManager.GetPrimaryPad()); - proceedToScene(ProfileManager.GetPrimaryPad(), + PlatformProfile.SetLockedProfile(PlatformProfile.GetPrimaryPad()); + proceedToScene(PlatformProfile.GetPrimaryPad(), eUIScene_LeaderboardsMenu); } } } else { pClass->m_bIgnorePress = false; // unlock the profile - ProfileManager.SetLockedProfile(-1); + PlatformProfile.SetLockedProfile(-1); for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence - if (ProfileManager.IsSignedIn(i)) { - ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, + if (PlatformProfile.IsSignedIn(i)) { + PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); } } @@ -703,18 +703,18 @@ int UIScene_MainMenu::Achievements_SignInReturned(void* pParam, bool bContinue, pClass->m_bIgnorePress = false; // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, + PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); - // XShowAchievementsUI(ProfileManager.GetPrimaryPad()); + // XShowAchievementsUI(PlatformProfile.GetPrimaryPad()); } else { pClass->m_bIgnorePress = false; // unlock the profile - ProfileManager.SetLockedProfile(-1); + PlatformProfile.SetLockedProfile(-1); for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence - if (ProfileManager.IsSignedIn(i)) { - ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, + if (PlatformProfile.IsSignedIn(i)) { + PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); } } @@ -729,18 +729,18 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, if (bContinue) { // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. - ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, + PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); pClass->RunUnlockOrDLC(iPad); } else { pClass->m_bIgnorePress = false; // unlock the profile - ProfileManager.SetLockedProfile(-1); + PlatformProfile.SetLockedProfile(-1); for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence - if (ProfileManager.IsSignedIn(i)) { - ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, + if (PlatformProfile.IsSignedIn(i)) { + PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); } } @@ -770,7 +770,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { app.ReleaseSaveThumbnail(); - if (ProfileManager.IsGuest(iPad)) { + if (PlatformProfile.IsGuest(iPad)) { unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; @@ -778,23 +778,23 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } else { - ProfileManager.SetLockedProfile(iPad); + PlatformProfile.SetLockedProfile(iPad); // If the player was signed in before selecting play, we'll not have // read the profile yet, so query the sign-in status to get this to // happen - ProfileManager.QuerySigninStatus(); + PlatformProfile.QuerySigninStatus(); // 4J-PB - Need to check for installed DLC if (!app.DLCInstallProcessCompleted()) app.StartInstallDLCProcess(iPad); { // are we offline? - bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); + bool bSignedInLive = PlatformProfile.IsSignedInLive(iPad); if (!bSignedInLive) { - ProfileManager.SetLockedProfile(iPad); - proceedToScene(ProfileManager.GetPrimaryPad(), + PlatformProfile.SetLockedProfile(iPad); + proceedToScene(PlatformProfile.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); } else { #if TO_BE_IMPLEMENTED @@ -809,8 +809,8 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { &CScene_Main::DeviceSelectReturned, this) == true) { // change the minecraft player name pMinecraft->user->name = - convStringToWstring(ProfileManager.GetGamertag( - ProfileManager.GetPrimaryPad())); + convStringToWstring(PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad())); // save device already selected // ensure we've applied this player's settings @@ -841,12 +841,12 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { } #else pMinecraft->user->name = convStringToWstring( - ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); + PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad())); // ensure we've applied this player's settings app.ApplyGameSettingsChanged(iPad); - proceedToScene(ProfileManager.GetPrimaryPad(), + proceedToScene(PlatformProfile.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); #endif } @@ -859,10 +859,10 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) { uiIDA[0] = IDS_OK; // guests can't look at leaderboards - if (ProfileManager.IsGuest(iPad)) { + if (PlatformProfile.IsGuest(iPad)) { ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); - } else if (!ProfileManager.IsSignedInLive(iPad)) { + } else if (!PlatformProfile.IsSignedInLive(iPad)) { ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1); } else { @@ -885,14 +885,14 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) { uiIDA[0] = IDS_CONFIRM_OK; ui.RequestErrorMessage( IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, - ProfileManager.GetPrimaryPad(), nullptr, this); + PlatformProfile.GetPrimaryPad(), nullptr, this); #endif } else { - ProfileManager.SetLockedProfile(iPad); + PlatformProfile.SetLockedProfile(iPad); // If the player was signed in before selecting play, we'll not have // read the profile yet, so query the sign-in status to get this to // happen - ProfileManager.QuerySigninStatus(); + PlatformProfile.QuerySigninStatus(); proceedToScene(iPad, eUIScene_LeaderboardsMenu); } @@ -903,8 +903,8 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) { uiIDA[0] = IDS_OK; // downloadable content - if (ProfileManager.IsSignedInLive(iPad)) { - if (ProfileManager.IsGuest(iPad)) { + if (PlatformProfile.IsSignedInLive(iPad)) { + if (PlatformProfile.IsGuest(iPad)) { m_bIgnorePress = false; ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); @@ -912,7 +912,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) { // If the player was signed in before selecting play, we'll not // have read the profile yet, so query the sign-in status to get // this to happen - ProfileManager.QuerySigninStatus(); + PlatformProfile.QuerySigninStatus(); { bool bContentRestricted = false; @@ -925,12 +925,12 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) { uiIDA[0] = IDS_CONFIRM_OK; ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, - ProfileManager.GetPrimaryPad(), + PlatformProfile.GetPrimaryPad(), nullptr, this); #endif } else { - ProfileManager.SetLockedProfile(iPad); - proceedToScene(ProfileManager.GetPrimaryPad(), + PlatformProfile.SetLockedProfile(iPad); + proceedToScene(PlatformProfile.GetPrimaryPad(), eUIScene_DLCMainMenu); } } @@ -941,7 +941,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) { // We want to navigate to the DLC scene, but block input until // we get the DLC file in from TMS Don't navigate - we might // have an uplink disconnect - // app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DLCMainMenu); + // app.NavigateToScene(PlatformProfile.GetPrimaryPad(),eUIScene_DLCMainMenu); } } else { unsigned int uiIDA[1]; @@ -976,7 +976,7 @@ void UIScene_MainMenu::tick() { #endif if ((eNavigateWhenReady >= 0)) { - int lockedProfile = ProfileManager.GetLockedProfile(); + int lockedProfile = PlatformProfile.GetLockedProfile(); { app.DebugPrintf("[MainMenu] Navigating away from MainMenu.\n"); @@ -992,7 +992,7 @@ void UIScene_MainMenu::RunAchievements(int iPad) { uiIDA[0] = IDS_OK; // guests can't look at achievements - if (ProfileManager.IsGuest(iPad)) { + if (PlatformProfile.IsGuest(iPad)) { ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } else { @@ -1002,7 +1002,7 @@ void UIScene_MainMenu::RunAchievements(int iPad) { } void UIScene_MainMenu::RunHelpAndOptions(int iPad) { - if (ProfileManager.IsGuest(iPad)) { + if (PlatformProfile.IsGuest(iPad)) { unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, @@ -1011,14 +1011,14 @@ void UIScene_MainMenu::RunHelpAndOptions(int iPad) { // If the player was signed in before selecting play, we'll not have // read the profile yet, so query the sign-in status to get this to // happen - ProfileManager.QuerySigninStatus(); + PlatformProfile.QuerySigninStatus(); #if TO_BE_IMPLEMENTED // 4J-PB - You can be offline and still can go into help and options - if (app.GetTMSDLCInfoRead() || !ProfileManager.IsSignedInLive(iPad)) + if (app.GetTMSDLCInfoRead() || !PlatformProfile.IsSignedInLive(iPad)) #endif { - ProfileManager.SetLockedProfile(iPad); + PlatformProfile.SetLockedProfile(iPad); proceedToScene(iPad, eUIScene_HelpAndOptionsMenu); } #if TO_BE_IMPLEMENTED @@ -1087,12 +1087,12 @@ void UIScene_MainMenu::LoadTrial(void) { completionData->bShowBackground = true; completionData->bShowLogo = true; completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; - completionData->iPad = ProfileManager.GetPrimaryPad(); + completionData->iPad = PlatformProfile.GetPrimaryPad(); loadingParams->completionData = completionData; ui.ShowTrialTimer(true); - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); } diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp index c68b0f0ba..f30704895 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp @@ -4,7 +4,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/App_Defines.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -39,7 +39,7 @@ UIScene_SaveMessage::UIScene_SaveMessage(int iPad, void* initData, // 4J-PB - If we have a signed in user connected, let's get the DLC now for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if ((PlatformInput.IsPadConnected(i) || ProfileManager.IsSignedIn(i))) { + if ((PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i))) { if (!app.DLCInstallProcessCompleted() && !app.DLCInstallPending()) { app.StartInstallDLCProcess(i); break; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp index 508cd538f..656f849d0 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp @@ -2,7 +2,7 @@ #include "UIScene_TrialExitUpsell.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/App_Defines.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" @@ -49,7 +49,7 @@ void UIScene_TrialExitUpsell::handleInput(int iPad, int key, bool repeat, } break; case ACTION_MENU_X: - if (ProfileManager.IsSignedIn(iPad)) { + if (PlatformProfile.IsSignedIn(iPad)) { // CD - Added for audio ui.PlayUISFX(eSFX_Press); } diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp index b8cbb8e83..009710a2b 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp @@ -2,7 +2,7 @@ #include "UIScene_HelpAndOptionsMenu.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" @@ -47,7 +47,7 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void* initData, bool bNotInGame = (Minecraft::GetInstance()->level == nullptr); // any content to be re-installed? - if (m_iPad == ProfileManager.GetPrimaryPad() && bNotInGame) { + if (m_iPad == PlatformProfile.GetPrimaryPad() && bNotInGame) { // We should show the reinstall menu app.DebugPrintf("Reinstall Menu required...\n"); } else { @@ -61,7 +61,7 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void* initData, #if TO_BE_IMPLEMENTED app.AdjustSplitscreenScene(m_hObj, &m_OriginalPosition, m_iPad, false); #endif - if (ProfileManager.GetPrimaryPad() != m_iPad) { + if (PlatformProfile.GetPrimaryPad() != m_iPad) { removeControl(&m_buttons[BUTTON_HAO_REINSTALL], false); } } @@ -117,7 +117,7 @@ void UIScene_HelpAndOptionsMenu::handleReload() { bool bNotInGame = (Minecraft::GetInstance()->level == nullptr); // any content to be re-installed? - if (m_iPad == ProfileManager.GetPrimaryPad() && bNotInGame) { + if (m_iPad == PlatformProfile.GetPrimaryPad() && bNotInGame) { // We should show the reinstall menu app.DebugPrintf("Reinstall Menu required...\n"); } else { @@ -131,7 +131,7 @@ void UIScene_HelpAndOptionsMenu::handleReload() { #if TO_BE_IMPLEMENTED app.AdjustSplitscreenScene(m_hObj, &m_OriginalPosition, m_iPad, false); #endif - if (ProfileManager.GetPrimaryPad() != m_iPad) { + if (PlatformProfile.GetPrimaryPad() != m_iPad) { removeControl(&m_buttons[BUTTON_HAO_REINSTALL], false); } } diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp index e5de3e687..afececfb9 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp @@ -3,7 +3,7 @@ #include #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" @@ -51,7 +51,7 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, doHorizontalResizeCheck(); bool bInGame = (Minecraft::GetInstance()->level != nullptr); - bool bIsPrimaryPad = (ProfileManager.GetPrimaryPad() == m_iPad); + bool bIsPrimaryPad = (PlatformProfile.GetPrimaryPad() == m_iPad); // if we're not in the game, we need to use basescene 0 if (bInGame) { // If the game has started, then you need to be the host to change the diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp index 16995bc5c..931d26cdb 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp @@ -2,7 +2,7 @@ #include "UIScene_SettingsMenu.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" @@ -28,7 +28,7 @@ UIScene_SettingsMenu::UIScene_SettingsMenu(int iPad, void* initData, m_buttons[BUTTON_ALL_RESETTODEFAULTS].init(IDS_RESET_TO_DEFAULTS, BUTTON_ALL_RESETTODEFAULTS); - if (ProfileManager.GetPrimaryPad() != m_iPad) { + if (PlatformProfile.GetPrimaryPad() != m_iPad) { removeControl(&m_buttons[BUTTON_ALL_AUDIO], bNotInGame); removeControl(&m_buttons[BUTTON_ALL_GRAPHICS], bNotInGame); } @@ -55,7 +55,7 @@ std::wstring UIScene_SettingsMenu::getMoviePath() { void UIScene_SettingsMenu::handleReload() { bool bNotInGame = (Minecraft::GetInstance()->level == nullptr); - if (ProfileManager.GetPrimaryPad() != m_iPad) { + if (PlatformProfile.GetPrimaryPad() != m_iPad) { removeControl(&m_buttons[BUTTON_ALL_AUDIO], bNotInGame); removeControl(&m_buttons[BUTTON_ALL_GRAPHICS], bNotInGame); } @@ -151,7 +151,7 @@ int UIScene_SettingsMenu::ResetDefaultsDialogReturned( // results switched for this dialog if (result == C4JStorage::EMessage_ResultDecline) { app.SetDefaultOptions( - ProfileManager.GetDashboardProfileSettings(pClass->m_iPad), + PlatformProfile.GetDashboardProfileSettings(pClass->m_iPad), pClass->m_iPad); // if the profile data has been changed, then force a profile write // It seems we're allowed to break the 5 minute rule if it's the result diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp index eb53ae30e..442fa90d1 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp @@ -4,7 +4,7 @@ #include #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" @@ -114,7 +114,7 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, bool bRemoveInGameGamertags = false; bool bNotInGame = (Minecraft::GetInstance()->level == nullptr); - bool bPrimaryPlayer = ProfileManager.GetPrimaryPad() == m_iPad; + bool bPrimaryPlayer = PlatformProfile.GetPrimaryPad() == m_iPad; if (!bPrimaryPlayer) { bRemoveDifficulty = true; bRemoveAutosave = true; @@ -318,7 +318,7 @@ void UIScene_SettingsOptionsMenu::handleReload() { bool bRemoveInGameGamertags = false; bool bNotInGame = (Minecraft::GetInstance()->level == nullptr); - bool bPrimaryPlayer = ProfileManager.GetPrimaryPad() == m_iPad; + bool bPrimaryPlayer = PlatformProfile.GetPrimaryPad() == m_iPad; if (!bPrimaryPlayer) { bRemoveDifficulty = true; bRemoveAutosave = true; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp index ab430aeb2..c5ef9709b 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp @@ -4,7 +4,7 @@ #include #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" @@ -63,7 +63,7 @@ UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void* initData, doHorizontalResizeCheck(); bool bInGame = (Minecraft::GetInstance()->level != nullptr); - bool bPrimaryPlayer = ProfileManager.GetPrimaryPad() == m_iPad; + bool bPrimaryPlayer = PlatformProfile.GetPrimaryPad() == m_iPad; // if we're not in the game, we need to use basescene 0 if (bInGame) { diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp index 00729a969..2b6b36740 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -6,7 +6,7 @@ #include #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" #include "app/common/Minecraft_Macros.h" @@ -427,7 +427,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) { uiIDA[0] = IDS_OK; // We need to upsell the full version - if (ProfileManager.IsGuest(iPad)) { + if (PlatformProfile.IsGuest(iPad)) { // can't buy ui.RequestAlertMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, @@ -1234,8 +1234,8 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned( UIScene_SkinSelectMenu* pScene = (UIScene_SkinSelectMenu*)pParam; if ((result == C4JStorage::EMessage_ResultAccept) && - ProfileManager.IsSignedIn(iPad)) { - if (ProfileManager.IsSignedInLive(iPad)) { + PlatformProfile.IsSignedIn(iPad)) { + if (PlatformProfile.IsSignedInLive(iPad)) { } else // Is signed in, but not live. { pScene->showNotOnlineDialog(iPad); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp index c6388196e..9c2a31751 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp @@ -8,7 +8,7 @@ #include #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp index f6b1c80b7..97853ac76 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp index f23df9a52..0b9ade283 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp @@ -5,7 +5,7 @@ #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp index 80bf0cf87..67b138708 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp @@ -3,7 +3,7 @@ #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp index cf1fdb305..3cbc49aea 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp @@ -6,7 +6,7 @@ #include #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp index bdba3b2c3..27dd4b07a 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp @@ -2,7 +2,7 @@ #include "UIScene_CraftingMenu.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp index e4907cd16..03a42c411 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp @@ -4,7 +4,7 @@ #include #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Storage.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" @@ -101,7 +101,7 @@ void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId) { // then cancels the exit player becomes stuck at game over screen // m_bIgnoreInput = true; // is it the primary player exiting? - if (m_iPad == ProfileManager.GetPrimaryPad()) { + if (m_iPad == PlatformProfile.GetPrimaryPad()) { unsigned int uiIDA[3]; int playTime = -1; if (pMinecraft->localplayers[m_iPad] != nullptr) { diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp index ad3e71681..cfc1b8f36 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp @@ -8,7 +8,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/UIScene.h" @@ -62,7 +62,7 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void* initData, UILayer* parentLayer) pMinecraft->localplayers[ui.GetWinUserIndex()]->getDisplayName()); } else { playerName = - escapeXML(pMinecraft->localplayers[ProfileManager.GetPrimaryPad()] + escapeXML(pMinecraft->localplayers[PlatformProfile.GetPrimaryPad()] ->getDisplayName()); } noNoiseString = replaceAll(noNoiseString, L"{*PLAYER*}", playerName); @@ -168,9 +168,9 @@ void UIScene_EndPoem::handleInput(int iPad, int key, bool repeat, bool pressed, // This just allows it to be shown if (pMinecraft - ->localgameModes[ProfileManager.GetPrimaryPad()] != + ->localgameModes[PlatformProfile.GetPrimaryPad()] != nullptr) - pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] + pMinecraft->localgameModes[PlatformProfile.GetPrimaryPad()] ->getTutorial() ->showTutorialPopup(true); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp index 559ccd2e4..814e015d0 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp @@ -4,7 +4,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" @@ -269,7 +269,7 @@ void UIScene_InGameInfoMenu::handleInput(int iPad, int key, bool repeat, if (player != nullptr) { PlayerUID uid = player->GetUID(); if (uid != INVALID_XUID) { - ProfileManager.ShowProfileCard(iPad, uid); + PlatformProfile.ShowProfileCard(iPad, uid); } } } diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp index 6ee8af491..9e1199570 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp @@ -6,7 +6,7 @@ #include #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" @@ -65,7 +65,7 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void* initData, // IsLocalGame() issues on Iggy if (/*g_NetworkManager.IsLocalGame() &&*/ g_NetworkManager .GetPlayerCount() == 1) { - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)true); } @@ -107,9 +107,9 @@ std::wstring UIScene_PauseMenu::getMoviePath() { void UIScene_PauseMenu::tick() { UIScene::tick(); } void UIScene_PauseMenu::updateTooltips() { - // bool bUserisClientSide = ProfileManager.IsSignedInLive(m_iPad); + // bool bUserisClientSide = PlatformProfile.IsSignedInLive(m_iPad); // bool bIsisPrimaryHost = - // g_NetworkManager.IsHost() && (ProfileManager.GetPrimaryPad() == + // g_NetworkManager.IsHost() && (PlatformProfile.GetPrimaryPad() == // m_iPad); int iY = -1; @@ -146,7 +146,7 @@ void UIScene_PauseMenu::updateControlsVisibility() { // Pause Menu does not have a Leaderboards option. TCR # 128: XLA Pause // Menu: When in a multiplayer game as a client the Pause Menu does not // have an Achievements option. - if (ProfileManager.GetPrimaryPad() == + if (PlatformProfile.GetPrimaryPad() == m_iPad) // && g_NetworkManager.IsHost()) { // are we in splitscreen? @@ -192,10 +192,10 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, // TODO: proper fix for pausing // 4jcraft: replace IsLocalGame() with GetPlayerCount() == 1 due // to IsLocalGame() issues on Iggy - if (iPad == ProfileManager.GetPrimaryPad() && + if (iPad == PlatformProfile.GetPrimaryPad() && /*g_NetworkManager.IsLocalGame()*/ g_NetworkManager .GetPlayerCount() == 1) { - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)false); } @@ -261,10 +261,10 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { // TODO: proper fix for pausing // 4jcraft: replace IsLocalGame() with GetPlayerCount() == 1 due to // IsLocalGame() issues on Iggy - if (m_iPad == ProfileManager.GetPrimaryPad() && + if (m_iPad == PlatformProfile.GetPrimaryPad() && /*g_NetworkManager.IsLocalGame()*/ g_NetworkManager .GetPlayerCount() == 1) { - app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), + app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)false); } @@ -276,11 +276,11 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { // 4J Gordon: Being used for the leaderboards proper now // guests can't look at leaderboards - if (ProfileManager.IsGuest(m_iPad)) { + if (PlatformProfile.IsGuest(m_iPad)) { ui.RequestAlertMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); - } else if (!ProfileManager.IsSignedInLive(m_iPad)) { + PlatformProfile.GetPrimaryPad()); + } else if (!PlatformProfile.IsSignedInLive(m_iPad)) { unsigned int uiIDA[1] = {IDS_OK}; ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, @@ -304,12 +304,12 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { } break; case BUTTON_PAUSE_ACHIEVEMENTS: // guests can't look at achievements - if (ProfileManager.IsGuest(m_iPad)) { + if (PlatformProfile.IsGuest(m_iPad)) { unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestAlertMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad()); + PlatformProfile.GetPrimaryPad()); } else { // XShowAchievementsUI(m_iPad); } @@ -326,7 +326,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { unsigned int uiIDA[3]; // is it the primary player exiting? - if (m_iPad == ProfileManager.GetPrimaryPad()) { + if (m_iPad == PlatformProfile.GetPrimaryPad()) { int playTime = -1; if (pMinecraft->localplayers[m_iPad] != nullptr) { playTime = (int)pMinecraft->localplayers[m_iPad] diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp index ffd65d895..1645893d6 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp @@ -2,7 +2,7 @@ #include "UIScene_ConnectingProgress.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -148,7 +148,7 @@ void UIScene_ConnectingProgress::handleTimerComplete(int id) { break; } - if (m_iPad != ProfileManager.GetPrimaryPad() && + if (m_iPad != PlatformProfile.GetPrimaryPad() && g_NetworkManager.IsInSession()) { m_buttonConfirm.setVisible(true); m_showingButton = true; @@ -162,11 +162,11 @@ void UIScene_ConnectingProgress::handleTimerComplete(int id) { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; ui.RequestErrorMessage(IDS_CONNECTION_FAILED, exitReasonStringId, - uiIDA, 1, ProfileManager.GetPrimaryPad()); + uiIDA, 1, PlatformProfile.GetPrimaryPad()); exitReasonStringId = -1; // app.NavigateToHomeMenu(); - app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ExitWorld, + app.SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_ExitWorld, (void*)true); } } @@ -219,7 +219,7 @@ void UIScene_ConnectingProgress::handlePress(F64 controlId, F64 childId) { switch ((int)controlId) { case eControl_Confirm: if (m_showingButton) { - if (m_iPad != ProfileManager.GetPrimaryPad() && + if (m_iPad != PlatformProfile.GetPrimaryPad() && g_NetworkManager.IsInSession()) { // The connection failed if we see the button, so the temp // player should be removed and the viewports updated again @@ -228,7 +228,7 @@ void UIScene_ConnectingProgress::handlePress(F64 controlId, F64 childId) { m_removeLocalPlayer = true; } else { ui.NavigateToHomeMenu(); - // app.NavigateBack( ProfileManager.GetPrimaryPad() ); + // app.NavigateBack( PlatformProfile.GetPrimaryPad() ); } } break; diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index 182bd1444..ee69a4b49 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -6,7 +6,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" @@ -233,9 +233,9 @@ void UIScene_FullscreenProgress::tick() { // This just allows it to be shown Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes - [ProfileManager.GetPrimaryPad()] != nullptr) + [PlatformProfile.GetPrimaryPad()] != nullptr) pMinecraft - ->localgameModes[ProfileManager + ->localgameModes[PlatformProfile .GetPrimaryPad()] ->getTutorial() ->showTutorialPopup(true); diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp index 62a16ea6f..3b17861cd 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp @@ -3,7 +3,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -156,7 +156,7 @@ bool UIScene_MessageBox::hasFocus(int iPad) { if (m_iPad == 255) { // Message box is for everyone return bHasFocus; - } else if (ProfileManager.IsSignedIn(m_iPad)) { + } else if (PlatformProfile.IsSignedIn(m_iPad)) { // Owner is still present return bHasFocus && (iPad == m_iPad); } else { diff --git a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp index 8f7f0bc00..ff9dc3e1e 100644 --- a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp @@ -6,7 +6,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" @@ -81,7 +81,7 @@ void UIScene_QuadrantSignin::handleInput(int iPad, int key, bool repeat, { m_bIgnoreInput = true; m_signInInfo.Func(false, iPad); - ProfileManager.CancelProfileAvatarRequest(); + PlatformProfile.CancelProfileAvatarRequest(); navigateBack(); } @@ -90,16 +90,16 @@ void UIScene_QuadrantSignin::handleInput(int iPad, int key, bool repeat, case ACTION_MENU_OK: if (pressed) { m_bIgnoreInput = true; - if (ProfileManager.IsSignedIn(iPad)) { + if (PlatformProfile.IsSignedIn(iPad)) { app.DebugPrintf("Signed in pad pressed\n"); - ProfileManager.CancelProfileAvatarRequest(); + PlatformProfile.CancelProfileAvatarRequest(); navigateBack(); m_signInInfo.Func(true, m_iPad); } else { { app.DebugPrintf("Non-signed in pad pressed\n"); - ProfileManager.RequestSignInUI( + PlatformProfile.RequestSignInUI( false, false, false, true, true, [this](bool bContinue, int pad) { return SignInReturned(this, bContinue, pad); @@ -137,20 +137,20 @@ int UIScene_QuadrantSignin::SignInReturned(void* pParam, bool bContinue, void UIScene_QuadrantSignin::updateState() { for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (ProfileManager.IsSignedIn(i) && PlatformInput.IsPadConnected(i)) { + if (PlatformProfile.IsSignedIn(i) && PlatformInput.IsPadConnected(i)) { // app.DebugPrintf("Index %d is signed in, display name - '%s'\n", - // i, ProfileManager.GetDisplayName(i).data()); + // i, PlatformProfile.GetDisplayName(i).data()); { setControllerState(i, eControllerStatus_PlayerDetails); } - m_labelDisplayName[i].setLabel(ProfileManager.GetDisplayName(i)); + m_labelDisplayName[i].setLabel(PlatformProfile.GetDisplayName(i)); // m_buttonControllers[i].setLabel(app.GetString(IDS_TOOLTIPS_CONTINUE),i); if (!m_iconRequested[i]) { app.DebugPrintf(app.USER_SR, "Requesting avatar for %d\n", i); - if (ProfileManager.GetProfileAvatar( + if (PlatformProfile.GetProfileAvatar( i, [this](std::uint8_t* data, unsigned int bytes) { return AvatarReturned(this, data, bytes); @@ -226,14 +226,14 @@ void UIScene_QuadrantSignin::_initQuadrants() { m_controllerStatus[i] = eControllerStatus_ConnectController; - if (ProfileManager.IsSignedIn(i)) { + if (PlatformProfile.IsSignedIn(i)) { app.DebugPrintf("Index %d is signed in\n", i); { setControllerState(i, eControllerStatus_PlayerDetails); } - m_labelDisplayName[i].init(ProfileManager.GetDisplayName(i)); + m_labelDisplayName[i].init(PlatformProfile.GetDisplayName(i)); } else if (PlatformInput.IsPadConnected(i)) { app.DebugPrintf("Index %d is not signed in\n", i); diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 23fe7cf1c..561d4cbdd 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -11,7 +11,7 @@ #include #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" @@ -387,7 +387,7 @@ void UIController::SetupFont() { if (m_eTargetFont == m_eCurrentFont) { // 4J-JEV: If we're ingame, reload the font to update all the text. if (app.GetGameStarted()) - app.SetAction(ProfileManager.GetPrimaryPad(), + app.SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_ReloadFont); return; } @@ -434,7 +434,7 @@ void UIController::SetupFont() { // Reload ui to set new font. if (m_eCurrentFont != eFont_NotLoaded) { - app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ReloadFont); + app.SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_ReloadFont); } else { updateCurrentFont(); } @@ -459,7 +459,7 @@ void UIController::tick() { ui.CleanUpSkinReload(); if (m_navigateToHomeOnReload || !g_NetworkManager.IsInSession()) { - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_MainMenu); } else { ui.CloseAllPlayersScenes(); @@ -737,7 +737,7 @@ void UIController::tickInput() { if (!m_bSystemUIShowing) { #if defined(ENABLE_IGGY_PERFMON) if (m_iggyPerfmonEnabled) { - if (PlatformInput.ButtonPressed(ProfileManager.GetPrimaryPad(), + if (PlatformInput.ButtonPressed(PlatformProfile.GetPrimaryPad(), ACTION_MENU_STICK_PRESS)) m_iggyPerfmonEnabled = !m_iggyPerfmonEnabled; } else @@ -848,29 +848,29 @@ void UIController::renderScenes() { pm_pad.bits = 0; pm_pad.field.dpad_up = PlatformInput.ButtonPressed( - ProfileManager.GetPrimaryPad(), ACTION_MENU_UP); + PlatformProfile.GetPrimaryPad(), ACTION_MENU_UP); pm_pad.field.dpad_down = PlatformInput.ButtonPressed( - ProfileManager.GetPrimaryPad(), ACTION_MENU_DOWN); + PlatformProfile.GetPrimaryPad(), ACTION_MENU_DOWN); pm_pad.field.dpad_left = PlatformInput.ButtonPressed( - ProfileManager.GetPrimaryPad(), ACTION_MENU_LEFT); + PlatformProfile.GetPrimaryPad(), ACTION_MENU_LEFT); pm_pad.field.dpad_right = PlatformInput.ButtonPressed( - ProfileManager.GetPrimaryPad(), ACTION_MENU_RIGHT); + PlatformProfile.GetPrimaryPad(), ACTION_MENU_RIGHT); pm_pad.field.button_up = PlatformInput.ButtonPressed( - ProfileManager.GetPrimaryPad(), ACTION_MENU_Y); + PlatformProfile.GetPrimaryPad(), ACTION_MENU_Y); pm_pad.field.button_down = PlatformInput.ButtonPressed( - ProfileManager.GetPrimaryPad(), ACTION_MENU_A); + PlatformProfile.GetPrimaryPad(), ACTION_MENU_A); pm_pad.field.button_left = PlatformInput.ButtonPressed( - ProfileManager.GetPrimaryPad(), ACTION_MENU_X); + PlatformProfile.GetPrimaryPad(), ACTION_MENU_X); pm_pad.field.button_right = PlatformInput.ButtonPressed( - ProfileManager.GetPrimaryPad(), ACTION_MENU_B); + PlatformProfile.GetPrimaryPad(), ACTION_MENU_B); pm_pad.field.shoulder_left_hi = PlatformInput.ButtonPressed( - ProfileManager.GetPrimaryPad(), ACTION_MENU_LEFT_SCROLL); + PlatformProfile.GetPrimaryPad(), ACTION_MENU_LEFT_SCROLL); pm_pad.field.shoulder_right_hi = PlatformInput.ButtonPressed( - ProfileManager.GetPrimaryPad(), ACTION_MENU_RIGHT_SCROLL); + PlatformProfile.GetPrimaryPad(), ACTION_MENU_RIGHT_SCROLL); pm_pad.field.trigger_left_low = PlatformInput.ButtonPressed( - ProfileManager.GetPrimaryPad(), ACTION_MENU_PAGEUP); + PlatformProfile.GetPrimaryPad(), ACTION_MENU_PAGEUP); pm_pad.field.trigger_right_low = PlatformInput.ButtonPressed( - ProfileManager.GetPrimaryPad(), ACTION_MENU_PAGEDOWN); + PlatformProfile.GetPrimaryPad(), ACTION_MENU_PAGEDOWN); // IggyPerfmonPadFromXInputStatePointer(pm_pad, &xi_pad); // gdraw_D3D_SetTileOrigin( fb, @@ -1195,7 +1195,7 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void* initData, // times if ((scene == eUIScene_LoadOrJoinMenu) && (bSeenUpdateTextThisSession == false) && - (app.GetGameSettings(ProfileManager.GetPrimaryPad(), + (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_DisplayUpdateMessage) != 0)) { scene = eUIScene_NewUpdateMessage; bSeenUpdateTextThisSession = true; @@ -1378,7 +1378,7 @@ void UIController::NavigateToHomeMenu() { if (pMinecraft->skins->needsUIUpdate()) { m_navigateToHomeOnReload = true; } else { - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_MainMenu); + ui.NavigateToScene(PlatformProfile.GetPrimaryPad(), eUIScene_MainMenu); #if defined(ENABLE_JAVA_GUIS) pMinecraft->setScreen(new TitleScreen()); #endif @@ -1482,7 +1482,7 @@ void UIController::CloseUIScenes(int iPad, bool forceIPad) { void UIController::setFullscreenMenuDisplayed(bool displayed) { // Show/hide the tooltips for the fullscreen group m_groups[(int)eUIGroup_Fullscreen]->showComponent( - ProfileManager.GetPrimaryPad(), eUIComponent_Tooltips, + PlatformProfile.GetPrimaryPad(), eUIComponent_Tooltips, eUILayer_Tooltips, displayed); // Show/hide tooltips for the other layers @@ -1777,7 +1777,7 @@ void UIController::PlayUISFX(ESoundEffect eSound) { void UIController::DisplayGamertag(unsigned int iPad, bool show) { // The host decides whether these are on or off - if (app.GetGameSettings(ProfileManager.GetPrimaryPad(), + if (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_DisplaySplitscreenGamertags) == 0) { show = false; } @@ -2234,7 +2234,7 @@ C4JStorage::EMessageResult UIController::RequestUGCMessageBox( } // Default pad to primary player - if (iPad == -1) iPad = ProfileManager.GetPrimaryPad(); + if (iPad == -1) iPad = PlatformProfile.GetPrimaryPad(); unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; @@ -2261,7 +2261,7 @@ C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox( } // Default pad to primary player - if (iPad == -1) iPad = ProfileManager.GetPrimaryPad(); + if (iPad == -1) iPad = PlatformProfile.GetPrimaryPad(); unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; diff --git a/targets/app/common/UI/UIGroup.cpp b/targets/app/common/UI/UIGroup.cpp index fb9fe99f7..e810f4e24 100644 --- a/targets/app/common/UI/UIGroup.cpp +++ b/targets/app/common/UI/UIGroup.cpp @@ -1,6 +1,6 @@ #include "UIGroup.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" @@ -84,7 +84,7 @@ void UIGroup::ReloadAll() { void UIGroup::tick() { // Ignore this group if the player isn't signed in - if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return; + if (m_iPad >= 0 && !PlatformProfile.IsSignedIn(m_iPad)) return; for (unsigned int i = 0; i < eUILayer_COUNT; ++i) { m_layers[i]->tick(); @@ -101,7 +101,7 @@ void UIGroup::tick() { void UIGroup::render() { // Ignore this group if the player isn't signed in - if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return; + if (m_iPad >= 0 && !PlatformProfile.IsSignedIn(m_iPad)) return; S32 width = 0; S32 height = 0; ui.getRenderDimensions(m_viewportType, width, height); @@ -117,7 +117,7 @@ void UIGroup::render() { bool UIGroup::hidesLowerScenes() { // Ignore this group if the player isn't signed in - if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return false; + if (m_iPad >= 0 && !PlatformProfile.IsSignedIn(m_iPad)) return false; bool hidesScenes = false; for (int i = eUILayer_COUNT - 1; i >= 0; --i) { hidesScenes = m_layers[i]->hidesLowerScenes(); @@ -203,7 +203,7 @@ bool UIGroup::HasFocus(int iPad) { void UIGroup::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled) { // Ignore this group if the player isn't signed in - if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return; + if (m_iPad >= 0 && !PlatformProfile.IsSignedIn(m_iPad)) return; for (unsigned int i = 0; i < eUILayer_COUNT; ++i) { m_layers[i]->handleInput(iPad, key, repeat, pressed, released, handled); if (handled) break; @@ -255,7 +255,7 @@ C4JRender::eViewportType UIGroup::GetViewportType() { return m_viewportType; } void UIGroup::HandleDLCMountingComplete() { // Ignore this group if the player isn't signed in - if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return; + if (m_iPad >= 0 && !PlatformProfile.IsSignedIn(m_iPad)) return; for (unsigned int i = 0; i < eUILayer_COUNT; ++i) { app.DebugPrintf("UIGroup::HandleDLCMountingComplete - m_layers[%d]\n", i); @@ -265,7 +265,7 @@ void UIGroup::HandleDLCMountingComplete() { void UIGroup::HandleDLCInstalled() { // Ignore this group if the player isn't signed in - if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return; + if (m_iPad >= 0 && !PlatformProfile.IsSignedIn(m_iPad)) return; for (unsigned int i = 0; i < eUILayer_COUNT; ++i) { m_layers[i]->HandleDLCInstalled(); } @@ -273,7 +273,7 @@ void UIGroup::HandleDLCInstalled() { void UIGroup::HandleMessage(EUIMessage message, void* data) { // Ignore this group if the player isn't signed in - if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return; + if (m_iPad >= 0 && !PlatformProfile.IsSignedIn(m_iPad)) return; for (unsigned int i = 0; i < eUILayer_COUNT; ++i) { m_layers[i]->HandleMessage(message, data); } diff --git a/targets/app/linux/LinuxGame.cpp b/targets/app/linux/LinuxGame.cpp index c2d5ba72b..5c970cbd7 100644 --- a/targets/app/linux/LinuxGame.cpp +++ b/targets/app/linux/LinuxGame.cpp @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" #include "minecraft/GameEnums.h" @@ -54,7 +54,7 @@ void LinuxGame::TemporaryCreateGameStart() { // From CScene_Main::RunPlayGame Minecraft* pMinecraft = Minecraft::GetInstance(); app.ReleaseSaveThumbnail(); - ProfileManager.SetLockedProfile(0); + PlatformProfile.SetLockedProfile(0); pMinecraft->user->name = L"Windows"; app.ApplyGameSettingsChanged(0); diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index fe6b4689c..e25e79b58 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -56,7 +56,7 @@ static void sigsegv_handler(int sig) { #include "platform/PlatformTypes.h" #include "platform/input/InputActions.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" #include "app/common/App_Defines.h" @@ -484,7 +484,7 @@ int main(int argc, const char* argv[]) { // Initialise the profile manager with the game Title ID, Offer ID, a // profile version number, and the number of profile values and settings - ProfileManager.Initialise( + PlatformProfile.Initialise( TITLEID_MINECRAFT, app.m_dwOfferID, PROFILE_VERSION_10, NUM_PROFILE_VALUES, NUM_PROFILE_SETTINGS, dwProfileSettingsA, app.GAME_DEFINED_PROFILE_DATA_BYTES * XUSER_MAX_COUNT, @@ -492,7 +492,7 @@ int main(int argc, const char* argv[]) { // set a function to be called when there's a sign in change, so we can exit // a level if the primary player signs out - ProfileManager.SetSignInChangeCallback( + PlatformProfile.SetSignInChangeCallback( [](bool bVal, unsigned int uiSignInData) { Game::SignInChangeCallback(&app, bVal, uiSignInData); }); @@ -503,13 +503,13 @@ int main(int argc, const char* argv[]) { // QNet needs to be setup after profile manager, as we do not want its // Notify listener to handle XN_SYS_SIGNINCHANGED notifications. This does - // mean that we need to have a callback in the ProfileManager for + // mean that we need to have a callback in the PlatformProfile for // XN_LIVE_INVITE_ACCEPTED for QNet. g_NetworkManager.Initialise(); // debug switch to trial version - ProfileManager.SetDebugFullOverride(true); + PlatformProfile.SetDebugFullOverride(true); // Initialise TLS for tesselator, for this main thread Tesselator::CreateNewThreadStorage(1024 * 1024); // Initialise TLS for AABB and Vec3 pools, for this main thread @@ -534,7 +534,7 @@ int main(int argc, const char* argv[]) { app.UpdateTime(); PlatformInput.Tick(); - ProfileManager.Tick(); + PlatformProfile.Tick(); StorageManager.Tick(); @@ -564,7 +564,7 @@ int main(int argc, const char* argv[]) { // // g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 && - ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad())); + ui.IsPauseMenuDisplayed(PlatformProfile.GetPrimaryPad())); } else { pMinecraft->soundEngine->tick(nullptr, 0.0f); pMinecraft->textures->tick(true, false); diff --git a/targets/app/windows/Windows64_App.cpp b/targets/app/windows/Windows64_App.cpp index 66375cb6c..515ea05f0 100644 --- a/targets/app/windows/Windows64_App.cpp +++ b/targets/app/windows/Windows64_App.cpp @@ -19,7 +19,7 @@ WindowsGame app; WindowsGame::WindowsGame() : Game() {} void WindowsGame::SetRichPresenceContext(int iPad, int contextId) { - ProfileManager.SetRichPresenceContextValue(iPad, CONTEXT_GAME_STATE, + PlatformProfile.SetRichPresenceContextValue(iPad, CONTEXT_GAME_STATE, contextId); } @@ -45,7 +45,7 @@ void WindowsGame::TemporaryCreateGameStart() { // From CScene_Main::RunPlayGame Minecraft* pMinecraft = Minecraft::GetInstance(); app.ReleaseSaveThumbnail(); - ProfileManager.SetLockedProfile(0); + PlatformProfile.SetLockedProfile(0); pMinecraft->user->name = L"Windows"; app.ApplyGameSettingsChanged(0); diff --git a/targets/app/windows/src/Windows64_Minecraft.cpp b/targets/app/windows/src/Windows64_Minecraft.cpp index 416ebef5e..703c40451 100644 --- a/targets/app/windows/src/Windows64_Minecraft.cpp +++ b/targets/app/windows/src/Windows64_Minecraft.cpp @@ -727,21 +727,21 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // Initialise the profile manager with the game Title ID, Offer ID, a // profile version number, and the number of profile values and settings - ProfileManager.Initialise( + PlatformProfile.Initialise( TITLEID_MINECRAFT, app.m_dwOfferID, PROFILE_VERSION_10, NUM_PROFILE_VALUES, NUM_PROFILE_SETTINGS, dwProfileSettingsA, app.GAME_DEFINED_PROFILE_DATA_BYTES * XUSER_MAX_COUNT, &app.uiGameDefinedDataChangedBitmask); // Set a callback for the default player options to be set - when there is // no profile data for the player - ProfileManager.SetDefaultOptionsCallback( - [](C_4JProfile::PROFILESETTINGS* pSettings, int iPad) { + PlatformProfile.SetDefaultOptionsCallback( + [](IPlatformProfile::PROFILESETTINGS* pSettings, int iPad) { return Game::DefaultOptionsCallback(&app, pSettings, iPad); }); // QNet needs to be setup after profile manager, as we do not want its // Notify listener to handle XN_SYS_SIGNINCHANGED notifications. This does - // mean that we need to have a callback in the ProfileManager for + // mean that we need to have a callback in the PlatformProfile for // XN_LIVE_INVITE_ACCEPTED for QNet. g_NetworkManager.Initialise(); @@ -749,7 +749,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // app.InitGameSettings(); // debug switch to trial version - ProfileManager.SetDebugFullOverride(true); + PlatformProfile.SetDebugFullOverride(true); // Initialise TLS for tesselator, for this main thread Tesselator::CreateNewThreadStorage(1024 * 1024); @@ -792,7 +792,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, app.UpdateTime(); PlatformInput.Tick(); - // ProfileManager.Tick(); + // PlatformProfile.Tick(); StorageManager.Tick(); @@ -813,7 +813,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, app.SetAppPaused( g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 && - ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad())); + ui.IsPauseMenuDisplayed(PlatformProfile.GetPrimaryPad())); } else { pMinecraft->soundEngine->tick(nullptr, 0.0f); pMinecraft->textures->tick(true, false); diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 675b2144c..e71d92634 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -14,7 +14,7 @@ #include #include "platform/input/InputActions.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" #include "minecraft/GameEnums.h" @@ -886,13 +886,13 @@ std::shared_ptr Minecraft::createExtraLocalPlayer( PlayerUID playerXUIDOffline = INVALID_XUID; PlayerUID playerXUIDOnline = INVALID_XUID; - ProfileManager.GetXUID(idx, &playerXUIDOffline, false); - ProfileManager.GetXUID(idx, &playerXUIDOnline, true); + PlatformProfile.GetXUID(idx, &playerXUIDOffline, false); + PlatformProfile.GetXUID(idx, &playerXUIDOnline, true); localplayers[idx]->setXuid(playerXUIDOffline); localplayers[idx]->setOnlineXuid(playerXUIDOnline); - localplayers[idx]->setIsGuest(ProfileManager.IsGuest(idx)); + localplayers[idx]->setIsGuest(PlatformProfile.IsGuest(idx)); - localplayers[idx]->m_displayName = ProfileManager.GetDisplayName(idx); + localplayers[idx]->m_displayName = PlatformProfile.GetDisplayName(idx); localplayers[idx]->m_iScreenSection = tempScreenSection; @@ -940,9 +940,9 @@ void Minecraft::storeExtraLocalPlayer(int idx) { if (localplayers[idx]->input != nullptr) delete localplayers[idx]->input; localplayers[idx]->input = new Input(); - if (ProfileManager.IsSignedIn(idx)) { + if (PlatformProfile.IsSignedIn(idx)) { localplayers[idx]->name = - convStringToWstring(ProfileManager.GetGamertag(idx)); + convStringToWstring(PlatformProfile.GetGamertag(idx)); } } @@ -1014,9 +1014,9 @@ void Minecraft::createPrimaryLocalPlayer(int iPad) { localplayers[iPad] = player; // gameRenderer->itemInHandRenderer = localitemInHandRenderers[iPad]; // Give them the gamertag if they're signed in - if (ProfileManager.IsSignedIn(PlatformInput.GetPrimaryPad())) { + if (PlatformProfile.IsSignedIn(PlatformInput.GetPrimaryPad())) { user->name = convStringToWstring( - ProfileManager.GetGamertag(PlatformInput.GetPrimaryPad())); + PlatformProfile.GetGamertag(PlatformInput.GetPrimaryPad())); } } @@ -1171,11 +1171,11 @@ void Minecraft::run_middle() { for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (localplayers[i] && (gameServices().getBanListCheck(i) == false) && !Minecraft::GetInstance()->isTutorial() && - ProfileManager.IsSignedInLive(i) && - !ProfileManager.IsGuest(i)) { + PlatformProfile.IsSignedInLive(i) && + !PlatformProfile.IsGuest(i)) { // If there is a sys ui displayed, we can't display the // message box here, so ignore until we can - if (!ProfileManager.IsSystemUIDisplayed()) { + if (!PlatformProfile.IsSystemUIDisplayed()) { gameServices().setBanListCheck(i, true); // 4J-PB - check if the level is in the banned level // list get the unique save name and xuid from @@ -1199,7 +1199,7 @@ void Minecraft::run_middle() { } } - if (!ProfileManager.IsSystemUIDisplayed() && + if (!PlatformProfile.IsSystemUIDisplayed() && gameServices().dlcInstallProcessCompleted() && !gameServices().dlcInstallPending() && gameServices().dlcNeedsCorruptCheck()) { @@ -1398,12 +1398,12 @@ void Minecraft::run_middle() { // Let them join // are they signed in? - if (ProfileManager.IsSignedIn(i)) { + if (PlatformProfile.IsSignedIn(i)) { // if this is a local game, then the // player just needs to be signed in if (g_NetworkManager.IsLocalGame() || - (ProfileManager.IsSignedInLive(i) && - ProfileManager + (PlatformProfile.IsSignedInLive(i) && + PlatformProfile .AllowedToPlayMultiplayer( i))) { if (level->isClientSide) { @@ -1415,7 +1415,7 @@ void Minecraft::run_middle() { "Bringing up the sign " "in " "ui\n"); - ProfileManager.RequestSignInUI( + PlatformProfile.RequestSignInUI( false, g_NetworkManager .IsLocalGame(), @@ -1436,7 +1436,7 @@ void Minecraft::run_middle() { createExtraLocalPlayer( i, (convStringToWstring( - ProfileManager + PlatformProfile .GetGamertag( i))) .c_str(), @@ -1446,13 +1446,13 @@ void Minecraft::run_middle() { } } } else { - if (ProfileManager.IsSignedInLive( - ProfileManager + if (PlatformProfile.IsSignedInLive( + PlatformProfile .GetPrimaryPad()) && - !ProfileManager + !PlatformProfile .AllowedToPlayMultiplayer( i)) { - ProfileManager + PlatformProfile .RequestConvertOfflineToGuestUI( [this](bool b, int p) { return InGame_SignInReturned( @@ -1470,7 +1470,7 @@ void Minecraft::run_middle() { // signs-in on console which // takes part in Xbox LIVE // multiplayer session. - // ProfileManager.RequestConvertOfflineToGuestUI( + // PlatformProfile.RequestConvertOfflineToGuestUI( // &Minecraft::InGame_SignInReturned, // this,i); @@ -1491,7 +1491,7 @@ void Minecraft::run_middle() { Log::info( "Bringing up the sign in " "ui\n"); - ProfileManager.RequestSignInUI( + PlatformProfile.RequestSignInUI( false, g_NetworkManager .IsLocalGame(), @@ -1507,7 +1507,7 @@ void Minecraft::run_middle() { // bring up the sign in dialog Log::info( "Bringing up the sign in ui\n"); - ProfileManager.RequestSignInUI( + PlatformProfile.RequestSignInUI( false, g_NetworkManager.IsLocalGame(), true, false, true, @@ -3690,11 +3690,11 @@ void Minecraft::forceStatsSave(int idx) { stats[idx]->save(idx, true); // 4J Gordon: If the player is signed in, save the leaderboards - if (ProfileManager.IsSignedInLive(idx)) { - int tempLockedProfile = ProfileManager.GetLockedProfile(); - ProfileManager.SetLockedProfile(idx); + if (PlatformProfile.IsSignedInLive(idx)) { + int tempLockedProfile = PlatformProfile.GetLockedProfile(); + PlatformProfile.SetLockedProfile(idx); stats[idx]->saveLeaderboards(); - ProfileManager.SetLockedProfile(tempLockedProfile); + PlatformProfile.SetLockedProfile(tempLockedProfile); } } @@ -3845,13 +3845,13 @@ void Minecraft::setLevel(MultiPlayerLevel* level, int message /*=-1*/, PlayerUID playerXUIDOffline = INVALID_XUID; PlayerUID playerXUIDOnline = INVALID_XUID; - ProfileManager.GetXUID(iPrimaryPlayer, &playerXUIDOffline, false); - ProfileManager.GetXUID(iPrimaryPlayer, &playerXUIDOnline, true); + PlatformProfile.GetXUID(iPrimaryPlayer, &playerXUIDOffline, false); + PlatformProfile.GetXUID(iPrimaryPlayer, &playerXUIDOnline, true); player->setXuid(playerXUIDOffline); player->setOnlineXuid(playerXUIDOnline); player->m_displayName = - ProfileManager.GetDisplayName(iPrimaryPlayer); + PlatformProfile.GetDisplayName(iPrimaryPlayer); player->resetPos(); gameMode->initPlayer(player); @@ -4012,13 +4012,13 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) { PlayerUID playerXUIDOffline = INVALID_XUID; PlayerUID playerXUIDOnline = INVALID_XUID; - ProfileManager.GetXUID(iTempPad, &playerXUIDOffline, false); - ProfileManager.GetXUID(iTempPad, &playerXUIDOnline, true); + PlatformProfile.GetXUID(iTempPad, &playerXUIDOffline, false); + PlatformProfile.GetXUID(iTempPad, &playerXUIDOnline, true); player->setXuid(playerXUIDOffline); player->setOnlineXuid(playerXUIDOnline); - player->setIsGuest(ProfileManager.IsGuest(iTempPad)); + player->setIsGuest(PlatformProfile.IsGuest(iTempPad)); - player->m_displayName = ProfileManager.GetDisplayName(iPad); + player->m_displayName = PlatformProfile.GetDisplayName(iPad); player->SetXboxPad(iTempPad); @@ -4471,7 +4471,7 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { pMinecraftClass->localplayers[iPad] == nullptr) { // It's possible that the player has not signed in - they can back out // or choose no for the converttoguest - if (ProfileManager.IsSignedIn(iPad)) { + if (PlatformProfile.IsSignedIn(iPad)) { if (!g_NetworkManager.SessionHasSpace()) { unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; @@ -4480,8 +4480,8 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { } // if this is a local game then profiles just need to be signed in else if (g_NetworkManager.IsLocalGame() || - (ProfileManager.IsSignedInLive(iPad) && - ProfileManager.AllowedToPlayMultiplayer(iPad))) { + (PlatformProfile.IsSignedInLive(iPad) && + PlatformProfile.AllowedToPlayMultiplayer(iPad))) { if (pMinecraftClass->level->isClientSide) { pMinecraftClass->addLocalPlayer(iPad); } else { @@ -4492,20 +4492,20 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { player = pMinecraftClass->createExtraLocalPlayer( iPad, (convStringToWstring( - ProfileManager.GetGamertag(iPad))) + PlatformProfile.GetGamertag(iPad))) .c_str(), iPad, pMinecraftClass->level->dimension->id); } } - } else if (ProfileManager.IsSignedInLive( + } else if (PlatformProfile.IsSignedInLive( PlatformInput.GetPrimaryPad()) && - !ProfileManager.AllowedToPlayMultiplayer(iPad)) { + !PlatformProfile.AllowedToPlayMultiplayer(iPad)) { // 4J Stu - Don't allow converting to guests as we don't allow // any guest sign-in while in the game Fix for #66516 - TCR // #124: MPS Guest Support ; #001: BAS Game Stability: TU8: The // game crashes when second Guest signs-in on console which // takes part in Xbox LIVE multiplayer session. - // ProfileManager.RequestConvertOfflineToGuestUI( + // PlatformProfile.RequestConvertOfflineToGuestUI( // &Minecraft::InGame_SignInReturned, pMinecraftClass,iPad); unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index dd6c0c685..7d2bcd549 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -3,7 +3,7 @@ #include "platform/input/InputActions.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "Button.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index d1b8a8405..dbf1416cc 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -14,7 +14,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" #include "app/common/ConsoleGameMode.h" @@ -272,7 +272,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { if (done) return; PlayerUID OnlineXuid; - ProfileManager.GetXUID(m_userIndex, &OnlineXuid, true); // online xuid + PlatformProfile.GetXUID(m_userIndex, &OnlineXuid, true); // online xuid MOJANG_DATA* pMojangData = nullptr; if (!g_NetworkManager.IsLocalGame()) { @@ -445,7 +445,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { dimensionLevel->difficulty = packet->difficulty; // 4J Added dimensionLevel->isClientSide = true; level = dimensionLevel; - // 4J Stu - At time of writing ProfileManager.GetGamertag() does not + // 4J Stu - At time of writing PlatformProfile.GetGamertag() does not // always return the correct name, if sign-ins are turned off while // the player signed in. Using the qnetPlayer instead. need to have // a level before create extra local player @@ -869,12 +869,12 @@ void ClientConnection::handleAddPlayer( // need to use the XUID here PlayerUID playerXUIDOnline = INVALID_XUID, playerXUIDOffline = INVALID_XUID; - ProfileManager.GetXUID(idx, &playerXUIDOnline, true); - ProfileManager.GetXUID(idx, &playerXUIDOffline, false); + PlatformProfile.GetXUID(idx, &playerXUIDOnline, true); + PlatformProfile.GetXUID(idx, &playerXUIDOffline, false); if ((playerXUIDOnline != INVALID_XUID && - ProfileManager.AreXUIDSEqual(playerXUIDOnline, packet->xuid)) || + PlatformProfile.AreXUIDSEqual(playerXUIDOnline, packet->xuid)) || (playerXUIDOffline != INVALID_XUID && - ProfileManager.AreXUIDSEqual(playerXUIDOffline, packet->xuid))) { + PlatformProfile.AreXUIDSEqual(playerXUIDOffline, packet->xuid))) { Log::info( "AddPlayerPacket received with XUID of local player\n"); return; @@ -2040,22 +2040,22 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { // need to use the XUID here PlayerUID offlineXUID = INVALID_XUID; PlayerUID onlineXUID = INVALID_XUID; - if (ProfileManager.IsSignedInLive(m_userIndex)) { + if (PlatformProfile.IsSignedInLive(m_userIndex)) { // Guest don't have an offline XUID as they cannot play offline, so // use their online one - ProfileManager.GetXUID(m_userIndex, &onlineXUID, true); + PlatformProfile.GetXUID(m_userIndex, &onlineXUID, true); } // On PS3, all non-signed in players (even guests) can get a useful // offlineXUID - if (!ProfileManager.IsGuest(m_userIndex)) { + if (!PlatformProfile.IsGuest(m_userIndex)) { // All other players we use their offline XUID so that they can play // the game offline - ProfileManager.GetXUID(m_userIndex, &offlineXUID, false); + PlatformProfile.GetXUID(m_userIndex, &offlineXUID, false); } bool allAllowed = false; bool friendsAllowed = false; - ProfileManager.AllowedPlayerCreatedContent( + PlatformProfile.AllowedPlayerCreatedContent( m_userIndex, true, &allAllowed, &friendsAllowed); fprintf(stderr, "[LOGIN] Sending LoginPacket: user=%ls netVer=%d userIdx=%d " @@ -2068,7 +2068,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { offlineXUID, onlineXUID, (!allAllowed && friendsAllowed), packet->m_ugcPlayersVersion, gameServices().getPlayerSkinId(m_userIndex), gameServices().getPlayerCapeId(m_userIndex), - ProfileManager.IsGuest(m_userIndex))); + PlatformProfile.IsGuest(m_userIndex))); fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n"); if (!g_NetworkManager.IsHost()) { diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index 9af0f11b3..8d71a91ff 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -30,7 +30,7 @@ // 4J Stu - Added for tutorial callbacks #include "platform/input/InputActions.h" #include "platform/input/input.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_structs.h" #include "app/common/Audio/SoundEngine.h" @@ -486,7 +486,7 @@ void LocalPlayer::aiStep() { // Check if the player is idle and the rich presence needs updated if (!m_bIsIdle && PlatformInput.GetIdleSeconds(m_iPad) > PLAYER_IDLE_TIME) { - ProfileManager.SetCurrentGameActivity(m_iPad, CONTEXT_PRESENCE_IDLE, + PlatformProfile.SetCurrentGameActivity(m_iPad, CONTEXT_PRESENCE_IDLE, false); m_bIsIdle = true; } else if (m_bIsIdle && @@ -495,18 +495,18 @@ void LocalPlayer::aiStep() { if (g_NetworkManager.GetPlayerCount() > 1) { // only do it for this player here - each player will run this code if (g_NetworkManager.IsLocalGame()) { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( m_iPad, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); } else { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( m_iPad, CONTEXT_PRESENCE_MULTIPLAYER, false); } } else { if (g_NetworkManager.IsLocalGame()) { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( m_iPad, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, false); } else { - ProfileManager.SetCurrentGameActivity( + PlatformProfile.SetCurrentGameActivity( m_iPad, CONTEXT_PRESENCE_MULTIPLAYER_1P, false); } } @@ -845,14 +845,14 @@ void LocalPlayer::awardStat(Stat* stat, const std::vector& param) { // achievements don't get awarded to all players e.g. Splitscreen // players cannot get theme/avatar/gamerpic and Trial players cannot // get any This causes some extreme flooding of some awards - if (ProfileManager.CanBeAwarded(m_iPad, ach->getAchievementID())) { + if (PlatformProfile.CanBeAwarded(m_iPad, ach->getAchievementID())) { // 4J Stu - Some awards cause a menu to popup. This can be bad, // especially if you are surrounded by mobs! We cannot pause the // game unless in offline single player, but lets at least do it // then if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 && - ProfileManager.GetAwardType(ach->getAchievementID()) != + PlatformProfile.GetAwardType(ach->getAchievementID()) != EAwardType::Achievement) { ui.CloseUIScenes(m_iPad); ui.NavigateToScene(m_iPad, eUIScene_PauseMenu); @@ -863,7 +863,7 @@ void LocalPlayer::awardStat(Stat* stat, const std::vector& param) { unsigned long long achBit = ((unsigned long long)1) << ach->getAchievementID(); if (!(achBit & m_awardedThisSession)) { - ProfileManager.Award(m_iPad, ach->getAchievementID()); + PlatformProfile.Award(m_iPad, ach->getAchievementID()); m_awardedThisSession |= achBit; } } diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index 372a89f1b..3a3120121 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -13,7 +13,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "platform/sdl2/Storage.h" #include "ConsoleInput.h" #include "DispenserBootstrap.h" @@ -903,7 +903,7 @@ void MinecraftServer::stopServer(bool didInit) { // also need to check for a profile switch here - primary player signs out, // and another player signs in before dismissing the dash if ((m_bPrimaryPlayerSignedOut == false) && - ProfileManager.IsSignedIn(PlatformInput.GetPrimaryPad())) { + PlatformProfile.IsSignedIn(PlatformInput.GetPrimaryPad())) { // if trial version or saving is disabled, then don't save anything. // Also don't save anything if we didn't actually get through the server // initialisation. diff --git a/targets/minecraft/server/MinecraftServer.h b/targets/minecraft/server/MinecraftServer.h index 6d9836c48..7a1c56cb0 100644 --- a/targets/minecraft/server/MinecraftServer.h +++ b/targets/minecraft/server/MinecraftServer.h @@ -239,7 +239,7 @@ private: m_bPrimaryPlayerSignedOut; // 4J-PB added to tell the stopserver not to // save the game - another player may have // signed in in their place, so - // ProfileManager.IsSignedIn isn't enough + // PlatformProfile.IsSignedIn isn't enough static bool s_bServerHalted; // 4J Stu Added so that we can halt the server // even before it's been created properly static bool s_bSaveOnExitAnswered; // 4J Stu Added so that we only ask this diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index 21c45548d..11b3faa7e 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -10,7 +10,7 @@ #include #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" @@ -1083,7 +1083,7 @@ void PlayerList::tick() { std::shared_ptr p = players.at(i); PlayerUID playersXuid = p->getOnlineXuid(); if (p != nullptr && - ProfileManager.AreXUIDSEqual(playersXuid, xuid)) { + PlatformProfile.AreXUIDSEqual(playersXuid, xuid)) { player = p; break; } @@ -1690,7 +1690,7 @@ bool PlayerList::isXuidBanned(PlayerUID xuid) { bool banned = false; for (auto it = m_bannedXuids.begin(); it != m_bannedXuids.end(); ++it) { - if (ProfileManager.AreXUIDSEqual(xuid, *it)) { + if (PlatformProfile.AreXUIDSEqual(xuid, *it)) { banned = true; break; } diff --git a/targets/minecraft/stats/StatsCounter.cpp b/targets/minecraft/stats/StatsCounter.cpp index cc353da2e..7b5600d29 100644 --- a/targets/minecraft/stats/StatsCounter.cpp +++ b/targets/minecraft/stats/StatsCounter.cpp @@ -10,7 +10,7 @@ #include #include -#include "platform/sdl2/Profile.h" +#include "platform/profile/profile.h" #include "app/common/App_structs.h" #include "app/common/Leaderboards/LeaderboardManager.h" #include "app/linux/LinuxGame.h" @@ -191,7 +191,7 @@ void StatsCounter::save(int player, bool force) { // Retrieve the data pointer from the profile std::uint8_t* pbData = reinterpret_cast( - ProfileManager.GetGameDefinedProfileData(player)); + PlatformProfile.GetGameDefinedProfileData(player)); pbData += sizeof(GAME_SETTINGS); // Pointer to current position in stat array @@ -285,7 +285,7 @@ void StatsCounter::writeStats() { // unsigned int locale = XGetLocale(); int viewCount = 0; - int iPad = ProfileManager.GetLockedProfile(); + int iPad = PlatformProfile.GetLockedProfile(); } void StatsCounter::setupStatBoards() { diff --git a/targets/platform/PlatformServices.cpp b/targets/platform/PlatformServices.cpp index 675b4e931..cde97296c 100644 --- a/targets/platform/PlatformServices.cpp +++ b/targets/platform/PlatformServices.cpp @@ -8,6 +8,6 @@ static StdFileIO s_stdFileIO; IPlatformFileIO& PlatformFileIO = s_stdFileIO; -IPlatformProfile& PlatformProfile = ProfileManager; +IPlatformProfile& PlatformProfile = PlatformProfile; IPlatformRenderer& PlatformRender = RenderManager; IPlatformStorage& PlatformStorage = StorageManager; diff --git a/targets/platform/PlatformServices.h b/targets/platform/PlatformServices.h index 4343ecb7f..2fe965439 100644 --- a/targets/platform/PlatformServices.h +++ b/targets/platform/PlatformServices.h @@ -3,7 +3,6 @@ #include "IPlatformFileIO.h" #include "IPlatformLeaderboard.h" #include "IPlatformNetwork.h" -#include "IPlatformProfile.h" #include "IPlatformRenderer.h" #include "IPlatformStorage.h" @@ -12,6 +11,5 @@ // by the app layer at startup. extern IPlatformFileIO& PlatformFileIO; -extern IPlatformProfile& PlatformProfile; extern IPlatformRenderer& PlatformRender; extern IPlatformStorage& PlatformStorage; diff --git a/targets/platform/meson.build b/targets/platform/meson.build index c5c5287c3..883c80490 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -26,7 +26,7 @@ endif sdl2_sources = files( 'input/sdl2/SDL2Input.cpp', - 'sdl2/Profile.cpp', + 'profile/stub/StubProfile.cpp', 'sdl2/Render.cpp', 'sdl2/render_stubs.cpp', 'sdl2/Storage.cpp', diff --git a/targets/platform/IPlatformProfile.h b/targets/platform/profile/IPlatformProfile.h similarity index 87% rename from targets/platform/IPlatformProfile.h rename to targets/platform/profile/IPlatformProfile.h index 2ccb634df..65f35bc3d 100644 --- a/targets/platform/IPlatformProfile.h +++ b/targets/platform/profile/IPlatformProfile.h @@ -4,11 +4,35 @@ #include #include -#include "PlatformTypes.h" #include "PlatformTypes.h" class CXuiStringTable; +#define TITLEID_MINECRAFT 0x584111F7 + +#define CONTEXT_GAME_STATE 0 +#define CONTEXT_GAME_STATE_BLANK 0 +#define CONTEXT_GAME_STATE_RIDING_PIG 1 +#define CONTEXT_GAME_STATE_RIDING_MINECART 2 +#define CONTEXT_GAME_STATE_BOATING 3 +#define CONTEXT_GAME_STATE_FISHING 4 +#define CONTEXT_GAME_STATE_CRAFTING 5 +#define CONTEXT_GAME_STATE_FORGING 6 +#define CONTEXT_GAME_STATE_NETHER 7 +#define CONTEXT_GAME_STATE_CD 8 +#define CONTEXT_GAME_STATE_MAP 9 +#define CONTEXT_GAME_STATE_ENCHANTING 5 +#define CONTEXT_GAME_STATE_BREWING 5 +#define CONTEXT_GAME_STATE_ANVIL 6 +#define CONTEXT_GAME_STATE_TRADING 0 + +#define CONTEXT_PRESENCE_IDLE 0 +#define CONTEXT_PRESENCE_MENUS 1 +#define CONTEXT_PRESENCE_MULTIPLAYER 2 +#define CONTEXT_PRESENCE_MULTIPLAYEROFFLINE 3 +#define CONTEXT_PRESENCE_MULTIPLAYER_1P 4 +#define CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE 5 + class IPlatformProfile { public: struct PROFILESETTINGS { diff --git a/targets/platform/ProfileConstants.h b/targets/platform/profile/ProfileConstants.h similarity index 100% rename from targets/platform/ProfileConstants.h rename to targets/platform/profile/ProfileConstants.h diff --git a/targets/platform/profile/profile.h b/targets/platform/profile/profile.h new file mode 100644 index 000000000..1b8c70631 --- /dev/null +++ b/targets/platform/profile/profile.h @@ -0,0 +1,3 @@ +#include "IPlatformProfile.h" + +extern IPlatformProfile& PlatformProfile; diff --git a/targets/platform/sdl2/Profile.cpp b/targets/platform/profile/stub/StubProfile.cpp similarity index 78% rename from targets/platform/sdl2/Profile.cpp rename to targets/platform/profile/stub/StubProfile.cpp index 8802da8d8..a851a7f1b 100644 --- a/targets/platform/sdl2/Profile.cpp +++ b/targets/platform/profile/stub/StubProfile.cpp @@ -1,4 +1,4 @@ -#include "Profile.h" +#include "StubProfile.h" #include #include @@ -7,7 +7,8 @@ #include "../ProfileConstants.h" #include "input/input.h" -C_4JProfile ProfileManager; +StubProfile stub_profile_instance; +IPlatformProfile& PlatformProfile = stub_profile_instance; namespace { constexpr PlayerUID kFakeXuidBase = 0xe000d45248242f2eULL; @@ -46,11 +47,11 @@ static_assert(sizeof(ProfileGameSettings) == 204, "ProfileGameSettings must match GAME_SETTINGS profile storage"); void* s_profileData[XUSER_MAX_COUNT] = {}; -C_4JProfile::PROFILESETTINGS s_dashboardSettings[XUSER_MAX_COUNT] = {}; +IPlatformProfile::PROFILESETTINGS s_dashboardSettings[XUSER_MAX_COUNT] = {}; char s_gamertags[XUSER_MAX_COUNT][16] = {}; std::wstring s_displayNames[XUSER_MAX_COUNT]; int s_lockedProfile = 0; -std::function +std::function s_defaultOptionsCallback; bool isValidPad(int iPad) { return iPad >= 0 && iPad < XUSER_MAX_COUNT; } @@ -103,7 +104,7 @@ void initialiseDefaultGameSettings(ProfileGameSettings* gameSettings) { } } // namespace -void C_4JProfile::Initialise(std::uint32_t, std::uint32_t, unsigned short, +void StubProfile::Initialise(std::uint32_t, std::uint32_t, unsigned short, unsigned int, unsigned int, std::uint32_t*, int iGameDefinedDataSizeX4, unsigned int*) { s_lockedProfile = 0; @@ -119,27 +120,27 @@ void C_4JProfile::Initialise(std::uint32_t, std::uint32_t, unsigned short, } } -int C_4JProfile::GetLockedProfile() { return s_lockedProfile; } -void C_4JProfile::SetLockedProfile(int iProf) { s_lockedProfile = iProf; } -bool C_4JProfile::IsSignedIn(int iQuadrant) { return iQuadrant == 0; } -bool C_4JProfile::IsSignedInLive(int iProf) { return IsSignedIn(iProf); } -bool C_4JProfile::IsGuest(int) { return false; } -bool C_4JProfile::QuerySigninStatus() { return true; } +int StubProfile::GetLockedProfile() { return s_lockedProfile; } +void StubProfile::SetLockedProfile(int iProf) { s_lockedProfile = iProf; } +bool StubProfile::IsSignedIn(int iQuadrant) { return iQuadrant == 0; } +bool StubProfile::IsSignedInLive(int iProf) { return IsSignedIn(iProf); } +bool StubProfile::IsGuest(int) { return false; } +bool StubProfile::QuerySigninStatus() { return true; } -void C_4JProfile::GetXUID(int iPad, PlayerUID* pXuid, bool) { +void StubProfile::GetXUID(int iPad, PlayerUID* pXuid, bool) { if (pXuid) *pXuid = kFakeXuidBase + static_cast(isValidPad(iPad) ? iPad : 0); } -bool C_4JProfile::AreXUIDSEqual(PlayerUID xuid1, PlayerUID xuid2) { +bool StubProfile::AreXUIDSEqual(PlayerUID xuid1, PlayerUID xuid2) { return xuid1 == xuid2; } -bool C_4JProfile::XUIDIsGuest(PlayerUID) { return false; } -bool C_4JProfile::AllowedToPlayMultiplayer(int) { return true; } +bool StubProfile::XUIDIsGuest(PlayerUID) { return false; } +bool StubProfile::AllowedToPlayMultiplayer(int) { return true; } -bool C_4JProfile::GetChatAndContentRestrictions(int, bool* pbChatRestricted, +bool StubProfile::GetChatAndContentRestrictions(int, bool* pbChatRestricted, bool* pbContentRestricted, int* piAge) { if (pbChatRestricted) *pbChatRestricted = false; @@ -148,50 +149,50 @@ bool C_4JProfile::GetChatAndContentRestrictions(int, bool* pbChatRestricted, return true; } -char* C_4JProfile::GetGamertag(int iPad) { +char* StubProfile::GetGamertag(int iPad) { const int p = isValidPad(iPad) ? iPad : 0; ensureFakeIdentity(p); return s_gamertags[p]; } -std::wstring C_4JProfile::GetDisplayName(int iPad) { +std::wstring StubProfile::GetDisplayName(int iPad) { const int p = isValidPad(iPad) ? iPad : 0; ensureFakeIdentity(p); return s_displayNames[p]; } -int C_4JProfile::SetDefaultOptionsCallback( +int StubProfile::SetDefaultOptionsCallback( std::function callback) { s_defaultOptionsCallback = std::move(callback); return 0; } -C_4JProfile::PROFILESETTINGS* C_4JProfile::GetDashboardProfileSettings( +IPlatformProfile::PROFILESETTINGS* StubProfile::GetDashboardProfileSettings( int iPad) { return &s_dashboardSettings[isValidPad(iPad) ? iPad : 0]; } -void* C_4JProfile::GetGameDefinedProfileData(int iQuadrant) { +void* StubProfile::GetGameDefinedProfileData(int iQuadrant) { return isValidPad(iQuadrant) ? s_profileData[iQuadrant] : nullptr; } -void C_4JProfile::AllowedPlayerCreatedContent(int, bool, bool* allAllowed, +void StubProfile::AllowedPlayerCreatedContent(int, bool, bool* allAllowed, bool* friendsAllowed) { if (allAllowed) *allAllowed = true; if (friendsAllowed) *friendsAllowed = true; } -bool C_4JProfile::CanViewPlayerCreatedContent(int, bool, PlayerUID*, +bool StubProfile::CanViewPlayerCreatedContent(int, bool, PlayerUID*, unsigned int) { return true; } // GetPrimaryPad/SetPrimaryPad — delegates to PlatformPlatft. -// Kept here temporarily for call sites that still use ProfileManager. +// Kept here temporarily for call sites that still use PlatformPlatfore. // These forward to the canonical copies in SDL2Input. -int C_4JProfile::GetPrimaryPad() { +int StubProfile::GetPrimaryPad() { return PlatformInput.GetPrimaryPad(); } -void C_4JProfile::SetPrimaryPad(int iPad) { +void StubProfile::SetPrimaryPad(int iPad) { PlatformInput.SetPrimaryPad(iPad); } diff --git a/targets/platform/sdl2/Profile.h b/targets/platform/profile/stub/StubProfile.h similarity index 81% rename from targets/platform/sdl2/Profile.h rename to targets/platform/profile/stub/StubProfile.h index 654b18687..43601b0fb 100644 --- a/targets/platform/sdl2/Profile.h +++ b/targets/platform/profile/stub/StubProfile.h @@ -8,32 +8,7 @@ #include "../IPlatformProfile.h" #include "../PlatformTypes.h" -#define TITLEID_MINECRAFT 0x584111F7 - -#define CONTEXT_GAME_STATE 0 -#define CONTEXT_GAME_STATE_BLANK 0 -#define CONTEXT_GAME_STATE_RIDING_PIG 1 -#define CONTEXT_GAME_STATE_RIDING_MINECART 2 -#define CONTEXT_GAME_STATE_BOATING 3 -#define CONTEXT_GAME_STATE_FISHING 4 -#define CONTEXT_GAME_STATE_CRAFTING 5 -#define CONTEXT_GAME_STATE_FORGING 6 -#define CONTEXT_GAME_STATE_NETHER 7 -#define CONTEXT_GAME_STATE_CD 8 -#define CONTEXT_GAME_STATE_MAP 9 -#define CONTEXT_GAME_STATE_ENCHANTING 5 -#define CONTEXT_GAME_STATE_BREWING 5 -#define CONTEXT_GAME_STATE_ANVIL 6 -#define CONTEXT_GAME_STATE_TRADING 0 - -#define CONTEXT_PRESENCE_IDLE 0 -#define CONTEXT_PRESENCE_MENUS 1 -#define CONTEXT_PRESENCE_MULTIPLAYER 2 -#define CONTEXT_PRESENCE_MULTIPLAYEROFFLINE 3 -#define CONTEXT_PRESENCE_MULTIPLAYER_1P 4 -#define CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE 5 - -class C_4JProfile : public IPlatformProfile { +class StubProfile : public IPlatformProfile { public: // --- Methods with real logic (implemented in .cpp) --- @@ -123,6 +98,3 @@ public: int GetPrimaryPad(); void SetPrimaryPad(int iPad); }; - -// Singleton -extern C_4JProfile ProfileManager;