From a3a21557f83f755a8019b9eeca3da1409ff784a8 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 12:12:42 -0500 Subject: [PATCH 01/15] split out platform/input to its own folder --- targets/app/common/Game.cpp | 14 +- targets/app/common/GameSettingsManager.cpp | 28 +- targets/app/common/Game_XuiActions.cpp | 2 +- targets/app/common/LocalizationManager.cpp | 8 +- .../app/common/Network/GameNetworkManager.cpp | 4 +- targets/app/common/NetworkController.cpp | 4 +- .../Tutorial/Constraints/InputConstraint.cpp | 10 +- targets/app/common/Tutorial/FullTutorial.cpp | 2 +- .../app/common/Tutorial/Tasks/ChoiceTask.cpp | 6 +- .../common/Tutorial/Tasks/ControllerTask.cpp | 6 +- .../app/common/Tutorial/Tasks/InfoTask.cpp | 4 +- targets/app/common/Tutorial/Tutorial.cpp | 2 +- .../IUIScene_AbstractContainerMenu.cpp | 8 +- .../All Platforms/IUIScene_CraftingMenu.cpp | 2 +- .../All Platforms/IUIScene_CreativeMenu.cpp | 2 +- .../UI/All Platforms/IUIScene_TradingMenu.cpp | 2 +- .../UI/Components/UIComponent_Tooltips.h | 2 +- .../Debug/UIScene_DebugCreateSchematic.cpp | 10 +- .../UI/Scenes/Debug/UIScene_DebugOptions.cpp | 2 +- .../UI/Scenes/Debug/UIScene_DebugOverlay.cpp | 2 +- .../Scenes/Debug/UIScene_DebugSetCamera.cpp | 10 +- .../UIScene_CreateWorldMenu.cpp | 14 +- .../UIScene_DLCMainMenu.cpp | 2 +- .../UIScene_DLCOffersMenu.cpp | 2 +- .../Frontend Menu screens/UIScene_EULA.cpp | 6 +- .../Frontend Menu screens/UIScene_Intro.cpp | 2 +- .../UIScene_JoinMenu.cpp | 2 +- .../UIScene_LaunchMoreOptionsMenu.cpp | 10 +- .../UIScene_LeaderboardsMenu.cpp | 2 +- .../UIScene_LoadMenu.cpp | 2 +- .../UIScene_LoadOrJoinMenu.cpp | 10 +- .../UIScene_MainMenu.cpp | 2 +- .../UIScene_NewUpdateMessage.cpp | 2 +- .../UIScene_SaveMessage.cpp | 6 +- .../UIScene_TrialExitUpsell.cpp | 2 +- .../Help & Options/UIScene_ControlsMenu.cpp | 6 +- .../Scenes/Help & Options/UIScene_Credits.cpp | 2 +- .../UIScene_HelpAndOptionsMenu.cpp | 2 +- .../Help & Options/UIScene_HowToPlay.cpp | 2 +- .../Help & Options/UIScene_HowToPlayMenu.cpp | 2 +- .../UIScene_LanguageSelector.cpp | 2 +- .../Help & Options/UIScene_ReinstallMenu.cpp | 2 +- .../UIScene_SettingsAudioMenu.cpp | 2 +- .../UIScene_SettingsControlMenu.cpp | 2 +- .../UIScene_SettingsGraphicsMenu.cpp | 2 +- .../Help & Options/UIScene_SettingsMenu.cpp | 2 +- .../UIScene_SettingsOptionsMenu.cpp | 2 +- .../Help & Options/UIScene_SettingsUIMenu.cpp | 2 +- .../Help & Options/UIScene_SkinSelectMenu.cpp | 2 +- .../UIScene_AbstractContainerMenu.cpp | 2 +- .../Containers/UIScene_AnvilMenu.cpp | 8 +- .../Containers/UIScene_AnvilMenu.h | 2 +- .../Containers/UIScene_TradingMenu.cpp | 2 +- .../UIScene_CraftingMenu.cpp | 2 +- .../UIScene_DeathMenu.cpp | 2 +- .../In-Game Menu Screens/UIScene_EndPoem.cpp | 2 +- .../UIScene_InGameHostOptionsMenu.cpp | 2 +- .../UIScene_InGameInfoMenu.cpp | 2 +- .../UIScene_InGamePlayerOptionsMenu.cpp | 2 +- .../UIScene_PauseMenu.cpp | 2 +- .../UIScene_SignEntryMenu.cpp | 14 +- .../UIScene_TeleportMenu.cpp | 2 +- .../UI/Scenes/UIScene_ConnectingProgress.cpp | 2 +- .../UI/Scenes/UIScene_FullscreenProgress.cpp | 2 +- .../app/common/UI/Scenes/UIScene_Keyboard.cpp | 2 +- .../common/UI/Scenes/UIScene_MessageBox.cpp | 2 +- .../UI/Scenes/UIScene_QuadrantSignin.cpp | 10 +- targets/app/common/UI/UIController.cpp | 40 +-- targets/app/common/UI/UIController.h | 2 +- targets/app/common/UI/UIScene.cpp | 2 +- targets/app/linux/Linux_Minecraft.cpp | 282 +++++++++--------- .../app/windows/src/Windows64_Minecraft.cpp | 278 ++++++++--------- targets/minecraft/client/Minecraft.cpp | 150 +++++----- targets/minecraft/client/gui/Gui.cpp | 4 +- targets/minecraft/client/gui/PauseScreen.cpp | 6 +- targets/minecraft/client/gui/Screen.cpp | 14 +- .../gui/inventory/CreativeInventoryScreen.cpp | 8 +- .../client/multiplayer/ClientConnection.cpp | 40 +-- .../multiplayer/MultiPlayerGameMode.cpp | 2 +- .../client/multiplayer/MultiPlayerLevel.cpp | 4 +- .../multiplayer/MultiPlayerLocalPlayer.cpp | 2 +- targets/minecraft/client/player/Input.cpp | 16 +- .../minecraft/client/player/LocalPlayer.cpp | 10 +- .../client/renderer/GameRenderer.cpp | 10 +- .../client/renderer/LevelRenderer.cpp | 14 +- .../minecraft/client/skins/DLCTexturePack.cpp | 10 +- .../client/skins/TexturePackRepository.cpp | 6 +- targets/minecraft/server/MinecraftServer.cpp | 6 +- .../minecraft/server/level/ServerLevel.cpp | 4 +- .../minecraft/server/level/ServerPlayer.cpp | 20 +- .../minecraft/world/entity/animal/Ocelot.cpp | 2 +- targets/minecraft/world/level/Level.cpp | 2 +- .../world/level/biome/BiomeSource.cpp | 2 +- .../chunk/storage/McRegionChunkStorage.cpp | 2 +- .../level/chunk/storage/OldChunkStorage.cpp | 2 +- .../world/level/dimension/Dimension.cpp | 2 +- .../world/level/dimension/HellDimension.cpp | 2 +- .../world/level/newbiome/layer/Layer.cpp | 2 +- .../level/storage/DirectoryLevelStorage.cpp | 2 +- .../world/level/tile/entity/SignTileEntity.h | 1 - targets/platform/Platform.h | 2 +- targets/platform/PlatformServices.cpp | 2 - targets/platform/PlatformServices.h | 2 - targets/platform/{ => input}/IPlatformInput.h | 45 +++ targets/platform/{ => input}/InputActions.h | 0 targets/platform/input/input.h | 3 + .../Input.cpp => input/sdl2/SDL2Input.cpp} | 81 ++--- .../{sdl2/Input.h => input/sdl2/SDL2Input.h} | 52 +--- targets/platform/meson.build | 2 +- targets/platform/sdl2/Profile.cpp | 12 +- 110 files changed, 716 insertions(+), 722 deletions(-) rename targets/platform/{ => input}/IPlatformInput.h (76%) rename targets/platform/{ => input}/InputActions.h (100%) create mode 100644 targets/platform/input/input.h rename targets/platform/{sdl2/Input.cpp => input/sdl2/SDL2Input.cpp} (92%) rename targets/platform/{sdl2/Input.h => input/sdl2/SDL2Input.h} (73%) diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index eca6a2359..5f1446e92 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -2,7 +2,7 @@ #include "app/common/Game.h" #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" @@ -74,7 +74,7 @@ #include #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Colours/ColourTable.h" #include "app/common/DLC/DLCPack.h" @@ -258,7 +258,7 @@ bool Game::DebugArtToolsOn() { #endif void Game::SetDebugSequence(const char* pchSeq) { - InputManager.SetDebugSequence(pchSeq, [this]() -> int { + PlatformInput.SetDebugSequence(pchSeq, [this]() -> int { // printf("sequence matched\n"); m_debugOptions.setDebugOptions(!m_debugOptions.settingsOn()); @@ -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 (InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) + if (PlatformInput.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) ++connectedControllers; } @@ -635,8 +635,8 @@ bool Game::IsLocalMultiplayerAvailable() { // Found this in GameNetworkManager? // #ifdef 0 // iOtherConnectedControllers = - // InputManager.GetConnectedGamepadCount(); - // if((InputManager.IsPadConnected(userIndex) || + // PlatformInput.GetConnectedGamepadCount(); + // if((PlatformInput.IsPadConnected(userIndex) || // ProfileManager.IsSignedIn(userIndex))) // { // --iOtherConnectedControllers; @@ -644,7 +644,7 @@ bool Game::IsLocalMultiplayerAvailable() { // #else // for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) // { - // if( (i!=userIndex) && (InputManager.IsPadConnected(i) || + // if( (i!=userIndex) && (PlatformInput.IsPadConnected(i) || // ProfileManager.IsSignedIn(i)) ) // { // iOtherConnectedControllers++; diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index c79bcbf14..769d903a5 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -20,7 +20,7 @@ #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/tile/Tile.h" -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" #include "app/common/Audio/SoundEngine.h" @@ -301,37 +301,37 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { case eGameSetting_ViewBob: break; case eGameSetting_ControlScheme: - InputManager.SetJoypadMapVal( + PlatformInput.SetJoypadMapVal( iPad, (GameSettingsA[iPad]->usBitmaskValues & 0x30) >> 4); break; case eGameSetting_ControlInvertLook: break; case eGameSetting_ControlSouthPaw: if (GameSettingsA[iPad]->usBitmaskValues & 0x80) { - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, + PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, AXIS_MAP_RX); - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, + PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, AXIS_MAP_RY); - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, + PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, AXIS_MAP_LX); - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, + PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, AXIS_MAP_LY); - InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, + PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, TRIGGER_MAP_1); - InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, + PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, TRIGGER_MAP_0); } else { - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, + PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, AXIS_MAP_LX); - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, + PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, AXIS_MAP_LY); - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, + PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, AXIS_MAP_RX); - InputManager.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, + PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, AXIS_MAP_RY); - InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, + PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, TRIGGER_MAP_0); - InputManager.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, + PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, TRIGGER_MAP_1); } break; diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index c68b6f445..0517349bc 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -430,7 +430,7 @@ void Game::HandleXuiActions(void) { // 4J-PB - cancel any possible std::string verifications // queued with LIVE - // InputManager.CancelAllVerifyInProgress(); + // PlatformInput.CancelAllVerifyInProgress(); // In a split screen, only the primary player actually // quits the game, others just remove their players diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index 3937fce4a..cb5244516 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -16,8 +16,8 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Render.h" #include "platform/XboxStubs.h" #include "strings.h" @@ -348,8 +348,8 @@ std::wstring LocalizationManager::formatHTMLString( std::wstring LocalizationManager::getActionReplacement( int iPad, unsigned char ucAction) { - unsigned int input = InputManager.GetGameJoypadMaps( - InputManager.GetJoypadMapVal(iPad), ucAction); + unsigned int input = PlatformInput.GetGameJoypadMaps( + PlatformInput.GetJoypadMapVal(iPad), ucAction); std::wstring replacement = L""; diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index e7ad30899..97cb21b6a 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -9,7 +9,7 @@ #include #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" @@ -1506,7 +1506,7 @@ void CGameNetworkManager::ServerStoppedWait() { // Tick some simple things ProfileManager.Tick(); StorageManager.Tick(); - InputManager.Tick(); + PlatformInput.Tick(); RenderManager.Tick(); ui.tick(); ui.render(); diff --git a/targets/app/common/NetworkController.cpp b/targets/app/common/NetworkController.cpp index d66ff0057..3189229b6 100644 --- a/targets/app/common/NetworkController.cpp +++ b/targets/app/common/NetworkController.cpp @@ -17,7 +17,7 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Storage.h" #include "app/common/Audio/SoundEngine.h" @@ -384,7 +384,7 @@ void NetworkController::notificationsCallback(void* pParam, case XN_SYS_INPUTDEVICESCHANGED: if (app.GetGameStarted() && g_NetworkManager.IsInSession()) { for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (!InputManager.IsPadConnected(i) && + if (!PlatformInput.IsPadConnected(i) && Minecraft::GetInstance()->localplayers[i] != nullptr && !ui.IsPauseMenuDisplayed(i) && !ui.IsSceneInStack(i, eUIScene_EndPoem)) { diff --git a/targets/app/common/Tutorial/Constraints/InputConstraint.cpp b/targets/app/common/Tutorial/Constraints/InputConstraint.cpp index e09a1a667..fd63b22d7 100644 --- a/targets/app/common/Tutorial/Constraints/InputConstraint.cpp +++ b/targets/app/common/Tutorial/Constraints/InputConstraint.cpp @@ -1,7 +1,7 @@ #include "InputConstraint.h" -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" bool InputConstraint::isMappingConstrained(int iPad, int mapping) { // If it's a menu button, then we ignore all inputs @@ -10,11 +10,11 @@ bool InputConstraint::isMappingConstrained(int iPad, int mapping) { } // Otherwise see if they map to the same actual button - unsigned char layoutMapping = InputManager.GetJoypadMapVal(iPad); + unsigned char layoutMapping = PlatformInput.GetJoypadMapVal(iPad); // 4J HEG - Replaced the equivalance test with bitwise AND, important in // some mapping configurations (e.g. when comparing two action map values // and one has extra buttons mapped) - return (InputManager.GetGameJoypadMaps(layoutMapping, m_inputMapping) & - InputManager.GetGameJoypadMaps(layoutMapping, mapping)) > 0; + return (PlatformInput.GetGameJoypadMaps(layoutMapping, m_inputMapping) & + PlatformInput.GetGameJoypadMaps(layoutMapping, mapping)) > 0; } diff --git a/targets/app/common/Tutorial/FullTutorial.cpp b/targets/app/common/Tutorial/FullTutorial.cpp index c0d45db3d..4d6fbe1e9 100644 --- a/targets/app/common/Tutorial/FullTutorial.cpp +++ b/targets/app/common/Tutorial/FullTutorial.cpp @@ -3,7 +3,7 @@ #include #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "app/common/Tutorial/Constraints/AreaConstraint.h" #include "app/common/Tutorial/Constraints/ChangeStateConstraint.h" diff --git a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp index 9847c2981..fbc14d81e 100644 --- a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" @@ -54,12 +54,12 @@ bool ChoiceTask::isCompleted() { return false; if (!m_bConfirmMappingComplete && - InputManager.GetValue(pMinecraft->player->GetXboxPad(), + PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), m_iConfirmMapping) > 0) { m_bConfirmMappingComplete = true; } if (!m_bCancelMappingComplete && - InputManager.GetValue(pMinecraft->player->GetXboxPad(), + PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), m_iCancelMapping) > 0) { m_bCancelMappingComplete = true; } diff --git a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp index c1dce5cdb..62b91e381 100644 --- a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "minecraft/GameEnums.h" #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" @@ -81,7 +81,7 @@ bool ControllerTask::isCompleted() { for (auto it = southpawCompletedMappings.begin(); it != southpawCompletedMappings.end(); ++it) { if (!it->second) { - if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), + if (PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), it->first) > 0) { it->second = true; m_uiCompletionMask |= 1 << iCurrent; @@ -95,7 +95,7 @@ bool ControllerTask::isCompleted() { for (auto it = completedMappings.begin(); it != completedMappings.end(); ++it) { if (!it->second) { - if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), + if (PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), it->first) > 0) { it->second = true; m_uiCompletionMask |= 1 << iCurrent; diff --git a/targets/app/common/Tutorial/Tasks/InfoTask.cpp b/targets/app/common/Tutorial/Tasks/InfoTask.cpp index c9dfc0283..65a41a07e 100644 --- a/targets/app/common/Tutorial/Tasks/InfoTask.cpp +++ b/targets/app/common/Tutorial/Tasks/InfoTask.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" @@ -63,7 +63,7 @@ bool InfoTask::isCompleted() { ++it) { bool current = (*it).second; if (!current) { - if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), + if (PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0) { (*it).second = true; bAllComplete = true; diff --git a/targets/app/common/Tutorial/Tutorial.cpp b/targets/app/common/Tutorial/Tutorial.cpp index 9a82d358b..1da388404 100644 --- a/targets/app/common/Tutorial/Tutorial.cpp +++ b/targets/app/common/Tutorial/Tutorial.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index d1fb9835a..b58e60814 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -7,8 +7,8 @@ #include #include -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Render.h" #include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" @@ -263,11 +263,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick() { bool bStickInput = false; float fInputX = - InputManager.GetJoypadStick_LX(iPad, false) * + PlatformInput.GetJoypadStick_LX(iPad, false) * ((float)app.GetGameSettings(iPad, eGameSetting_Sensitivity_InMenu) / 100.0f); // apply the sensitivity float fInputY = - InputManager.GetJoypadStick_LY(iPad, false) * + PlatformInput.GetJoypadStick_LY(iPad, false) * ((float)app.GetGameSettings(iPad, eGameSetting_Sensitivity_InMenu) / 100.0f); // apply the sensitivity diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index af15c437d..f545eed7a 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -7,7 +7,7 @@ #include #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "minecraft/GameEnums.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp index 59233e5dc..a446a4a46 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp index 30f14552d..c67cc7e70 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp @@ -4,7 +4,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.h b/targets/app/common/UI/Components/UIComponent_Tooltips.h index e07969066..b0d59aa8c 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.h +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.h @@ -3,7 +3,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Render.h" #include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIEnums.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index 726eba47b..74d318b85 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -3,8 +3,8 @@ #include -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" @@ -130,12 +130,12 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId) { case eControl_EndY: case eControl_EndZ: m_keyboardCallbackControl = (eControls)((int)controlId); - InputManager.RequestKeyboard( + PlatformInput.RequestKeyboard( L"Enter something", L"", 0, 25, [this](bool bRes) -> int { return handleKeyboardComplete(bRes); }, - C_4JInput::EKeyboardMode_Default); + IPlatformInput::EKeyboardMode_Default); break; }; } @@ -156,7 +156,7 @@ void UIScene_DebugCreateSchematic::handleCheckboxToggled(F64 controlId, } int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { - const char* text = InputManager.GetText(); + const char* text = PlatformInput.GetText(); if (text[0] != '\0') { std::wstring value = convStringToWstring(text); int iVal = 0; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp index 87045c669..7a102e0ae 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp @@ -1,6 +1,6 @@ #include "UIScene_DebugOptions.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/Console_Debug_enum.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index 59e3d96b3..187e32296 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -5,7 +5,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index 581d81420..290445a84 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -5,8 +5,8 @@ #include -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -119,12 +119,12 @@ void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) { case eControl_YRot: case eControl_Elevation: m_keyboardCallbackControl = (eControls)((int)controlId); - InputManager.RequestKeyboard( + PlatformInput.RequestKeyboard( L"Enter something", L"", 0, 25, [this](bool bRes) -> int { return handleKeyboardComplete(bRes); }, - C_4JInput::EKeyboardMode_Default); + IPlatformInput::EKeyboardMode_Default); break; }; } @@ -139,7 +139,7 @@ void UIScene_DebugSetCamera::handleCheckboxToggled(F64 controlId, } int UIScene_DebugSetCamera::handleKeyboardComplete(bool bRes) { - const char* text = InputManager.GetText(); + const char* text = PlatformInput.GetText(); if (text[0] != '\0') { std::wstring value = convStringToWstring(text); double val = 0; 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 fd55a5b58..698ab0179 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 @@ -7,8 +7,8 @@ #include #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" @@ -353,7 +353,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) { switch ((int)controlId) { case eControl_EditWorldName: { m_bIgnoreInput = true; - InputManager.RequestKeyboard( + PlatformInput.RequestKeyboard( app.GetString(IDS_CREATE_NEW_WORLD), m_editWorldName.getLabel(), 0, 25, [this](bool bRes) -> int { @@ -361,7 +361,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) { // 4J HEG - No reason to set value if keyboard was cancelled if (bRes) { std::wstring str = - convStringToWstring(InputManager.GetText()); + convStringToWstring(PlatformInput.GetText()); if (!str.empty()) { m_editWorldName.setLabel(str); m_worldName = std::move(str); @@ -370,7 +370,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) { } return 0; }, - C_4JInput::EKeyboardMode_Default); + IPlatformInput::EKeyboardMode_Default); } break; case eControl_GameModeToggle: switch (m_iGameModeId) { @@ -623,7 +623,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { // the sign-in UI again int connectedControllers = 0; for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) + if (PlatformInput.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) ++connectedControllers; } @@ -990,7 +990,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned( // the sign-in UI again int connectedControllers = 0; for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) + if (PlatformInput.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) ++connectedControllers; } diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp index f803dd8b1..62cce0128 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp @@ -1,7 +1,7 @@ #include "UIScene_DLCMainMenu.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp index beadbe741..61d7a1b25 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp @@ -4,7 +4,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Render.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_DLCList.h" 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 af1e574e5..8c1776f40 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 @@ -4,8 +4,8 @@ #include #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.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 ((InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i))) { + if ((PlatformInput.IsPadConnected(i) || ProfileManager.IsSignedIn(i))) { if (!app.DLCInstallProcessCompleted() && !app.DLCInstallPending()) { app.StartInstallDLCProcess(i); break; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp index 64eb2b1f6..138ef39bb 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp @@ -1,6 +1,6 @@ #include "UIScene_Intro.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" 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 f2fd29f87..5ba2df3ff 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 @@ -5,7 +5,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" 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 3977355c9..189f29393 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 @@ -4,8 +4,8 @@ #include -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" @@ -547,21 +547,21 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId) { switch ((int)controlId) { case eControl_EditSeed: { m_bIgnoreInput = true; - InputManager.RequestKeyboard( + PlatformInput.RequestKeyboard( app.GetString(IDS_CREATE_NEW_WORLD_SEED), m_editSeed.getLabel(), 0, 60, [this](bool bRes) -> int { // 4J HEG - No reason to set value if keyboard was cancelled if (bRes) { std::wstring str = - convStringToWstring(InputManager.GetText()); + convStringToWstring(PlatformInput.GetText()); m_editSeed.setLabel(str); m_params->seed = std::move(str); } m_bIgnoreInput = false; return 0; }, - C_4JInput::EKeyboardMode_Default); + IPlatformInput::EKeyboardMode_Default); } break; } } 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 e972b3ff1..9b8356a95 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 @@ -8,7 +8,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Leaderboards/LeaderboardInterface.h" 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 45034a7e6..763c88654 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 @@ -5,7 +5,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" 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 43676d4d3..1eb606ab5 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 @@ -6,8 +6,8 @@ #include -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" @@ -823,7 +823,7 @@ int UIScene_LoadOrJoinMenu::handleKeyboardCompleteWorldName(bool bRes) { // 4J HEG - No reason to set value if keyboard was cancelled m_bIgnoreInput = false; if (bRes) { - const char* text = InputManager.GetText(); + const char* text = PlatformInput.GetText(); // check the name is valid if (text[0] != '\0') { } else { @@ -1492,12 +1492,12 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( .UTF8SaveName, strlen(pClass->m_saveDetails->UTF8SaveName) + 1); // plus null wchar_t* ptr = wSaveName; - InputManager.RequestKeyboard( + PlatformInput.RequestKeyboard( app.GetString(IDS_RENAME_WORLD_TITLE), wSaveName, 0, 25, [pClass](bool bRes) -> int { return pClass->handleKeyboardCompleteWorldName(bRes); }, - C_4JInput::EKeyboardMode_Default); + IPlatformInput::EKeyboardMode_Default); } break; case C4JStorage::EMessage_ResultThirdOption: // delete - 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 3b9a12f68..070c56eb8 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 @@ -7,7 +7,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp index c49d994fa..bc11fc542 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp @@ -3,7 +3,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" 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 931a8c4f6..c68b0f0ba 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 @@ -2,8 +2,8 @@ #include "UIScene_SaveMessage.h" #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" #include "app/common/UI/Controls/UIControl_Button.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 ((InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i))) { + if ((PlatformInput.IsPadConnected(i) || ProfileManager.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 0949775d3..508cd538f 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 @@ -1,7 +1,7 @@ #include "UIScene_TrialExitUpsell.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "app/common/App_Defines.h" #include "app/common/UI/UIScene.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp index 2de72d80e..f348711ae 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp @@ -4,8 +4,8 @@ #include -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "minecraft/GameEnums.h" #include "app/common/BuildVer/BuildVer.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -251,7 +251,7 @@ void UIScene_ControlsMenu::PositionAllText(int iPad) { void UIScene_ControlsMenu::PositionText(int iPad, int iTextID, unsigned char ucAction) { - unsigned int uiVal = InputManager.GetGameJoypadMaps( + unsigned int uiVal = PlatformInput.GetGameJoypadMaps( m_iCurrentNavigatedControlsLayout, ucAction); if (uiVal & _360_JOY_BUTTON_A) diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp index 1897318a1..8d60b0a33 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp @@ -4,7 +4,7 @@ #include #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" 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 c290b5781..b8cbb8e83 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp @@ -1,7 +1,7 @@ #include "UIScene_HelpAndOptionsMenu.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp index 916bd3dd1..f8030cd5d 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp @@ -6,7 +6,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp index c453ff0fa..0b06c417a 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp @@ -3,7 +3,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp index f65eb66bd..9f4a3cc83 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp @@ -1,6 +1,6 @@ #include "UIScene_LanguageSelector.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp index 185e50dd0..173ddd7d9 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp @@ -1,7 +1,7 @@ #include "UIScene_ReinstallMenu.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp index 6c8ef57cb..d4a7a677c 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp @@ -3,7 +3,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp index 8775cbce6..2b00fb243 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp @@ -2,7 +2,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" 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 aad9811cb..e5de3e687 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp @@ -2,7 +2,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" 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 1d9533e40..16995bc5c 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp @@ -1,7 +1,7 @@ #include "UIScene_SettingsMenu.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" 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 d9cbf6935..eb53ae30e 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp @@ -3,7 +3,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "minecraft/GameEnums.h" 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 103459bf2..ab430aeb2 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp @@ -3,7 +3,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" 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 a9dc5777e..00729a969 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -5,7 +5,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp index 2345d8042..32ec0ad59 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp @@ -4,7 +4,7 @@ #include #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" 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 6e216951c..c6388196e 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 @@ -7,7 +7,7 @@ #include #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" @@ -316,20 +316,20 @@ UIControl* UIScene_AnvilMenu::getSection(ESceneSection eSection) { void UIScene_AnvilMenu::handleEditNamePressed() { setIgnoreInput(true); - InputManager.RequestKeyboard( + PlatformInput.RequestKeyboard( app.GetString(IDS_TITLE_RENAME), m_textInputAnvil.getLabel(), m_iPad, 30, [this](bool bRes) -> int { // 4J HEG - No reason to set value if keyboard was cancelled setIgnoreInput(false); if (bRes) { - std::wstring str = convStringToWstring(InputManager.GetText()); + std::wstring str = convStringToWstring(PlatformInput.GetText()); setEditNameValue(str); m_itemName = std::move(str); updateItemName(); } return 0; }, - C_4JInput::EKeyboardMode_Default); + IPlatformInput::EKeyboardMode_Default); } void UIScene_AnvilMenu::setEditNameValue(const std::wstring& name) { diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h index f7106a6f0..b17e11b65 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_AnvilMenu.h" #include "app/common/UI/All Platforms/UIEnums.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 cef0b16fa..cf1fdb305 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 @@ -5,7 +5,7 @@ #include #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.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 1ac22cb8d..bdba3b2c3 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 @@ -1,7 +1,7 @@ #include "UIScene_CraftingMenu.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.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 955a61c1f..e4907cd16 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 @@ -3,7 +3,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Storage.h" #include "minecraft/GameEnums.h" 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 b4f2dd238..ad3e71681 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 @@ -7,7 +7,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp index e8f4e7386..394246c94 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp @@ -3,7 +3,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/NetworkPlayerInterface.h" 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 5f5bb4d07..559ccd2e4 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 @@ -3,7 +3,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/Console_Debug_enum.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp index f0af5a898..05fa69ef0 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp @@ -3,7 +3,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/NetworkPlayerInterface.h" 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 1f2d7c3b9..6ee8af491 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 @@ -5,7 +5,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp index a86982b93..bb7f91a6c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp @@ -1,8 +1,8 @@ #include "UIScene_SignEntryMenu.h" -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.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" @@ -50,10 +50,10 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void* _initData, case XC_LANGUAGE_KOREAN: case XC_LANGUAGE_RUSSIAN: m_signRows[i].SetKeyboardType( - C_4JInput::EKeyboardMode_Alphabet); + IPlatformInput::EKeyboardMode_Alphabet); break; default: - m_signRows[i].SetKeyboardType(C_4JInput::EKeyboardMode_Full); + m_signRows[i].SetKeyboardType(IPlatformInput::EKeyboardMode_Full); break; } @@ -158,7 +158,7 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) { case eControl_Line4: { m_iEditingLine = (int)controlId; m_bIgnoreInput = true; - InputManager.RequestKeyboard( + PlatformInput.RequestKeyboard( app.GetString(IDS_SIGN_TITLE), m_textInputLines[m_iEditingLine].getLabel(), m_iPad, 15, [this](bool bRes) -> int { @@ -166,13 +166,13 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) { m_bIgnoreInput = false; if (bRes && m_iEditingLine >= 0 && m_iEditingLine < 4) { std::wstring str = - convStringToWstring(InputManager.GetText()); + convStringToWstring(PlatformInput.GetText()); if (str.size() > 15) str.resize(15); m_textInputLines[m_iEditingLine].setLabel(str); } return 0; }, - C_4JInput::EKeyboardMode_Alphabet); + IPlatformInput::EKeyboardMode_Alphabet); } break; } } diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp index 7609c73a1..9b5a14269 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp @@ -3,7 +3,7 @@ #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/NetworkPlayerInterface.h" diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp index c00a2d1ba..ffd65d895 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp @@ -1,7 +1,7 @@ #include "UIScene_ConnectingProgress.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index 61869e35a..182bd1444 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -5,7 +5,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" diff --git a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp index 44dbaa8d1..c93d5be06 100644 --- a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp +++ b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp @@ -1,6 +1,6 @@ #include "UIScene_Keyboard.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "app/common/App_Defines.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp index 348461ba0..62a16ea6f 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp @@ -2,7 +2,7 @@ #include "UIScene_MessageBox.h" #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" diff --git a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp index 1cfb41e50..8f7f0bc00 100644 --- a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp @@ -4,8 +4,8 @@ #include #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -137,7 +137,7 @@ 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) && InputManager.IsPadConnected(i)) { + if (ProfileManager.IsSignedIn(i) && PlatformInput.IsPadConnected(i)) { // app.DebugPrintf("Index %d is signed in, display name - '%s'\n", // i, ProfileManager.GetDisplayName(i).data()); @@ -159,7 +159,7 @@ void UIScene_QuadrantSignin::updateState() { m_lastRequestedAvatar = i; } } - } else if (InputManager.IsPadConnected(i)) { + } else if (PlatformInput.IsPadConnected(i)) { // app.DebugPrintf("Index %d is not signed in\n", i); setControllerState(i, eControllerStatus_PressToJoin); @@ -234,7 +234,7 @@ void UIScene_QuadrantSignin::_initQuadrants() { } m_labelDisplayName[i].init(ProfileManager.GetDisplayName(i)); - } else if (InputManager.IsPadConnected(i)) { + } else if (PlatformInput.IsPadConnected(i)) { app.DebugPrintf("Index %d is not signed in\n", i); setControllerState(i, eControllerStatus_PressToJoin); diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 8f77249dd..23fe7cf1c 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -10,7 +10,7 @@ #include #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" @@ -737,7 +737,7 @@ void UIController::tickInput() { if (!m_bSystemUIShowing) { #if defined(ENABLE_IGGY_PERFMON) if (m_iggyPerfmonEnabled) { - if (InputManager.ButtonPressed(ProfileManager.GetPrimaryPad(), + if (PlatformInput.ButtonPressed(ProfileManager.GetPrimaryPad(), ACTION_MENU_STICK_PRESS)) m_iggyPerfmonEnabled = !m_iggyPerfmonEnabled; } else @@ -765,9 +765,9 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) { bool released = false; // Toggle bool repeat = false; - down = InputManager.ButtonDown(iPad, key); - pressed = InputManager.ButtonPressed(iPad, key); // Toggle - released = InputManager.ButtonReleased(iPad, key); // Toggle + down = PlatformInput.ButtonDown(iPad, key); + pressed = PlatformInput.ButtonPressed(iPad, key); // Toggle + released = PlatformInput.ButtonReleased(iPad, key); // Toggle if (pressed) app.DebugPrintf("Pressed %d\n", key); if (released) app.DebugPrintf("Released %d\n", key); @@ -847,29 +847,29 @@ void UIController::renderScenes() { IggyPerfmonPad pm_pad; pm_pad.bits = 0; - pm_pad.field.dpad_up = InputManager.ButtonPressed( + pm_pad.field.dpad_up = PlatformInput.ButtonPressed( ProfileManager.GetPrimaryPad(), ACTION_MENU_UP); - pm_pad.field.dpad_down = InputManager.ButtonPressed( + pm_pad.field.dpad_down = PlatformInput.ButtonPressed( ProfileManager.GetPrimaryPad(), ACTION_MENU_DOWN); - pm_pad.field.dpad_left = InputManager.ButtonPressed( + pm_pad.field.dpad_left = PlatformInput.ButtonPressed( ProfileManager.GetPrimaryPad(), ACTION_MENU_LEFT); - pm_pad.field.dpad_right = InputManager.ButtonPressed( + pm_pad.field.dpad_right = PlatformInput.ButtonPressed( ProfileManager.GetPrimaryPad(), ACTION_MENU_RIGHT); - pm_pad.field.button_up = InputManager.ButtonPressed( + pm_pad.field.button_up = PlatformInput.ButtonPressed( ProfileManager.GetPrimaryPad(), ACTION_MENU_Y); - pm_pad.field.button_down = InputManager.ButtonPressed( + pm_pad.field.button_down = PlatformInput.ButtonPressed( ProfileManager.GetPrimaryPad(), ACTION_MENU_A); - pm_pad.field.button_left = InputManager.ButtonPressed( + pm_pad.field.button_left = PlatformInput.ButtonPressed( ProfileManager.GetPrimaryPad(), ACTION_MENU_X); - pm_pad.field.button_right = InputManager.ButtonPressed( + pm_pad.field.button_right = PlatformInput.ButtonPressed( ProfileManager.GetPrimaryPad(), ACTION_MENU_B); - pm_pad.field.shoulder_left_hi = InputManager.ButtonPressed( + pm_pad.field.shoulder_left_hi = PlatformInput.ButtonPressed( ProfileManager.GetPrimaryPad(), ACTION_MENU_LEFT_SCROLL); - pm_pad.field.shoulder_right_hi = InputManager.ButtonPressed( + pm_pad.field.shoulder_right_hi = PlatformInput.ButtonPressed( ProfileManager.GetPrimaryPad(), ACTION_MENU_RIGHT_SCROLL); - pm_pad.field.trigger_left_low = InputManager.ButtonPressed( + pm_pad.field.trigger_left_low = PlatformInput.ButtonPressed( ProfileManager.GetPrimaryPad(), ACTION_MENU_PAGEUP); - pm_pad.field.trigger_right_low = InputManager.ButtonPressed( + pm_pad.field.trigger_right_low = PlatformInput.ButtonPressed( ProfileManager.GetPrimaryPad(), ACTION_MENU_PAGEDOWN); // IggyPerfmonPadFromXInputStatePointer(pm_pad, &xi_pad); @@ -1582,7 +1582,7 @@ void UIController::SetMenuDisplayed(int iPad, bool bVal) { if (bVal) { if (iPad == XUSER_INDEX_ANY) { for (int i = 0; i < XUSER_MAX_COUNT; i++) { - InputManager.SetMenuDisplayed(i, true); + PlatformInput.SetMenuDisplayed(i, true); m_bMenuDisplayed[i] = true; // 4J Stu - Fix for #11018 - Functional: When the controller is // unplugged during active gameplay and plugged back in at the @@ -1590,7 +1590,7 @@ void UIController::SetMenuDisplayed(int iPad, bool bVal) { m_bMenuToBeClosed[i] = false; } } else { - InputManager.SetMenuDisplayed(iPad, true); + PlatformInput.SetMenuDisplayed(iPad, true); m_bMenuDisplayed[iPad] = true; // 4J Stu - Fix for #11018 - Functional: When the controller is // unplugged during active gameplay and plugged back in at the @@ -1618,7 +1618,7 @@ void UIController::CheckMenuDisplayed() { } else { m_bMenuToBeClosed[iPad] = false; m_bMenuDisplayed[iPad] = false; - InputManager.SetMenuDisplayed(iPad, false); + PlatformInput.SetMenuDisplayed(iPad, false); } } } diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index dfd92ec1a..cf808ed11 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -21,7 +21,7 @@ #endif #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" #include "app/common/UI/All Platforms/IUIController.h" diff --git a/targets/app/common/UI/UIScene.cpp b/targets/app/common/UI/UIScene.cpp index 8bded15d2..efb0da2f0 100644 --- a/targets/app/common/UI/UIScene.cpp +++ b/targets/app/common/UI/UIScene.cpp @@ -5,7 +5,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Render.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index 93c109dc2..fe6b4689c 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -54,8 +54,8 @@ static void sigsegv_handler(int sig) { // #include "../Common/XUI/XUI_Scene_Container.h" // #include "NetworkManager.h" #include "platform/PlatformTypes.h" -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" @@ -112,302 +112,302 @@ void DefineActions(void) { // Split into Menu actions, and in-game actions - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_A, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_A, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_B, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_B, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_X, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_X, _360_JOY_BUTTON_X); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_Y, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_Y, _360_JOY_BUTTON_Y); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OK, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OK, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_CANCEL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_CANCEL, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_0, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_0, ACTION_MENU_DOWN, _360_JOY_BUTTON_DPAD_DOWN | _360_JOY_BUTTON_LSTICK_DOWN); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_0, ACTION_MENU_LEFT, _360_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_0, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEUP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEUP, _360_JOY_BUTTON_LT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEDOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEDOWN, _360_JOY_BUTTON_RT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_RIGHT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_RIGHT_SCROLL, _360_JOY_BUTTON_RB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_LEFT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_LEFT_SCROLL, _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAUSEMENU, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAUSEMENU, _360_JOY_BUTTON_START); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_STICK_PRESS, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_STICK_PRESS, _360_JOY_BUTTON_LTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_PRESS, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_PRESS, _360_JOY_BUTTON_RTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_UP, _360_JOY_BUTTON_RSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_JUMP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_JUMP, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_FORWARD, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_FORWARD, _360_JOY_BUTTON_LSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_BACKWARD, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_BACKWARD, _360_JOY_BUTTON_LSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT, _360_JOY_BUTTON_LSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT, _360_JOY_BUTTON_LSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_UP, _360_JOY_BUTTON_RSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_USE, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_USE, _360_JOY_BUTTON_LT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_ACTION, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_ACTION, _360_JOY_BUTTON_RT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT_SCROLL, _360_JOY_BUTTON_RB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT_SCROLL, _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_INVENTORY, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_INVENTORY, _360_JOY_BUTTON_Y); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_PAUSEMENU, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_PAUSEMENU, _360_JOY_BUTTON_START); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DROP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DROP, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_SNEAK_TOGGLE, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_SNEAK_TOGGLE, _360_JOY_BUTTON_RTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_CRAFTING, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_CRAFTING, _360_JOY_BUTTON_X); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RENDER_THIRD_PERSON, _360_JOY_BUTTON_LTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_GAME_INFO, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_GAME_INFO, _360_JOY_BUTTON_BACK); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_LEFT, _360_JOY_BUTTON_DPAD_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_UP, _360_JOY_BUTTON_DPAD_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_DOWN, _360_JOY_BUTTON_DPAD_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_A, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_A, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_B, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_B, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_X, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_X, _360_JOY_BUTTON_X); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_Y, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_Y, _360_JOY_BUTTON_Y); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OK, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OK, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_CANCEL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_CANCEL, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_1, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_1, ACTION_MENU_DOWN, _360_JOY_BUTTON_DPAD_DOWN | _360_JOY_BUTTON_LSTICK_DOWN); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_1, ACTION_MENU_LEFT, _360_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_1, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEUP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEUP, _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEDOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEDOWN, _360_JOY_BUTTON_RT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_RIGHT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_RIGHT_SCROLL, _360_JOY_BUTTON_RB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_LEFT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_LEFT_SCROLL, _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAUSEMENU, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAUSEMENU, _360_JOY_BUTTON_START); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_STICK_PRESS, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_STICK_PRESS, _360_JOY_BUTTON_LTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_PRESS, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_PRESS, _360_JOY_BUTTON_RTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_UP, _360_JOY_BUTTON_RSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_JUMP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_JUMP, _360_JOY_BUTTON_RB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_FORWARD, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_FORWARD, _360_JOY_BUTTON_LSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_BACKWARD, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_BACKWARD, _360_JOY_BUTTON_LSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT, _360_JOY_BUTTON_LSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT, _360_JOY_BUTTON_LSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_UP, _360_JOY_BUTTON_RSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_USE, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_USE, _360_JOY_BUTTON_RT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_ACTION, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_ACTION, _360_JOY_BUTTON_LT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT_SCROLL, _360_JOY_BUTTON_DPAD_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT_SCROLL, _360_JOY_BUTTON_DPAD_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_INVENTORY, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_INVENTORY, _360_JOY_BUTTON_Y); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_PAUSEMENU, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_PAUSEMENU, _360_JOY_BUTTON_START); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DROP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DROP, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_SNEAK_TOGGLE, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_SNEAK_TOGGLE, _360_JOY_BUTTON_LTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_CRAFTING, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_CRAFTING, _360_JOY_BUTTON_X); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RENDER_THIRD_PERSON, _360_JOY_BUTTON_RTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_GAME_INFO, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_GAME_INFO, _360_JOY_BUTTON_BACK); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_LEFT, _360_JOY_BUTTON_DPAD_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_UP, _360_JOY_BUTTON_DPAD_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_DOWN, _360_JOY_BUTTON_DPAD_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_A, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_A, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_B, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_B, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_X, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_X, _360_JOY_BUTTON_X); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_Y, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_Y, _360_JOY_BUTTON_Y); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OK, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OK, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_CANCEL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_CANCEL, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_DOWN, _360_JOY_BUTTON_DPAD_DOWN | _360_JOY_BUTTON_LSTICK_DOWN); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_LEFT, _360_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_PAGEUP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAGEDOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAGEDOWN, _360_JOY_BUTTON_RT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_RIGHT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_RIGHT_SCROLL, _360_JOY_BUTTON_RB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_LEFT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_LEFT_SCROLL, _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_JUMP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_JUMP, _360_JOY_BUTTON_LT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_FORWARD, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_FORWARD, _360_JOY_BUTTON_LSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_BACKWARD, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_BACKWARD, _360_JOY_BUTTON_LSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT, _360_JOY_BUTTON_LSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT, _360_JOY_BUTTON_LSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_UP, _360_JOY_BUTTON_RSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_USE, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_USE, _360_JOY_BUTTON_RT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_ACTION, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_ACTION, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT_SCROLL, _360_JOY_BUTTON_DPAD_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT_SCROLL, _360_JOY_BUTTON_DPAD_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_INVENTORY, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_INVENTORY, _360_JOY_BUTTON_Y); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_PAUSEMENU, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_PAUSEMENU, _360_JOY_BUTTON_START); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DROP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DROP, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_SNEAK_TOGGLE, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_SNEAK_TOGGLE, _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_CRAFTING, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_CRAFTING, _360_JOY_BUTTON_X); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RENDER_THIRD_PERSON, _360_JOY_BUTTON_LTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_GAME_INFO, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_GAME_INFO, _360_JOY_BUTTON_BACK); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAUSEMENU, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAUSEMENU, _360_JOY_BUTTON_START); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_STICK_PRESS, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_STICK_PRESS, _360_JOY_BUTTON_LTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_PRESS, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_PRESS, _360_JOY_BUTTON_RTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_UP, _360_JOY_BUTTON_RSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_LEFT, _360_JOY_BUTTON_DPAD_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_UP, _360_JOY_BUTTON_DPAD_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_DOWN, _360_JOY_BUTTON_DPAD_DOWN); } @@ -474,12 +474,12 @@ int main(int argc, const char* argv[]) { // Set the number of possible joypad layouts that the user can switch // between, and the number of actions - InputManager.Initialise(1, 5, MINECRAFT_ACTION_MAX, ACTION_MAX_MENU); + PlatformInput.Initialise(1, 5, MINECRAFT_ACTION_MAX, ACTION_MAX_MENU); // Set the default joypad action mappings for Minecraft DefineActions(); - InputManager.SetJoypadMapVal(0, 0); - InputManager.SetKeyRepeatRate(0.3f, 0.2f); + PlatformInput.SetJoypadMapVal(0, 0); + PlatformInput.SetKeyRepeatRate(0.3f, 0.2f); // Initialise the profile manager with the game Title ID, Offer ID, a // profile version number, and the number of profile values and settings @@ -532,7 +532,7 @@ int main(int argc, const char* argv[]) { ui.setScreenSize(fbw, fbh); } app.UpdateTime(); - InputManager.Tick(); + PlatformInput.Tick(); ProfileManager.Tick(); diff --git a/targets/app/windows/src/Windows64_Minecraft.cpp b/targets/app/windows/src/Windows64_Minecraft.cpp index 7b43f2d06..416ebef5e 100644 --- a/targets/app/windows/src/Windows64_Minecraft.cpp +++ b/targets/app/windows/src/Windows64_Minecraft.cpp @@ -74,302 +74,302 @@ void DefineActions(void) { // Split into Menu actions, and in-game actions - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_A, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_A, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_B, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_B, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_X, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_X, _360_JOY_BUTTON_X); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_Y, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_Y, _360_JOY_BUTTON_Y); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OK, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OK, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_CANCEL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_CANCEL, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_0, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_0, ACTION_MENU_DOWN, _360_JOY_BUTTON_DPAD_DOWN | _360_JOY_BUTTON_LSTICK_DOWN); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_0, ACTION_MENU_LEFT, _360_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_0, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEUP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEUP, _360_JOY_BUTTON_LT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEDOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEDOWN, _360_JOY_BUTTON_RT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_RIGHT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_RIGHT_SCROLL, _360_JOY_BUTTON_RB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_LEFT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_LEFT_SCROLL, _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAUSEMENU, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAUSEMENU, _360_JOY_BUTTON_START); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_STICK_PRESS, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_STICK_PRESS, _360_JOY_BUTTON_LTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_PRESS, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_PRESS, _360_JOY_BUTTON_RTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_UP, _360_JOY_BUTTON_RSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_JUMP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_JUMP, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_FORWARD, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_FORWARD, _360_JOY_BUTTON_LSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_BACKWARD, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_BACKWARD, _360_JOY_BUTTON_LSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT, _360_JOY_BUTTON_LSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT, _360_JOY_BUTTON_LSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_UP, _360_JOY_BUTTON_RSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_USE, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_USE, _360_JOY_BUTTON_LT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_ACTION, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_ACTION, _360_JOY_BUTTON_RT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT_SCROLL, _360_JOY_BUTTON_RB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT_SCROLL, _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_INVENTORY, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_INVENTORY, _360_JOY_BUTTON_Y); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_PAUSEMENU, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_PAUSEMENU, _360_JOY_BUTTON_START); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DROP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DROP, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_SNEAK_TOGGLE, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_SNEAK_TOGGLE, _360_JOY_BUTTON_RTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_CRAFTING, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_CRAFTING, _360_JOY_BUTTON_X); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RENDER_THIRD_PERSON, _360_JOY_BUTTON_LTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_GAME_INFO, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_GAME_INFO, _360_JOY_BUTTON_BACK); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_LEFT, _360_JOY_BUTTON_DPAD_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_UP, _360_JOY_BUTTON_DPAD_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_DOWN, _360_JOY_BUTTON_DPAD_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_A, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_A, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_B, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_B, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_X, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_X, _360_JOY_BUTTON_X); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_Y, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_Y, _360_JOY_BUTTON_Y); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OK, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OK, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_CANCEL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_CANCEL, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_1, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_1, ACTION_MENU_DOWN, _360_JOY_BUTTON_DPAD_DOWN | _360_JOY_BUTTON_LSTICK_DOWN); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_1, ACTION_MENU_LEFT, _360_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_1, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEUP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEUP, _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEDOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEDOWN, _360_JOY_BUTTON_RT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_RIGHT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_RIGHT_SCROLL, _360_JOY_BUTTON_RB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_LEFT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_LEFT_SCROLL, _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAUSEMENU, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAUSEMENU, _360_JOY_BUTTON_START); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_STICK_PRESS, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_STICK_PRESS, _360_JOY_BUTTON_LTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_PRESS, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_PRESS, _360_JOY_BUTTON_RTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_UP, _360_JOY_BUTTON_RSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_JUMP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_JUMP, _360_JOY_BUTTON_RB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_FORWARD, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_FORWARD, _360_JOY_BUTTON_LSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_BACKWARD, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_BACKWARD, _360_JOY_BUTTON_LSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT, _360_JOY_BUTTON_LSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT, _360_JOY_BUTTON_LSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_UP, _360_JOY_BUTTON_RSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_USE, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_USE, _360_JOY_BUTTON_RT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_ACTION, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_ACTION, _360_JOY_BUTTON_LT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT_SCROLL, _360_JOY_BUTTON_DPAD_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT_SCROLL, _360_JOY_BUTTON_DPAD_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_INVENTORY, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_INVENTORY, _360_JOY_BUTTON_Y); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_PAUSEMENU, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_PAUSEMENU, _360_JOY_BUTTON_START); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DROP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DROP, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_SNEAK_TOGGLE, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_SNEAK_TOGGLE, _360_JOY_BUTTON_LTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_CRAFTING, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_CRAFTING, _360_JOY_BUTTON_X); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RENDER_THIRD_PERSON, _360_JOY_BUTTON_RTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_GAME_INFO, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_GAME_INFO, _360_JOY_BUTTON_BACK); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_LEFT, _360_JOY_BUTTON_DPAD_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_UP, _360_JOY_BUTTON_DPAD_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_DOWN, _360_JOY_BUTTON_DPAD_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_A, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_A, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_B, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_B, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_X, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_X, _360_JOY_BUTTON_X); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_Y, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_Y, _360_JOY_BUTTON_Y); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OK, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OK, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_CANCEL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_CANCEL, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_DOWN, _360_JOY_BUTTON_DPAD_DOWN | _360_JOY_BUTTON_LSTICK_DOWN); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_LEFT, _360_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); - InputManager.SetGameJoypadMaps( + PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_PAGEUP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAGEDOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAGEDOWN, _360_JOY_BUTTON_RT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_RIGHT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_RIGHT_SCROLL, _360_JOY_BUTTON_RB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_LEFT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_LEFT_SCROLL, _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_JUMP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_JUMP, _360_JOY_BUTTON_LT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_FORWARD, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_FORWARD, _360_JOY_BUTTON_LSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_BACKWARD, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_BACKWARD, _360_JOY_BUTTON_LSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT, _360_JOY_BUTTON_LSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT, _360_JOY_BUTTON_LSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_UP, _360_JOY_BUTTON_RSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_USE, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_USE, _360_JOY_BUTTON_RT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_ACTION, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_ACTION, _360_JOY_BUTTON_A); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT_SCROLL, _360_JOY_BUTTON_DPAD_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT_SCROLL, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT_SCROLL, _360_JOY_BUTTON_DPAD_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_INVENTORY, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_INVENTORY, _360_JOY_BUTTON_Y); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_PAUSEMENU, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_PAUSEMENU, _360_JOY_BUTTON_START); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DROP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DROP, _360_JOY_BUTTON_B); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_SNEAK_TOGGLE, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_SNEAK_TOGGLE, _360_JOY_BUTTON_LB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_CRAFTING, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_CRAFTING, _360_JOY_BUTTON_X); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RENDER_THIRD_PERSON, _360_JOY_BUTTON_LTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_GAME_INFO, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_GAME_INFO, _360_JOY_BUTTON_BACK); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAUSEMENU, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAUSEMENU, _360_JOY_BUTTON_START); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_STICK_PRESS, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_STICK_PRESS, _360_JOY_BUTTON_LTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_PRESS, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_PRESS, _360_JOY_BUTTON_RTHUMB); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_UP, _360_JOY_BUTTON_RSTICK_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_DOWN, _360_JOY_BUTTON_RSTICK_DOWN); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_LEFT, _360_JOY_BUTTON_RSTICK_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_RIGHT, _360_JOY_BUTTON_RSTICK_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_LEFT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_LEFT, _360_JOY_BUTTON_DPAD_LEFT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_RIGHT, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_UP, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_UP, _360_JOY_BUTTON_DPAD_UP); - InputManager.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_DOWN, + PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_DOWN, _360_JOY_BUTTON_DPAD_DOWN); } @@ -718,12 +718,12 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // Set the number of possible joypad layouts that the user can switch // between, and the number of actions - InputManager.Initialise(1, 3, MINECRAFT_ACTION_MAX, ACTION_MAX_MENU); + PlatformInput.Initialise(1, 3, MINECRAFT_ACTION_MAX, ACTION_MAX_MENU); // Set the default joypad action mappings for Minecraft DefineActions(); - InputManager.SetJoypadMapVal(0, 0); - InputManager.SetKeyRepeatRate(0.3f, 0.2f); + PlatformInput.SetJoypadMapVal(0, 0); + PlatformInput.SetKeyRepeatRate(0.3f, 0.2f); // Initialise the profile manager with the game Title ID, Offer ID, a // profile version number, and the number of profile values and settings @@ -790,7 +790,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // } app.UpdateTime(); - InputManager.Tick(); + PlatformInput.Tick(); // ProfileManager.Tick(); diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index a83545736..675b2144c 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -13,7 +13,7 @@ #include #include -#include "platform/InputActions.h" +#include "platform/input/InputActions.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" @@ -104,7 +104,7 @@ #if defined(ENABLE_JAVA_GUIS) #include "minecraft/client/gui/inventory/CreativeInventoryScreen.h" #endif -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "app/common/Minecraft_Macros.h" #include "app/common/Colours/ColourTable.h" #include "app/common/ConsoleGameMode.h" @@ -560,11 +560,11 @@ void Minecraft::setScreen(Screen* screen) { #if defined(ENABLE_JAVA_GUIS) if (screen != nullptr && player != nullptr) { if (player && player->GetXboxPad() != -1) { - InputManager.SetMenuDisplayed(player->GetXboxPad(), true); + PlatformInput.SetMenuDisplayed(player->GetXboxPad(), true); } } else if (player != nullptr) { if (player && player->GetXboxPad() != -1) { - InputManager.SetMenuDisplayed(player->GetXboxPad(), false); + PlatformInput.SetMenuDisplayed(player->GetXboxPad(), false); } } #endif @@ -634,11 +634,11 @@ void Minecraft::destroy() { #if defined(ENABLE_JAVA_GUIS) if (screen != nullptr) { if (player && player->GetXboxPad() != -1) { - InputManager.SetMenuDisplayed(player->GetXboxPad(), true); + PlatformInput.SetMenuDisplayed(player->GetXboxPad(), true); } } else { if (player && player->GetXboxPad() != -1) { - InputManager.SetMenuDisplayed(player->GetXboxPad(), false); + PlatformInput.SetMenuDisplayed(player->GetXboxPad(), false); } } #endif @@ -716,7 +716,7 @@ void Minecraft::updatePlayerViewportAssignments() { for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (localplayers[i] != nullptr) { // Primary player settings decide what the mode is - if (gameServices().getGameSettings(InputManager.GetPrimaryPad(), + if (gameServices().getGameSettings(PlatformInput.GetPrimaryPad(), eGameSetting_SplitScreenVertical)) { localplayers[i]->m_iScreenSection = C4JRender::VIEWPORT_TYPE_SPLIT_LEFT + found; @@ -983,7 +983,7 @@ void Minecraft::removeLocalPlayerIdx(int idx) { } localplayers[idx] = nullptr; - if (idx == InputManager.GetPrimaryPad()) { + if (idx == PlatformInput.GetPrimaryPad()) { // We should never try to remove the Primary player in this way assert(false); /* @@ -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(InputManager.GetPrimaryPad())) { + if (ProfileManager.IsSignedIn(PlatformInput.GetPrimaryPad())) { user->name = convStringToWstring( - ProfileManager.GetGamertag(InputManager.GetPrimaryPad())); + ProfileManager.GetGamertag(PlatformInput.GetPrimaryPad())); } } @@ -1076,17 +1076,17 @@ void Minecraft::run_middle() { // player has a app action running , or has any crafting // or containers open, don't autosave if (!StorageManager.GetSaveDisabled() && - (gameServices().getXuiAction(InputManager.GetPrimaryPad()) == + (gameServices().getXuiAction(PlatformInput.GetPrimaryPad()) == eAppAction_Idle)) { if (!ui.IsPauseMenuDisplayed( - InputManager.GetPrimaryPad()) && + PlatformInput.GetPrimaryPad()) && !ui.IsIgnoreAutosaveMenuDisplayed( - InputManager.GetPrimaryPad())) { + PlatformInput.GetPrimaryPad())) { // check if the autotimer countdown has reached // zero unsigned char ucAutosaveVal = gameServices().getGameSettings( - InputManager.GetPrimaryPad(), + PlatformInput.GetPrimaryPad(), eGameSetting_Autosave); bool bTrialTexturepack = false; if (!Minecraft::GetInstance() @@ -1123,7 +1123,7 @@ void Minecraft::run_middle() { Log::info("+++Autosave\n"); Log::info("+++++++++++\n"); gameServices().setAction( - InputManager.GetPrimaryPad(), + PlatformInput.GetPrimaryPad(), eAppAction_AutosaveSaveGame); // gameServices().setAutosaveTimerTime(); #if !defined(_CONTENT_PACKAGE) @@ -1219,7 +1219,7 @@ void Minecraft::run_middle() { if (gameServices().isLocalMultiplayerAvailable()) { for (int i = 0; i < XUSER_MAX_COUNT; i++) { if ((localplayers[i] == nullptr) && - InputManager.IsPadConnected(i)) { + PlatformInput.IsPadConnected(i)) { if (!ui.PressStartPlaying(i)) { ui.ShowPressStart(i); } @@ -1236,27 +1236,27 @@ void Minecraft::run_middle() { for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (localplayers[i]) { // 4J-PB - add these to check for coming out of idle - if (InputManager.ButtonPressed(i, + if (PlatformInput.ButtonPressed(i, MINECRAFT_ACTION_JUMP)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_JUMP; - if (InputManager.ButtonPressed(i, MINECRAFT_ACTION_USE)) + if (PlatformInput.ButtonPressed(i, MINECRAFT_ACTION_USE)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_USE; - if (InputManager.ButtonPressed( + if (PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_INVENTORY)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_INVENTORY; - if (InputManager.ButtonPressed(i, + if (PlatformInput.ButtonPressed(i, MINECRAFT_ACTION_ACTION)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_ACTION; - if (InputManager.ButtonPressed( + if (PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_CRAFTING)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_CRAFTING; - if (InputManager.ButtonPressed( + if (PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_PAUSEMENU)) { localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_PAUSEMENU; @@ -1267,7 +1267,7 @@ void Minecraft::run_middle() { pauseGame(); #endif } - if (InputManager.ButtonPressed(i, + if (PlatformInput.ButtonPressed(i, MINECRAFT_ACTION_DROP)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_DROP; @@ -1275,21 +1275,21 @@ void Minecraft::run_middle() { // 4J-PB - If we're flying, the sneak needs to be held // on to go down if (localplayers[i]->abilities.flying) { - if (InputManager.ButtonDown( + if (PlatformInput.ButtonDown( i, MINECRAFT_ACTION_SNEAK_TOGGLE)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_SNEAK_TOGGLE; } else { - if (InputManager.ButtonPressed( + if (PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_SNEAK_TOGGLE)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_SNEAK_TOGGLE; } - if (InputManager.ButtonPressed( + if (PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_RENDER_THIRD_PERSON)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_RENDER_THIRD_PERSON; - if (InputManager.ButtonPressed( + if (PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_GAME_INFO)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_GAME_INFO; @@ -1299,19 +1299,19 @@ void Minecraft::run_middle() { localplayers[i]->ullDpad_last = 0; localplayers[i]->ullDpad_this = 0; localplayers[i]->ullDpad_filtered = 0; - if (InputManager.ButtonPressed( + if (PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_DPAD_RIGHT)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_CHANGE_SKIN; - if (InputManager.ButtonPressed( + if (PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_DPAD_UP)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_FLY_TOGGLE; - if (InputManager.ButtonPressed( + if (PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_DPAD_DOWN)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_RENDER_DEBUG; - if (InputManager.ButtonPressed( + if (PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_DPAD_LEFT)) localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_SPAWN_CREEPER; @@ -1328,25 +1328,25 @@ void Minecraft::run_middle() { localplayers[i]->ullDpad_this = 0; int dirCount = 0; - if (InputManager.ButtonDown( + if (PlatformInput.ButtonDown( i, MINECRAFT_ACTION_DPAD_LEFT)) { localplayers[i]->ullDpad_this |= 1LL << MINECRAFT_ACTION_DPAD_LEFT; dirCount++; } - if (InputManager.ButtonDown( + if (PlatformInput.ButtonDown( i, MINECRAFT_ACTION_DPAD_RIGHT)) { localplayers[i]->ullDpad_this |= 1LL << MINECRAFT_ACTION_DPAD_RIGHT; dirCount++; } - if (InputManager.ButtonDown( + if (PlatformInput.ButtonDown( i, MINECRAFT_ACTION_DPAD_UP)) { localplayers[i]->ullDpad_this |= 1LL << MINECRAFT_ACTION_DPAD_UP; dirCount++; } - if (InputManager.ButtonDown( + if (PlatformInput.ButtonDown( i, MINECRAFT_ACTION_DPAD_DOWN)) { localplayers[i]->ullDpad_this |= 1LL << MINECRAFT_ACTION_DPAD_DOWN; @@ -1365,12 +1365,12 @@ void Minecraft::run_middle() { } // for the opacity timer - if (InputManager.ButtonPressed( + if (PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_LEFT_SCROLL) || - InputManager.ButtonPressed( + PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_RIGHT_SCROLL)) - // InputManager.ButtonPressed(i, MINECRAFT_ACTION_USE) - // || InputManager.ButtonPressed(i, + // PlatformInput.ButtonPressed(i, MINECRAFT_ACTION_USE) + // || PlatformInput.ButtonPressed(i, // MINECRAFT_ACTION_ACTION)) { gameServices().setOpacityTimer(i); @@ -1382,10 +1382,10 @@ void Minecraft::run_middle() { // exist? They'll be wanting to join the game then bool tryJoin = !pause && !ui.IsIgnorePlayerJoinMenuDisplayed( - InputManager.GetPrimaryPad()) && + PlatformInput.GetPrimaryPad()) && g_NetworkManager.SessionHasSpace() && RenderManager.IsHiDef() && - InputManager.ButtonPressed(i); + PlatformInput.ButtonPressed(i); if (tryJoin) { if (!ui.PressStartPlaying(i)) { ui.ShowPressStart(i); @@ -1393,7 +1393,7 @@ void Minecraft::run_middle() { // did we just get input from a player who // doesn't exist? They'll be wanting to join the // game then - if (InputManager.ButtonPressed( + if (PlatformInput.ButtonPressed( i, MINECRAFT_ACTION_PAUSEMENU)) { // Let them join @@ -1539,7 +1539,7 @@ void Minecraft::run_middle() { // twice with the same time - let's tick the inputmanager // again if (i != 0) { - InputManager.Tick(); + PlatformInput.Tick(); gameServices().handleButtonPresses(); } @@ -1559,13 +1559,13 @@ void Minecraft::run_middle() { if (localplayers[idx] != nullptr) { // any input received? if ((localplayers[idx]->ullButtonsPressed != 0) || - InputManager.GetJoypadStick_LX(idx, false) != + PlatformInput.GetJoypadStick_LX(idx, false) != 0.0f || - InputManager.GetJoypadStick_LY(idx, false) != + PlatformInput.GetJoypadStick_LY(idx, false) != 0.0f || - InputManager.GetJoypadStick_RX(idx, false) != + PlatformInput.GetJoypadStick_RX(idx, false) != 0.0f || - InputManager.GetJoypadStick_RY(idx, false) != + PlatformInput.GetJoypadStick_RY(idx, false) != 0.0f) { localplayers[idx]->ResetInactiveTicks(); } else { @@ -1602,7 +1602,7 @@ void Minecraft::run_middle() { ui.HandleGameTick(); - setLocalPlayerIdx(InputManager.GetPrimaryPad()); + setLocalPlayerIdx(PlatformInput.GetPrimaryPad()); // 4J - added - now do the equivalent of level::animateTick, // but taking into account the positions of all our players @@ -1648,7 +1648,7 @@ void Minecraft::run_middle() { if (!noRender) { bool bFirst = true; - int iPrimaryPad = InputManager.GetPrimaryPad(); + int iPrimaryPad = PlatformInput.GetPrimaryPad(); for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (setLocalPlayerIdx(i)) { RenderManager.StateSetViewport( @@ -2082,14 +2082,14 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { int* piUse; int* piAlt; - unsigned int uiAction = InputManager.GetGameJoypadMaps( - InputManager.GetJoypadMapVal(iPad), MINECRAFT_ACTION_ACTION); - unsigned int uiJump = InputManager.GetGameJoypadMaps( - InputManager.GetJoypadMapVal(iPad), MINECRAFT_ACTION_JUMP); - unsigned int uiUse = InputManager.GetGameJoypadMaps( - InputManager.GetJoypadMapVal(iPad), MINECRAFT_ACTION_USE); - unsigned int uiAlt = InputManager.GetGameJoypadMaps( - InputManager.GetJoypadMapVal(iPad), MINECRAFT_ACTION_SNEAK_TOGGLE); + unsigned int uiAction = PlatformInput.GetGameJoypadMaps( + PlatformInput.GetJoypadMapVal(iPad), MINECRAFT_ACTION_ACTION); + unsigned int uiJump = PlatformInput.GetGameJoypadMaps( + PlatformInput.GetJoypadMapVal(iPad), MINECRAFT_ACTION_JUMP); + unsigned int uiUse = PlatformInput.GetGameJoypadMaps( + PlatformInput.GetJoypadMapVal(iPad), MINECRAFT_ACTION_USE); + unsigned int uiAlt = PlatformInput.GetGameJoypadMaps( + PlatformInput.GetJoypadMapVal(iPad), MINECRAFT_ACTION_SNEAK_TOGGLE); // Also need to handle PS3 having swapped triggers/bumpers switch (uiAction) { @@ -3228,9 +3228,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { int wheel = 0; unsigned int leftTicks = - InputManager.GetValue(iPad, MINECRAFT_ACTION_LEFT_SCROLL, true); + PlatformInput.GetValue(iPad, MINECRAFT_ACTION_LEFT_SCROLL, true); unsigned int rightTicks = - InputManager.GetValue(iPad, MINECRAFT_ACTION_RIGHT_SCROLL, true); + PlatformInput.GetValue(iPad, MINECRAFT_ACTION_RIGHT_SCROLL, true); if (leftTicks > 0 && gameMode->isInputAllowed(MINECRAFT_ACTION_LEFT_SCROLL)) { wheel = (int)leftTicks; // positive = left @@ -3261,21 +3261,21 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if (gameMode->isInputAllowed(MINECRAFT_ACTION_ACTION)) { if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_ACTION))) - // if(InputManager.ButtonPressed(iPad, MINECRAFT_ACTION_ACTION) ) + // if(PlatformInput.ButtonPressed(iPad, MINECRAFT_ACTION_ACTION) ) { // printf("MINECRAFT_ACTION_ACTION ButtonPressed"); player->handleMouseClick(0); player->lastClickTick[0] = ticks; } - if (InputManager.ButtonDown(iPad, MINECRAFT_ACTION_ACTION) && + if (PlatformInput.ButtonDown(iPad, MINECRAFT_ACTION_ACTION) && ticks - player->lastClickTick[0] >= timer->ticksPerSecond / 4) { // printf("MINECRAFT_ACTION_ACTION ButtonDown"); player->handleMouseClick(0); player->lastClickTick[0] = ticks; } - if (InputManager.ButtonDown(iPad, MINECRAFT_ACTION_ACTION)) { + if (PlatformInput.ButtonDown(iPad, MINECRAFT_ACTION_ACTION)) { player->handleMouseDown(0, true); } else { player->handleMouseDown(0, false); @@ -3287,7 +3287,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // Java game does it, however we may find that the way we had it // previously is more fun to play. /* - if ((InputManager.GetValue(iPad, MINECRAFT_ACTION_USE,true)>0) && + if ((PlatformInput.GetValue(iPad, MINECRAFT_ACTION_USE,true)>0) && gameMode->isInputAllowed(MINECRAFT_ACTION_USE) ) { handleMouseClick(1); @@ -3295,14 +3295,14 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } */ if (player->isUsingItem()) { - if (!InputManager.ButtonDown(iPad, MINECRAFT_ACTION_USE)) + if (!PlatformInput.ButtonDown(iPad, MINECRAFT_ACTION_USE)) gameMode->releaseUsingItem(player); } else if (gameMode->isInputAllowed(MINECRAFT_ACTION_USE)) { if (player->abilities.instabuild) { // 4J - attempt to handle click in special creative mode fashion // if possible (used for placing blocks at regular intervals) bool didClick = player->creativeModeHandleMouseClick( - 1, InputManager.ButtonDown(iPad, MINECRAFT_ACTION_USE)); + 1, PlatformInput.ButtonDown(iPad, MINECRAFT_ACTION_USE)); // If this handler has put us in lastClick_oldRepeat mode then // it is because we aren't placing blocks - behave largely as // the code used to @@ -3316,7 +3316,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } else { // Otherwise just the original game code for handling // autorepeat - if (InputManager.ButtonDown(iPad, + if (PlatformInput.ButtonDown(iPad, MINECRAFT_ACTION_USE) && ticks - player->lastClickTick[1] >= timer->ticksPerSecond / 4) { @@ -3339,7 +3339,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if (player->isRiding() || player->isSprinting() || player->isSleeping()) autoRepeat = false; - if (InputManager.ButtonDown(iPad, MINECRAFT_ACTION_USE)) { + if (PlatformInput.ButtonDown(iPad, MINECRAFT_ACTION_USE)) { // If the player has just exited a bed, then delay the time // before a repeat key is allowed without releasing if (player->isSleeping()) @@ -3376,7 +3376,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { #if defined(_DEBUG_MENUS_ENABLED) if (gameServices().debugSettingsOn()) { // 4J-PB - debugoverlay for primary player only - if (iPad == InputManager.GetPrimaryPad()) { + if (iPad == PlatformInput.GetPrimaryPad()) { if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_RENDER_DEBUG))) { #if !defined(_CONTENT_PACKAGE) @@ -3498,7 +3498,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { bool selected = false; { - int hotbarSlot = InputManager.GetHotbarSlotPressed(iPad); + int hotbarSlot = PlatformInput.GetHotbarSlotPressed(iPad); if (hotbarSlot >= 0 && hotbarSlot <= 9) { player->inventory->selected = hotbarSlot; selected = true; @@ -3525,7 +3525,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { } } else { // 4J-PB - // if (InputManager.GetValue(iPad, ACTION_MENU_CANCEL) > 0 && + // if (PlatformInput.GetValue(iPad, ACTION_MENU_CANCEL) > 0 && // gameMode->isInputAllowed(ACTION_MENU_CANCEL)) { // setScreen(nullptr); // } @@ -3536,7 +3536,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // if(!(ui.GetMenuDisplayed(iPad))) // { // wchar_t wchInput; - // if(InputManager.InputDetected(iPad,&wchInput)) + // if(PlatformInput.InputDetected(iPad,&wchInput)) // { // printf("Input Detected!\n"); // @@ -3839,7 +3839,7 @@ void Minecraft::setLevel(MultiPlayerLevel* level, int message /*=-1*/, // If no player has been set, then this is the first level to be set // this game, so set up a primary player & initialise some other things if (player == nullptr) { - int iPrimaryPlayer = InputManager.GetPrimaryPad(); + int iPrimaryPlayer = PlatformInput.GetPrimaryPad(); player = gameMode->createPlayer(level); @@ -4053,11 +4053,11 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) { cameraTargetPlayer = player; // 4J-PB - are we the primary player or a local player? - if (iPad == InputManager.GetPrimaryPad()) { + if (iPad == PlatformInput.GetPrimaryPad()) { createPrimaryLocalPlayer(iPad); // update the debugoptions - gameServices().setGameSettingsDebugMask(InputManager.GetPrimaryPad(), + gameServices().setGameSettingsDebugMask(PlatformInput.GetPrimaryPad(), gameServices().debugGetMask(-1, true)); } else { storeExtraLocalPlayer(iPad); @@ -4498,7 +4498,7 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { } } } else if (ProfileManager.IsSignedInLive( - InputManager.GetPrimaryPad()) && + PlatformInput.GetPrimaryPad()) && !ProfileManager.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 diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index bf7c23d0a..edd5e9ff7 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -5,7 +5,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "platform/sdl2/Render.h" #include "Facing.h" #include "minecraft/GameEnums.h" @@ -335,7 +335,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // 4J - this is where to set the blend factor for gui things // use the primary player's settings unsigned char ucAlpha = gameServices().getGameSettings( - InputManager.GetPrimaryPad(), eGameSetting_InterfaceOpacity); + PlatformInput.GetPrimaryPad(), eGameSetting_InterfaceOpacity); // If the user has started to navigate their quickselect bar, ignore the // alpha setting, and display at default value diff --git a/targets/minecraft/client/gui/PauseScreen.cpp b/targets/minecraft/client/gui/PauseScreen.cpp index 1f11ea04f..d1d7405a5 100644 --- a/targets/minecraft/client/gui/PauseScreen.cpp +++ b/targets/minecraft/client/gui/PauseScreen.cpp @@ -8,7 +8,7 @@ #include #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "Button.h" #include "MessageScreen.h" #include "minecraft/GameEnums.h" @@ -33,7 +33,7 @@ void PauseScreen::init() { // 4jcraft: solves the issue of client-side only pausing in the java gui if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) - gameServices().setXuiServerAction(InputManager.GetPrimaryPad(), + gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)true); buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo, I18n::get(L"menu.returnToMenu"))); @@ -91,7 +91,7 @@ void PauseScreen::buttonClicked(Button* button) { exitWorld(minecraft, true); } if (button->id == 4) { - gameServices().setXuiServerAction(InputManager.GetPrimaryPad(), + gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)false); minecraft->setScreen(nullptr); // minecraft->grabMouse(); // 4J - removed diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index d7095ec8c..dd6c0c685 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -1,8 +1,8 @@ #include "minecraft/IGameServices.h" #include "Screen.h" -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "Button.h" #include "minecraft/GameEnums.h" @@ -44,7 +44,7 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey) { // unpausing is done in all scenarios if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) - gameServices().setXuiServerAction(InputManager.GetPrimaryPad(), + gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), eXuiServerAction_PauseServer, (void*)false); } } @@ -108,14 +108,14 @@ void Screen::updateEvents() { minecraft->height); int screenWidth = ssc.getWidth(); int screenHeight = ssc.getHeight(); - int xMouse = InputManager.GetMouseX() * screenWidth / fbw; - int yMouse = InputManager.GetMouseY() * screenHeight / fbh - 1; + int xMouse = PlatformInput.GetMouseX() * screenWidth / fbw; + int yMouse = PlatformInput.GetMouseY() * screenHeight / fbh - 1; static bool prevLeftState = false; static bool prevRightState = false; - bool leftState = InputManager.ButtonDown(0, MINECRAFT_ACTION_ACTION); - bool rightState = InputManager.ButtonDown(0, MINECRAFT_ACTION_USE); + bool leftState = PlatformInput.ButtonDown(0, MINECRAFT_ACTION_ACTION); + bool rightState = PlatformInput.ButtonDown(0, MINECRAFT_ACTION_USE); if (leftState && !prevLeftState) { mouseClicked(xMouse, yMouse, 0); diff --git a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp index 48d17c954..cf90fe3b4 100644 --- a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp @@ -6,8 +6,8 @@ #include #include -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Render.h" #include "AbstractContainerScreen.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" @@ -255,11 +255,11 @@ void CreativeInventoryScreen::updateEvents() { int scrollableRows = totalRows - ROWS; if (scrollableRows > 0) { float step = 1.0f / (float)scrollableRows; - if (InputManager.ButtonDown(0, MINECRAFT_ACTION_LEFT_SCROLL)) { + if (PlatformInput.ButtonDown(0, MINECRAFT_ACTION_LEFT_SCROLL)) { currentScroll -= step; currentScroll = std::max(0.0f, std::min(1.0f, currentScroll)); container->scrollTo(currentScroll); - } else if (InputManager.ButtonDown(0, + } else if (PlatformInput.ButtonDown(0, MINECRAFT_ACTION_RIGHT_SCROLL)) { currentScroll += step; currentScroll = std::max(0.0f, std::min(1.0f, currentScroll)); diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index 5c5531979..d1b8a8405 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -13,7 +13,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" @@ -228,7 +228,7 @@ ClientConnection::ClientConnection(Minecraft* minecraft, Socket* socket, this->minecraft = minecraft; if (iUserIndex < 0) { - m_userIndex = InputManager.GetPrimaryPad(); + m_userIndex = PlatformInput.GetPrimaryPad(); } else { m_userIndex = iUserIndex; } @@ -290,7 +290,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { INetworkPlayer* networkPlayer = connection->getSocket()->getPlayer(); int iUserID = -1; - if (m_userIndex == InputManager.GetPrimaryPad()) { + if (m_userIndex == PlatformInput.GetPrimaryPad()) { iUserID = m_userIndex; } else { if (!networkPlayer->IsGuest() && networkPlayer->IsLocal()) { @@ -346,13 +346,13 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { gameServices().setBanListCheck(iUserID, false); } - if (m_userIndex == InputManager.GetPrimaryPad()) { + if (m_userIndex == PlatformInput.GetPrimaryPad()) { if (gameServices().getTutorialMode()) { minecraft->gameMode = new FullTutorialMode( - InputManager.GetPrimaryPad(), minecraft, this); + PlatformInput.GetPrimaryPad(), minecraft, this); } else { minecraft->gameMode = new ConsoleGameMode( - InputManager.GetPrimaryPad(), minecraft, this); + PlatformInput.GetPrimaryPad(), minecraft, this); } Level* dimensionLevel = minecraft->getLevel(packet->dimension); @@ -387,7 +387,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { minecraft->player->setCustomSkin(gameServices().getPlayerSkinId(m_userIndex)); minecraft->player->setCustomCape(gameServices().getPlayerCapeId(m_userIndex)); - minecraft->createPrimaryLocalPlayer(InputManager.GetPrimaryPad()); + minecraft->createPrimaryLocalPlayer(PlatformInput.GetPrimaryPad()); minecraft->player->dimension = packet->dimension; minecraft->setScreen(new ReceivingLevelScreen(this)); @@ -412,7 +412,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { displayPrivilegeChanges(minecraft->player, startingPrivileges); // update the debugoptions - gameServices().setGameSettingsDebugMask(InputManager.GetPrimaryPad(), + gameServices().setGameSettingsDebugMask(PlatformInput.GetPrimaryPad(), gameServices().debugGetMask(-1, true)); } else { // 4J-PB - this isn't the level we want @@ -1362,12 +1362,12 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, if (g_NetworkManager.IsHost() && (reason == DisconnectPacket::eDisconnect_TimeOut || reason == DisconnectPacket::eDisconnect_Overflow) && - m_userIndex == InputManager.GetPrimaryPad() && + m_userIndex == PlatformInput.GetPrimaryPad() && !MinecraftServer::saveOnExitAnswered()) { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, - InputManager.GetPrimaryPad(), + PlatformInput.GetPrimaryPad(), &ClientConnection::HostDisconnectReturned, nullptr); } else { @@ -1936,7 +1936,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { // 4J-PB - if we go straight in from the menus via an invite, we won't // have the DLC info if (gameServices().getTMSGlobalFileListRead() == false) { - gameServices().setTMSAction(InputManager.GetPrimaryPad(), + gameServices().setTMSAction(PlatformInput.GetPrimaryPad(), eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); } } @@ -1951,7 +1951,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { cantPlayContentRestricted) { DisconnectPacket::eDisconnectReason reason = DisconnectPacket::eDisconnect_NoUGC_Remote; - if (m_userIndex == InputManager.GetPrimaryPad()) { + if (m_userIndex == PlatformInput.GetPrimaryPad()) { if (!isFriendsWithHost) reason = DisconnectPacket::eDisconnect_NotFriendsWithHost; else if (!isAtLeastOneFriend) @@ -1967,7 +1967,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { "privileges: %d\n", reason); gameServices().setDisconnectReason(reason); - gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_ExitWorld, + gameServices().setAction(PlatformInput.GetPrimaryPad(), eAppAction_ExitWorld, (void*)true); } else { if (!isFriendsWithHost) @@ -2014,7 +2014,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { // send this before the LoginPacket so that it gets handled first, as // once the LoginPacket is received on the client the game is close to // starting - if (m_userIndex == InputManager.GetPrimaryPad()) { + if (m_userIndex == PlatformInput.GetPrimaryPad()) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->skins->selectTexturePackById( packet->m_texturePackId)) { @@ -3009,11 +3009,11 @@ void ClientConnection::handleGameEvent( Log::info("handleGameEvent packet for WIN_GAME - %d\n", m_userIndex); // This just allows it to be shown - if (minecraft->localgameModes[InputManager.GetPrimaryPad()] != nullptr) - minecraft->localgameModes[InputManager.GetPrimaryPad()] + if (minecraft->localgameModes[PlatformInput.GetPrimaryPad()] != nullptr) + minecraft->localgameModes[PlatformInput.GetPrimaryPad()] ->getTutorial() ->showTutorialPopup(false); - ui.NavigateToScene(InputManager.GetPrimaryPad(), eUIScene_EndPoem, + ui.NavigateToScene(PlatformInput.GetPrimaryPad(), eUIScene_EndPoem, nullptr, eUILayer_Scene, eUIGroup_Fullscreen); } else if (event == GameEventPacket::START_SAVING) { if (!g_NetworkManager.IsHost()) { @@ -3021,7 +3021,7 @@ void ClientConnection::handleGameEvent( // back-to-back START/STOP packets leave the client stuck in the // loading screen gameServices().setGameStarted(false); - gameServices().setAction(InputManager.GetPrimaryPad(), + gameServices().setAction(PlatformInput.GetPrimaryPad(), eAppAction_RemoteServerSave); } } else if (event == GameEventPacket::STOP_SAVING) { @@ -3456,7 +3456,7 @@ int ClientConnection::HostDisconnectReturned( uiIDA[0] = IDS_CONFIRM_CANCEL; uiIDA[1] = IDS_CONFIRM_OK; ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, - uiIDA, 2, InputManager.GetPrimaryPad(), + uiIDA, 2, PlatformInput.GetPrimaryPad(), &ClientConnection::ExitGameAndSaveReturned, nullptr); } else { @@ -3475,7 +3475,7 @@ int ClientConnection::ExitGameAndSaveReturned( // int32_t saveOrCheckpointId = 0; // bool validSave = // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); - // SentientManager.RecordLevelSaveOrCheckpoint(InputManager.GetPrimaryPad(), + // SentientManager.RecordLevelSaveOrCheckpoint(PlatformInput.GetPrimaryPad(), // saveOrCheckpointId); MinecraftServer::getInstance()->setSaveOnExit(true); } else { diff --git a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp index 906a106d7..274eed236 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp @@ -151,7 +151,7 @@ void MultiPlayerGameMode::startDestroyBlock(int x, int y, int z, int face) { (Tile::tiles[t]->getDestroyProgress( minecraft->player, minecraft->player->level, x, y, z) >= 1 // ||(gameServices().debugSettingsOn() && - // gameServices().debugGetMask(InputManager.GetPrimaryPad())&(1L< #include "platform/PlatformTypes.h" -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "ClientConnection.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Console_Debug_enum.h" @@ -123,7 +123,7 @@ void MultiPlayerLevel::tick() { #if !defined(_FINAL_BUILD) bool freezeTime = gameServices().debugSettingsOn() && - gameServices().debugGetMask(InputManager.GetPrimaryPad()) & + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime); if (!freezeTime) #endif diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index dcdbfa22d..00df22c57 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -72,7 +72,7 @@ void MultiplayerLocalPlayer::tick() { // 4J Added // 4J-PB - changing this to a game host option ot hide gamertags // bool bIsisPrimaryHost=g_NetworkManager.IsHost() && - // (InputManager.GetPrimaryPad()==m_iPad); + // (PlatformInput.GetPrimaryPad()==m_iPad); /*if((gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) != m_bShownOnMaps) diff --git a/targets/minecraft/client/player/Input.cpp b/targets/minecraft/client/player/Input.cpp index d41178e7c..c9973d902 100644 --- a/targets/minecraft/client/player/Input.cpp +++ b/targets/minecraft/client/player/Input.cpp @@ -3,8 +3,8 @@ #include -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "LocalPlayer.h" #include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" @@ -38,7 +38,7 @@ void Input::tick(LocalPlayer* player) { MINECRAFT_ACTION_LEFT) || pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_RIGHT)) - xa = -InputManager.GetJoypadStick_LX(iPad); + xa = -PlatformInput.GetJoypadStick_LX(iPad); else xa = 0.0f; @@ -46,7 +46,7 @@ void Input::tick(LocalPlayer* player) { MINECRAFT_ACTION_FORWARD) || pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_BACKWARD)) - ya = InputManager.GetJoypadStick_LY(iPad); + ya = PlatformInput.GetJoypadStick_LY(iPad); else ya = 0.0f; @@ -87,7 +87,7 @@ void Input::tick(LocalPlayer* player) { MINECRAFT_ACTION_LOOK_LEFT) || pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_RIGHT)) - tx = InputManager.GetJoypadStick_RX(iPad) * + tx = PlatformInput.GetJoypadStick_RX(iPad) * (((float)gameServices().getGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f); // apply sensitivity to look @@ -95,7 +95,7 @@ void Input::tick(LocalPlayer* player) { MINECRAFT_ACTION_LOOK_UP) || pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_DOWN)) - ty = InputManager.GetJoypadStick_RY(iPad) * + ty = PlatformInput.GetJoypadStick_RY(iPad) * (((float)gameServices().getGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f); // apply sensitivity to look @@ -120,11 +120,11 @@ void Input::tick(LocalPlayer* player) { // jumping = controller.isButtonPressed(0); - sprintKey = InputManager.GetValue(iPad, MINECRAFT_ACTION_SPRINT) && + sprintKey = PlatformInput.GetValue(iPad, MINECRAFT_ACTION_SPRINT) && pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_SPRINT); jumping = - InputManager.GetValue(iPad, MINECRAFT_ACTION_JUMP) && + PlatformInput.GetValue(iPad, MINECRAFT_ACTION_JUMP) && pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_JUMP); #ifndef _CONTENT_PACKAGE diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index ff2fb41d1..9af0f11b3 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -28,8 +28,8 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" // 4J Stu - Added for tutorial callbacks -#include "platform/InputActions.h" -#include "platform/sdl2/Input.h" +#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_structs.h" @@ -381,7 +381,7 @@ void LocalPlayer::aiStep() { // snap y rotation to nearest 90 degree axis aligned value float yRotSnapped = floorf((yRot / 90.0f) + 0.5f) * 90.0f; - if (InputManager.GetJoypadMapVal(m_iPad) == 0) { + if (PlatformInput.GetJoypadMapVal(m_iPad) == 0) { if (ullDpad_filtered & (1LL << MINECRAFT_ACTION_DPAD_RIGHT)) { xd = -0.15 * cos(yRotSnapped * std::numbers::pi / 180); zd = -0.15 * sin(yRotSnapped * std::numbers::pi / 180); @@ -485,12 +485,12 @@ void LocalPlayer::aiStep() { } // Check if the player is idle and the rich presence needs updated - if (!m_bIsIdle && InputManager.GetIdleSeconds(m_iPad) > PLAYER_IDLE_TIME) { + if (!m_bIsIdle && PlatformInput.GetIdleSeconds(m_iPad) > PLAYER_IDLE_TIME) { ProfileManager.SetCurrentGameActivity(m_iPad, CONTEXT_PRESENCE_IDLE, false); m_bIsIdle = true; } else if (m_bIsIdle && - InputManager.GetIdleSeconds(m_iPad) < PLAYER_IDLE_TIME) { + PlatformInput.GetIdleSeconds(m_iPad) < PLAYER_IDLE_TIME) { // Are we offline or online, and how many players are there if (g_NetworkManager.GetPlayerCount() > 1) { // only do it for this player here - each player will run this code diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index 87228a1eb..461968499 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -9,7 +9,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "platform/sdl2/Render.h" #include "BossMobGuiInfo.h" #include "Chunk.h" @@ -274,7 +274,7 @@ void GameRenderer::tick(bool first) // 4J - add bFirst 1.0f / ((float)SharedConstants::TICKS_PER_SECOND * 4); } - if (mc->player != mc->localplayers[InputManager.GetPrimaryPad()]) + if (mc->player != mc->localplayers[PlatformInput.GetPrimaryPad()]) return; // 4J added for split screen - only do rest of processing for // once per frame @@ -1047,8 +1047,8 @@ void GameRenderer::render(float a, bool bFirst) { ScreenSizeCalculator ssc(mc->options, mc->width, mc->height); int screenWidth = ssc.getWidth(); int screenHeight = ssc.getHeight(); - int xMouse = InputManager.GetMouseX() * screenWidth / mc->width; - int yMouse = InputManager.GetMouseY() * screenHeight / mc->height - 1; + int xMouse = PlatformInput.GetMouseX() * screenWidth / mc->width; + int yMouse = PlatformInput.GetMouseY() * screenHeight / mc->height - 1; int maxFps = getFpsCap(mc->options->framerateLimit); @@ -1242,7 +1242,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { // view whatever they have loaded in - we're sharing render data between // players. bool updateChunks = - (mc->player == mc->localplayers[InputManager.GetPrimaryPad()]); + (mc->player == mc->localplayers[PlatformInput.GetPrimaryPad()]); // if (mc->cameraTargetPlayer == nullptr) // 4J - removed condition as we // want to update this is mc->player changes for different local players diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index 03173d8b2..20adb191f 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -16,7 +16,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "platform/sdl2/Render.h" #include "Chunk.h" #include "GameRenderer.h" @@ -435,7 +435,7 @@ void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel* level) { // tile entities in the world dissappear We should only do this when // actually exiting the game, so only when the primary player sets there // level to nullptr - if (playerIndex == InputManager.GetPrimaryPad()) { + if (playerIndex == PlatformInput.GetPrimaryPad()) { RenderManager.CBuffDeleteAll(); { std::lock_guard lock(m_csRenderableTileEntities); @@ -1164,7 +1164,7 @@ void LevelRenderer::renderClouds(float alpha) { int playerIndex = mc->player->GetXboxPad(); // if the primary player has clouds off, so do all players on this machine - if (gameServices().getGameSettings(InputManager.GetPrimaryPad(), + if (gameServices().getGameSettings(PlatformInput.GetPrimaryPad(), eGameSetting_Clouds) == 0) { return; } @@ -1178,7 +1178,7 @@ void LevelRenderer::renderClouds(float alpha) { } if (gameServices().debugSettingsOn()) { - if (gameServices().debugGetMask(InputManager.GetPrimaryPad()) & + if (gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime)) { iTicks = m_freezeticks; } @@ -1256,7 +1256,7 @@ void LevelRenderer::renderClouds(float alpha) { glEnable(GL_CULL_FACE); if (gameServices().debugSettingsOn()) { - if (!(gameServices().debugGetMask(InputManager.GetPrimaryPad()) & + if (!(gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime))) { m_freezeticks = iTicks; } @@ -1442,7 +1442,7 @@ void LevelRenderer::renderAdvancedClouds(float alpha) { int iTicks = ticks; if (gameServices().debugSettingsOn()) { - if (gameServices().debugGetMask(InputManager.GetPrimaryPad()) & + if (gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime)) { iTicks = m_freezeticks; } @@ -1689,7 +1689,7 @@ void LevelRenderer::renderAdvancedClouds(float alpha) { glEnable(GL_CULL_FACE); if (gameServices().debugSettingsOn()) { - if (!(gameServices().debugGetMask(InputManager.GetPrimaryPad()) & + if (!(gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime))) { m_freezeticks = iTicks; } diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index ec7798b92..2d9cb5a6e 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -7,7 +7,7 @@ #include #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "platform/sdl2/Storage.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" @@ -239,7 +239,7 @@ void DLCTexturePack::loadData() { if (mountIndex > -1) { if (StorageManager.MountInstalledDLC( - InputManager.GetPrimaryPad(), mountIndex, + PlatformInput.GetPrimaryPad(), mountIndex, [this](int pad, std::uint32_t err, std::uint32_t lic) { return onPackMounted(pad, err, lic); }, @@ -249,7 +249,7 @@ void DLCTexturePack::loadData() { if (gameServices().getLevelGenerationOptions()) gameServices().getLevelGenerationOptions()->setLoadedData(); Log::info("Failed to mount texture pack DLC %d for pad %d\n", - mountIndex, InputManager.GetPrimaryPad()); + mountIndex, PlatformInput.GetPrimaryPad()); } else { m_bLoadingData = true; Log::info("Attempted to mount DLC data for texture pack %d\n", @@ -259,7 +259,7 @@ void DLCTexturePack::loadData() { m_bHasLoadedData = true; if (gameServices().getLevelGenerationOptions()) gameServices().getLevelGenerationOptions()->setLoadedData(); - gameServices().setAction(InputManager.GetPrimaryPad(), + gameServices().setAction(PlatformInput.GetPrimaryPad(), eAppAction_ReloadTexturePack); } } @@ -404,7 +404,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, texturePack->m_bHasLoadedData = true; if (gameServices().getLevelGenerationOptions()) gameServices().getLevelGenerationOptions()->setLoadedData(); - gameServices().setAction(InputManager.GetPrimaryPad(), eAppAction_ReloadTexturePack); + gameServices().setAction(PlatformInput.GetPrimaryPad(), eAppAction_ReloadTexturePack); return 0; } diff --git a/targets/minecraft/client/skins/TexturePackRepository.cpp b/targets/minecraft/client/skins/TexturePackRepository.cpp index 7a2afdc2e..5423d434a 100644 --- a/targets/minecraft/client/skins/TexturePackRepository.cpp +++ b/targets/minecraft/client/skins/TexturePackRepository.cpp @@ -7,7 +7,7 @@ #include #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "DLCTexturePack.h" #include "DefaultTexturePack.h" #include "minecraft/GameEnums.h" @@ -151,7 +151,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { selectSkin(newPack); if (newPack->hasData()) { - gameServices().setAction(InputManager.GetPrimaryPad(), + gameServices().setAction(PlatformInput.GetPrimaryPad(), eAppAction_ReloadTexturePack); } else { newPack->loadData(); @@ -167,7 +167,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { "Failed to select texture pack %d as it is not in the list\n", id); // Fail safely if (selectSkin(DEFAULT_TEXTURE_PACK)) { - gameServices().setAction(InputManager.GetPrimaryPad(), + gameServices().setAction(PlatformInput.GetPrimaryPad(), eAppAction_ReloadTexturePack); } } diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index a58e9a2ef..372a89f1b 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -66,7 +66,7 @@ #if defined(SPLIT_SAVES) #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h" #endif -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "platform/ShutdownManager.h" #include "app/common/Console_Debug_enum.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" @@ -832,7 +832,7 @@ void MinecraftServer::saveAllChunks() { void MinecraftServer::saveGameRules() { #if !defined(_CONTENT_PACKAGE) if (gameServices().debugSettingsOn() && - gameServices().debugGetMask(InputManager.GetPrimaryPad()) & + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_DistributableSave)) { // Do nothing } else @@ -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(InputManager.GetPrimaryPad())) { + ProfileManager.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/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index 05136b7f5..86c9be140 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -7,7 +7,7 @@ #include #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "platform/sdl2/Storage.h" #include "EntityTracker.h" #include "platform/ShutdownManager.h" @@ -326,7 +326,7 @@ void ServerLevel::tick() { #if !defined(_FINAL_BUILD) bool freezeTime = gameServices().debugSettingsOn() && - gameServices().debugGetMask(InputManager.GetPrimaryPad()) & + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()) & (1L << eDebugSetting_FreezeTime); if (!freezeTime) #endif diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index 656141a7b..1274c881f 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -10,7 +10,7 @@ #include #include -#include "platform/sdl2/Input.h" +#include "platform/input/input.h" #include "EntityTracker.h" #include "app/common/Console_Debug_enum.h" #include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" @@ -585,7 +585,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { void ServerPlayer::doTickB() { #if !defined(_CONTENT_PACKAGE) // check if there's a debug dimension change requested - // if(gameServices().debugGetMask(InputManager.GetPrimaryPad())&(1L<dimension->id == 0 ) // { @@ -593,11 +593,11 @@ void ServerPlayer::doTickB() { // portalTime=1; // } // unsigned int - // uiVal=gameServices().debugGetMask(InputManager.GetPrimaryPad()); - // gameServices().setGameSettingsDebugMask(InputManager.GetPrimaryPad(),uiVal&~(1L<dimension->id == 0 ) // { @@ -605,20 +605,20 @@ void ServerPlayer::doTickB() { // std::dynamic_pointer_cast( shared_from_this() ), 1 ); // } // unsigned int - // uiVal=gameServices().debugGetMask(InputManager.GetPrimaryPad()); - // gameServices().setGameSettingsDebugMask(InputManager.GetPrimaryPad(),uiVal&~(1L<dimension->id != 0) { isInsidePortal = true; portalTime = 1; } unsigned int uiVal = - gameServices().debugGetMask(InputManager.GetPrimaryPad()); + gameServices().debugGetMask(PlatformInput.GetPrimaryPad()); gameServices().setGameSettingsDebugMask( - InputManager.GetPrimaryPad(), + PlatformInput.GetPrimaryPad(), uiVal & ~(1L << eDebugSetting_GoToOverworld)); } #endif diff --git a/targets/minecraft/world/entity/animal/Ocelot.cpp b/targets/minecraft/world/entity/animal/Ocelot.cpp index 54f8e30c3..59b7d990e 100644 --- a/targets/minecraft/world/entity/animal/Ocelot.cpp +++ b/targets/minecraft/world/entity/animal/Ocelot.cpp @@ -6,7 +6,7 @@ #include #include -#include "IPlatformInput.h" +#include "platform/input/input.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index 73d665229..f81c53971 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -15,7 +15,7 @@ #include #include "Explosion.h" -#include "IPlatformInput.h" +#include "platform/input/input.h" #include "LevelListener.h" #include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" diff --git a/targets/minecraft/world/level/biome/BiomeSource.cpp b/targets/minecraft/world/level/biome/BiomeSource.cpp index 7e9657c44..d4dfd30ac 100644 --- a/targets/minecraft/world/level/biome/BiomeSource.cpp +++ b/targets/minecraft/world/level/biome/BiomeSource.cpp @@ -6,7 +6,7 @@ #include -#include "IPlatformInput.h" +#include "platform/input/input.h" #include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index 94a88f486..30178cbb6 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -10,7 +10,7 @@ #include #include -#include "IPlatformInput.h" +#include "platform/input/input.h" #include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" #include "platform/C4JThread.h" diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index 2857ea814..eeb876ec7 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -12,7 +12,7 @@ #include #include -#include "IPlatformInput.h" +#include "platform/input/input.h" #include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" #include "util/Definitions.h" diff --git a/targets/minecraft/world/level/dimension/Dimension.cpp b/targets/minecraft/world/level/dimension/Dimension.cpp index 3b527b48f..8073dd8dc 100644 --- a/targets/minecraft/world/level/dimension/Dimension.cpp +++ b/targets/minecraft/world/level/dimension/Dimension.cpp @@ -6,7 +6,7 @@ #include #include "HellDimension.h" -#include "IPlatformInput.h" +#include "platform/input/input.h" #include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" diff --git a/targets/minecraft/world/level/dimension/HellDimension.cpp b/targets/minecraft/world/level/dimension/HellDimension.cpp index c14f59c6b..48a8da1d8 100644 --- a/targets/minecraft/world/level/dimension/HellDimension.cpp +++ b/targets/minecraft/world/level/dimension/HellDimension.cpp @@ -3,7 +3,7 @@ #include -#include "IPlatformInput.h" +#include "platform/input/input.h" #include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" diff --git a/targets/minecraft/world/level/newbiome/layer/Layer.cpp b/targets/minecraft/world/level/newbiome/layer/Layer.cpp index 8e587c898..53bfde0c9 100644 --- a/targets/minecraft/world/level/newbiome/layer/Layer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/Layer.cpp @@ -7,7 +7,7 @@ #include #include "BiomeOverrideLayer.h" -#include "IPlatformInput.h" +#include "platform/input/input.h" #include "app/common/Console_Debug_enum.h" #include "app/linux/LinuxGame.h" #include "minecraft/world/level/LevelType.h" diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index a565ba700..0fb639d42 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -12,7 +12,7 @@ #include #include -#include "IPlatformInput.h" +#include "platform/input/input.h" #include "LevelData.h" #include "app/common/Console_Debug_enum.h" #include "app/common/GameRules/GameRuleManager.h" diff --git a/targets/minecraft/world/level/tile/entity/SignTileEntity.h b/targets/minecraft/world/level/tile/entity/SignTileEntity.h index c85d25896..18dd87d5f 100644 --- a/targets/minecraft/world/level/tile/entity/SignTileEntity.h +++ b/targets/minecraft/world/level/tile/entity/SignTileEntity.h @@ -6,7 +6,6 @@ #include "TileEntity.h" #include "java/Class.h" #include "minecraft/world/entity/player/Player.h" -#include "platform/IPlatformInput.h" struct STRING_VERIFY_RESPONSE; diff --git a/targets/platform/Platform.h b/targets/platform/Platform.h index 911ac4849..07daad766 100644 --- a/targets/platform/Platform.h +++ b/targets/platform/Platform.h @@ -1,7 +1,7 @@ #pragma once #include "IPlatformFileIO.h" -#include "IPlatformInput.h" +#include "platform/input/input.h" #include "IPlatformLeaderboard.h" #include "IPlatformNetwork.h" #include "IPlatformProfile.h" diff --git a/targets/platform/PlatformServices.cpp b/targets/platform/PlatformServices.cpp index 01da05027..675b4e931 100644 --- a/targets/platform/PlatformServices.cpp +++ b/targets/platform/PlatformServices.cpp @@ -1,7 +1,6 @@ #include "PlatformServices.h" #include "StdFileIO.h" -#include "sdl2/Input.h" #include "sdl2/Profile.h" #include "sdl2/Render.h" #include "sdl2/Storage.h" @@ -9,7 +8,6 @@ static StdFileIO s_stdFileIO; IPlatformFileIO& PlatformFileIO = s_stdFileIO; -IPlatformInput& PlatformInput = InputManager; IPlatformProfile& PlatformProfile = ProfileManager; IPlatformRenderer& PlatformRender = RenderManager; IPlatformStorage& PlatformStorage = StorageManager; diff --git a/targets/platform/PlatformServices.h b/targets/platform/PlatformServices.h index 291f77d99..4343ecb7f 100644 --- a/targets/platform/PlatformServices.h +++ b/targets/platform/PlatformServices.h @@ -1,7 +1,6 @@ #pragma once #include "IPlatformFileIO.h" -#include "IPlatformInput.h" #include "IPlatformLeaderboard.h" #include "IPlatformNetwork.h" #include "IPlatformProfile.h" @@ -13,7 +12,6 @@ // by the app layer at startup. extern IPlatformFileIO& PlatformFileIO; -extern IPlatformInput& PlatformInput; extern IPlatformProfile& PlatformProfile; extern IPlatformRenderer& PlatformRender; extern IPlatformStorage& PlatformStorage; diff --git a/targets/platform/IPlatformInput.h b/targets/platform/input/IPlatformInput.h similarity index 76% rename from targets/platform/IPlatformInput.h rename to targets/platform/input/IPlatformInput.h index 8783c2499..8b20b0c15 100644 --- a/targets/platform/IPlatformInput.h +++ b/targets/platform/input/IPlatformInput.h @@ -4,6 +4,51 @@ #include "PlatformTypes.h" +#define MAP_STYLE_0 0 +#define MAP_STYLE_1 1 +#define MAP_STYLE_2 2 + +#define _360_JOY_BUTTON_A 0x00000001 +#define _360_JOY_BUTTON_B 0x00000002 +#define _360_JOY_BUTTON_X 0x00000004 +#define _360_JOY_BUTTON_Y 0x00000008 + +#define _360_JOY_BUTTON_START 0x00000010 +#define _360_JOY_BUTTON_BACK 0x00000020 +#define _360_JOY_BUTTON_RB 0x00000040 +#define _360_JOY_BUTTON_LB 0x00000080 + +#define _360_JOY_BUTTON_RTHUMB 0x00000100 +#define _360_JOY_BUTTON_LTHUMB 0x00000200 +#define _360_JOY_BUTTON_DPAD_UP 0x00000400 +#define _360_JOY_BUTTON_DPAD_DOWN 0x00000800 + +#define _360_JOY_BUTTON_DPAD_LEFT 0x00001000 +#define _360_JOY_BUTTON_DPAD_RIGHT 0x00002000 +// fake digital versions of analog values +#define _360_JOY_BUTTON_LSTICK_RIGHT 0x00004000 +#define _360_JOY_BUTTON_LSTICK_LEFT 0x00008000 + +#define _360_JOY_BUTTON_RSTICK_DOWN 0x00010000 +#define _360_JOY_BUTTON_RSTICK_UP 0x00020000 +#define _360_JOY_BUTTON_RSTICK_RIGHT 0x00040000 +#define _360_JOY_BUTTON_RSTICK_LEFT 0x00080000 + +#define _360_JOY_BUTTON_LSTICK_DOWN 0x00100000 +#define _360_JOY_BUTTON_LSTICK_UP 0x00200000 +#define _360_JOY_BUTTON_RT 0x00400000 +#define _360_JOY_BUTTON_LT 0x00800000 + +// Stick axis maps - to allow changes for SouthPaw in-game axis mapping +#define AXIS_MAP_LX 0 +#define AXIS_MAP_LY 1 +#define AXIS_MAP_RX 2 +#define AXIS_MAP_RY 3 + +// Trigger map - to allow for swap triggers in-game +#define TRIGGER_MAP_0 0 +#define TRIGGER_MAP_1 1 + class IPlatformInput { public: enum EKeyboardMode { diff --git a/targets/platform/InputActions.h b/targets/platform/input/InputActions.h similarity index 100% rename from targets/platform/InputActions.h rename to targets/platform/input/InputActions.h diff --git a/targets/platform/input/input.h b/targets/platform/input/input.h new file mode 100644 index 000000000..436916435 --- /dev/null +++ b/targets/platform/input/input.h @@ -0,0 +1,3 @@ +#include "IPlatformInput.h" + +extern IPlatformInput& PlatformInput; diff --git a/targets/platform/sdl2/Input.cpp b/targets/platform/input/sdl2/SDL2Input.cpp similarity index 92% rename from targets/platform/sdl2/Input.cpp rename to targets/platform/input/sdl2/SDL2Input.cpp index 2715abfcc..4ec3a48dc 100644 --- a/targets/platform/sdl2/Input.cpp +++ b/targets/platform/input/sdl2/SDL2Input.cpp @@ -1,4 +1,4 @@ -#include "Input.h" +#include "SDL2Input.h" #include #include @@ -20,7 +20,8 @@ #include "../InputActions.h" #include "../PlatformTypes.h" -C_4JInput InputManager; +SDL2Input sdl2_input_instance; +IPlatformInput& PlatformInput = sdl2_input_instance; static const int KEY_COUNT = SDL_NUM_SCANCODES; static const int BTN_COUNT = SDL_CONTROLLER_BUTTON_MAX; @@ -229,7 +230,7 @@ static void TakeSnapIfNeeded() { } } // We initialize the SDL input -void C_4JInput::Initialise(int, unsigned char, unsigned char, unsigned char) { +void SDL2Input::Initialise(int, unsigned char, unsigned char, unsigned char) { if (!s_sdlInitialized) { if (SDL_WasInit(SDL_INIT_VIDEO) == 0) { SDL_Init(SDL_INIT_VIDEO); @@ -279,7 +280,7 @@ static void utf8_pop_back(std::string& str) { // Each tick we update the input state by polling SDL, this is where we get the // kbd and mouse state. -void C_4JInput::Tick() { +void SDL2Input::Tick() { if (!s_sdlInitialized) return; memcpy(s_keysPrev, s_keysCurrent, sizeof(s_keysCurrent)); @@ -374,7 +375,7 @@ void C_4JInput::Tick() { } } -int C_4JInput::GetHotbarSlotPressed(int iPad) { +int SDL2Input::GetHotbarSlotPressed(int iPad) { if (iPad != 0) return -1; constexpr size_t NUM_HOTBAR_SLOTS = 9; @@ -460,7 +461,7 @@ int C_4JInput::GetHotbarSlotPressed(int iPad) { default: \ return false; -bool C_4JInput::ButtonDown(int iPad, unsigned char ucAction) { +bool SDL2Input::ButtonDown(int iPad, unsigned char ucAction) { if (iPad != 0) return false; if (s_keyboardActive) return false; if (ucAction == 255) { @@ -490,7 +491,7 @@ bool C_4JInput::ButtonDown(int iPad, unsigned char ucAction) { } } // The part that handles completing the action of pressing a button. -bool C_4JInput::ButtonPressed(int iPad, unsigned char ucAction) { +bool SDL2Input::ButtonPressed(int iPad, unsigned char ucAction) { if (iPad != 0 || ucAction == 255) return false; if (s_keyboardActive) return false; switch (ucAction) { @@ -516,7 +517,7 @@ bool C_4JInput::ButtonPressed(int iPad, unsigned char ucAction) { } } // The part that handles Releasing a button. -bool C_4JInput::ButtonReleased(int iPad, unsigned char ucAction) { +bool SDL2Input::ButtonReleased(int iPad, unsigned char ucAction) { if (iPad != 0 || ucAction == 255) return false; if (s_keyboardActive) return false; switch (ucAction) { @@ -541,7 +542,7 @@ bool C_4JInput::ButtonReleased(int iPad, unsigned char ucAction) { } } -unsigned int C_4JInput::GetValue(int iPad, unsigned char ucAction, bool) { +unsigned int SDL2Input::GetValue(int iPad, unsigned char ucAction, bool) { if (iPad != 0) return 0; if (ucAction == MINECRAFT_ACTION_LEFT_SCROLL) { if (s_scrollTicksForGetValue > 0) { @@ -563,13 +564,13 @@ unsigned int C_4JInput::GetValue(int iPad, unsigned char ucAction, bool) { } // Left stick movement, the one that moves the player around or selects menu // options. (Soon be tested.) -float C_4JInput::GetJoypadStick_LX(int, bool) { +float SDL2Input::GetJoypadStick_LX(int, bool) { if (ADown(SDL_CONTROLLER_AXIS_LEFTX)) return axisVal[SDL_CONTROLLER_AXIS_LEFTX]; return (KDown(SDL_SCANCODE_D) ? 1.f : 0.f) - (KDown(SDL_SCANCODE_A) ? 1.f : 0.f); } -float C_4JInput::GetJoypadStick_LY(int, bool) { +float SDL2Input::GetJoypadStick_LY(int, bool) { if (ADown(SDL_CONTROLLER_AXIS_LEFTY)) return -axisVal[SDL_CONTROLLER_AXIS_LEFTY]; return (KDown(SDL_SCANCODE_W) ? 1.f : 0.f) - @@ -582,7 +583,7 @@ static float MouseAxis(float raw) { return (raw >= 0.f ? 1.f : -1.f) * sqrtf(fabsf(raw)); } // We apply the Stick movement on the R(Right) X(2D Position) -float C_4JInput::GetJoypadStick_RX(int, bool) { +float SDL2Input::GetJoypadStick_RX(int, bool) { if (ADown(SDL_CONTROLLER_AXIS_RIGHTX)) return axisVal[SDL_CONTROLLER_AXIS_RIGHTX]; if (!SDL_GetRelativeMouseMode()) return 0.f; @@ -590,7 +591,7 @@ float C_4JInput::GetJoypadStick_RX(int, bool) { return MouseAxis(s_snapRelX * MOUSE_SCALE); } // Bis. but with Y(2D Position) -float C_4JInput::GetJoypadStick_RY(int, bool) { +float SDL2Input::GetJoypadStick_RY(int, bool) { if (ADown(SDL_CONTROLLER_AXIS_RIGHTY)) return -axisVal[SDL_CONTROLLER_AXIS_RIGHTY]; if (!SDL_GetRelativeMouseMode()) return 0.f; @@ -598,78 +599,78 @@ float C_4JInput::GetJoypadStick_RY(int, bool) { return MouseAxis(-s_snapRelY * MOUSE_SCALE); } -unsigned char C_4JInput::GetJoypadLTrigger(int, bool) { +unsigned char SDL2Input::GetJoypadLTrigger(int, bool) { return (s_mouseRightCurrent || s_axisCurrent[SDL_CONTROLLER_AXIS_TRIGGERLEFT]) ? 255 : 0; } -unsigned char C_4JInput::GetJoypadRTrigger(int, bool) { +unsigned char SDL2Input::GetJoypadRTrigger(int, bool) { return (s_mouseLeftCurrent || s_axisCurrent[SDL_CONTROLLER_AXIS_TRIGGERRIGHT]) ? 255 : 0; } -int C_4JInput::GetMouseX() { return s_mouseX; } -int C_4JInput::GetMouseY() { return s_mouseY; } +int SDL2Input::GetMouseX() { return s_mouseX; } +int SDL2Input::GetMouseY() { return s_mouseY; } // We detect if a Menu is visible on the player's screen to the mouse being // stuck. -void C_4JInput::SetMenuDisplayed(int iPad, bool bVal) { +void SDL2Input::SetMenuDisplayed(int iPad, bool bVal) { if (iPad >= 0 && iPad < 4) s_menuDisplayed[iPad] = bVal; if (!s_sdlInitialized || bVal == s_prevMenuDisplayed) return; SDL_SetRelativeMouseMode(bVal ? SDL_FALSE : SDL_TRUE); s_prevMenuDisplayed = bVal; } -int C_4JInput::GetScrollDelta() { +int SDL2Input::GetScrollDelta() { int v = s_scrollTicksForButtonPressed; s_scrollTicksForButtonPressed = 0; return v; } -void C_4JInput::SetDeadzoneAndMovementRange(unsigned int, unsigned int) {} -void C_4JInput::SetGameJoypadMaps(unsigned char, unsigned char, unsigned int) {} -unsigned int C_4JInput::GetGameJoypadMaps(unsigned char, unsigned char) { +void SDL2Input::SetDeadzoneAndMovementRange(unsigned int, unsigned int) {} +void SDL2Input::SetGameJoypadMaps(unsigned char, unsigned char, unsigned int) {} +unsigned int SDL2Input::GetGameJoypadMaps(unsigned char, unsigned char) { return 0; } -void C_4JInput::SetJoypadMapVal(int, unsigned char) {} -unsigned char C_4JInput::GetJoypadMapVal(int) { return 0; } -void C_4JInput::SetJoypadSensitivity(int, float) {} -void C_4JInput::SetJoypadStickAxisMap(int, unsigned int, unsigned int) {} -void C_4JInput::SetJoypadStickTriggerMap(int, unsigned int, unsigned int) {} -void C_4JInput::SetKeyRepeatRate(float, float) {} -void C_4JInput::SetDebugSequence(const char*, std::function) {} -float C_4JInput::GetIdleSeconds(int) { return 0.f; } -bool C_4JInput::IsPadConnected(int iPad) { return iPad == 0; } +void SDL2Input::SetJoypadMapVal(int, unsigned char) {} +unsigned char SDL2Input::GetJoypadMapVal(int) { return 0; } +void SDL2Input::SetJoypadSensitivity(int, float) {} +void SDL2Input::SetJoypadStickAxisMap(int, unsigned int, unsigned int) {} +void SDL2Input::SetJoypadStickTriggerMap(int, unsigned int, unsigned int) {} +void SDL2Input::SetKeyRepeatRate(float, float) {} +void SDL2Input::SetDebugSequence(const char*, std::function) {} +float SDL2Input::GetIdleSeconds(int) { return 0.f; } +bool SDL2Input::IsPadConnected(int iPad) { return iPad == 0; } -EKeyboardResult C_4JInput::RequestKeyboard(const wchar_t*, const wchar_t*, int, +EKeyboardResult SDL2Input::RequestKeyboard(const wchar_t*, const wchar_t*, int, unsigned int, std::function callback, - C_4JInput::EKeyboardMode) { + SDL2Input::EKeyboardMode) { s_keyboardActive = true; s_textInputBuf.clear(); s_keyboardCallback = std::move(callback); SDL_StartTextInput(); return EKeyboardResult::Pending; } -bool C_4JInput::GetMenuDisplayed(int iPad) { +bool SDL2Input::GetMenuDisplayed(int iPad) { if (iPad >= 0 && iPad < 4) return s_menuDisplayed[iPad]; return false; } -const char* C_4JInput::GetText() { return s_textInputBuf.c_str(); } -bool C_4JInput::VerifyStrings(wchar_t**, int, +const char* SDL2Input::GetText() { return s_textInputBuf.c_str(); } +bool SDL2Input::VerifyStrings(wchar_t**, int, std::function) { return true; } -void C_4JInput::CancelQueuedVerifyStrings( +void SDL2Input::CancelQueuedVerifyStrings( std::function) {} -void C_4JInput::CancelAllVerifyInProgress() {} +void SDL2Input::CancelAllVerifyInProgress() {} // Primary pad (moved from Profile) namespace { int s_inputPrimaryPad = 0; } -int C_4JInput::GetPrimaryPad() { return s_inputPrimaryPad; } -void C_4JInput::SetPrimaryPad(int iPad) { s_inputPrimaryPad = iPad; } +int SDL2Input::GetPrimaryPad() { return s_inputPrimaryPad; } +void SDL2Input::SetPrimaryPad(int iPad) { s_inputPrimaryPad = iPad; } diff --git a/targets/platform/sdl2/Input.h b/targets/platform/input/sdl2/SDL2Input.h similarity index 73% rename from targets/platform/sdl2/Input.h rename to targets/platform/input/sdl2/SDL2Input.h index 275cc7a6a..d39ef1490 100644 --- a/targets/platform/sdl2/Input.h +++ b/targets/platform/input/sdl2/SDL2Input.h @@ -4,52 +4,7 @@ #include "../IPlatformInput.h" -#define MAP_STYLE_0 0 -#define MAP_STYLE_1 1 -#define MAP_STYLE_2 2 - -#define _360_JOY_BUTTON_A 0x00000001 -#define _360_JOY_BUTTON_B 0x00000002 -#define _360_JOY_BUTTON_X 0x00000004 -#define _360_JOY_BUTTON_Y 0x00000008 - -#define _360_JOY_BUTTON_START 0x00000010 -#define _360_JOY_BUTTON_BACK 0x00000020 -#define _360_JOY_BUTTON_RB 0x00000040 -#define _360_JOY_BUTTON_LB 0x00000080 - -#define _360_JOY_BUTTON_RTHUMB 0x00000100 -#define _360_JOY_BUTTON_LTHUMB 0x00000200 -#define _360_JOY_BUTTON_DPAD_UP 0x00000400 -#define _360_JOY_BUTTON_DPAD_DOWN 0x00000800 - -#define _360_JOY_BUTTON_DPAD_LEFT 0x00001000 -#define _360_JOY_BUTTON_DPAD_RIGHT 0x00002000 -// fake digital versions of analog values -#define _360_JOY_BUTTON_LSTICK_RIGHT 0x00004000 -#define _360_JOY_BUTTON_LSTICK_LEFT 0x00008000 - -#define _360_JOY_BUTTON_RSTICK_DOWN 0x00010000 -#define _360_JOY_BUTTON_RSTICK_UP 0x00020000 -#define _360_JOY_BUTTON_RSTICK_RIGHT 0x00040000 -#define _360_JOY_BUTTON_RSTICK_LEFT 0x00080000 - -#define _360_JOY_BUTTON_LSTICK_DOWN 0x00100000 -#define _360_JOY_BUTTON_LSTICK_UP 0x00200000 -#define _360_JOY_BUTTON_RT 0x00400000 -#define _360_JOY_BUTTON_LT 0x00800000 - -// Stick axis maps - to allow changes for SouthPaw in-game axis mapping -#define AXIS_MAP_LX 0 -#define AXIS_MAP_LY 1 -#define AXIS_MAP_RX 2 -#define AXIS_MAP_RY 3 - -// Trigger map - to allow for swap triggers in-game -#define TRIGGER_MAP_0 0 -#define TRIGGER_MAP_1 1 - -class C_4JInput : public IPlatformInput { +class SDL2Input : public IPlatformInput { public: void Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC); @@ -98,7 +53,7 @@ public: EKeyboardResult RequestKeyboard(const wchar_t* Title, const wchar_t* Text, int iPad, unsigned int uiMaxChars, std::function callback, - C_4JInput::EKeyboardMode eMode); + SDL2Input::EKeyboardMode eMode); bool GetMenuDisplayed(int); const char* GetText(); @@ -140,6 +95,3 @@ public: // bool InputDetected(int userIndex, wchar_t* inputText); }; - -// Singleton -extern C_4JInput InputManager; diff --git a/targets/platform/meson.build b/targets/platform/meson.build index 893bcf60c..c5c5287c3 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -25,7 +25,7 @@ else endif sdl2_sources = files( - 'sdl2/Input.cpp', + 'input/sdl2/SDL2Input.cpp', 'sdl2/Profile.cpp', 'sdl2/Render.cpp', 'sdl2/render_stubs.cpp', diff --git a/targets/platform/sdl2/Profile.cpp b/targets/platform/sdl2/Profile.cpp index d34b501e8..8802da8d8 100644 --- a/targets/platform/sdl2/Profile.cpp +++ b/targets/platform/sdl2/Profile.cpp @@ -5,7 +5,7 @@ #include #include "../ProfileConstants.h" -#include "../sdl2/Input.h" +#include "input/input.h" C_4JProfile ProfileManager; @@ -186,14 +186,12 @@ bool C_4JProfile::CanViewPlayerCreatedContent(int, bool, PlayerUID*, return true; } -// GetPrimaryPad/SetPrimaryPad — delegates to InputManager. +// GetPrimaryPad/SetPrimaryPad — delegates to PlatformPlatft. // Kept here temporarily for call sites that still use ProfileManager. -// These forward to the canonical copies in C_4JInput. +// These forward to the canonical copies in SDL2Input. int C_4JProfile::GetPrimaryPad() { - extern C_4JInput InputManager; - return InputManager.GetPrimaryPad(); + return PlatformInput.GetPrimaryPad(); } void C_4JProfile::SetPrimaryPad(int iPad) { - extern C_4JInput InputManager; - InputManager.SetPrimaryPad(iPad); + PlatformInput.SetPrimaryPad(iPad); } 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 02/15] 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; From 0bdef577f5e9fccd53ae90e58ebcbb6c3a619611 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 12:43:47 -0500 Subject: [PATCH 03/15] reorganize actions/constants for profile and input --- targets/app/common/Game.cpp | 1 - targets/app/common/LocalizationManager.cpp | 1 - .../Tutorial/Constraints/InputConstraint.cpp | 1 - targets/app/common/Tutorial/FullTutorial.cpp | 1 - targets/app/common/Tutorial/Tutorial.cpp | 1 - .../IUIScene_AbstractContainerMenu.cpp | 1 - .../All Platforms/IUIScene_CraftingMenu.cpp | 1 - .../All Platforms/IUIScene_CreativeMenu.cpp | 1 - .../UI/All Platforms/IUIScene_TradingMenu.cpp | 1 - .../UI/Components/UIComponent_Tooltips.h | 1 - .../Debug/UIScene_DebugCreateSchematic.cpp | 1 - .../UI/Scenes/Debug/UIScene_DebugOptions.cpp | 1 - .../UI/Scenes/Debug/UIScene_DebugOverlay.cpp | 1 - .../Scenes/Debug/UIScene_DebugSetCamera.cpp | 1 - .../UIScene_CreateWorldMenu.cpp | 1 - .../UIScene_DLCMainMenu.cpp | 1 - .../UIScene_DLCOffersMenu.cpp | 1 - .../Frontend Menu screens/UIScene_EULA.cpp | 1 - .../Frontend Menu screens/UIScene_Intro.cpp | 1 - .../UIScene_JoinMenu.cpp | 1 - .../UIScene_LaunchMoreOptionsMenu.cpp | 1 - .../UIScene_LeaderboardsMenu.cpp | 1 - .../UIScene_LoadMenu.cpp | 1 - .../UIScene_LoadOrJoinMenu.cpp | 1 - .../UIScene_MainMenu.cpp | 1 - .../UIScene_NewUpdateMessage.cpp | 1 - .../UIScene_SaveMessage.cpp | 1 - .../UIScene_TrialExitUpsell.cpp | 1 - .../Help & Options/UIScene_ControlsMenu.cpp | 1 - .../Scenes/Help & Options/UIScene_Credits.cpp | 1 - .../UIScene_HelpAndOptionsMenu.cpp | 1 - .../Help & Options/UIScene_HowToPlay.cpp | 1 - .../Help & Options/UIScene_HowToPlayMenu.cpp | 1 - .../UIScene_LanguageSelector.cpp | 1 - .../Help & Options/UIScene_ReinstallMenu.cpp | 1 - .../UIScene_SettingsAudioMenu.cpp | 1 - .../UIScene_SettingsControlMenu.cpp | 1 - .../UIScene_SettingsGraphicsMenu.cpp | 1 - .../Help & Options/UIScene_SettingsMenu.cpp | 1 - .../UIScene_SettingsOptionsMenu.cpp | 1 - .../Help & Options/UIScene_SettingsUIMenu.cpp | 1 - .../Help & Options/UIScene_SkinSelectMenu.cpp | 1 - .../UIScene_AbstractContainerMenu.cpp | 1 - .../Containers/UIScene_TradingMenu.cpp | 1 - .../UIScene_CraftingMenu.cpp | 1 - .../UIScene_DeathMenu.cpp | 1 - .../In-Game Menu Screens/UIScene_EndPoem.cpp | 1 - .../UIScene_InGameHostOptionsMenu.cpp | 1 - .../UIScene_InGameInfoMenu.cpp | 1 - .../UIScene_InGamePlayerOptionsMenu.cpp | 1 - .../UIScene_PauseMenu.cpp | 1 - .../UIScene_SignEntryMenu.cpp | 1 - .../UIScene_TeleportMenu.cpp | 1 - .../UI/Scenes/UIScene_ConnectingProgress.cpp | 1 - .../UI/Scenes/UIScene_FullscreenProgress.cpp | 1 - .../app/common/UI/Scenes/UIScene_Keyboard.cpp | 1 - .../common/UI/Scenes/UIScene_MessageBox.cpp | 1 - .../UI/Scenes/UIScene_QuadrantSignin.cpp | 1 - targets/app/common/UI/UIController.h | 2 +- targets/app/common/UI/UIScene.cpp | 1 - targets/app/linux/Linux_Minecraft.cpp | 1 - targets/app/linux/Linux_UIController.h | 1 + targets/minecraft/client/Minecraft.cpp | 1 - targets/minecraft/client/gui/Screen.cpp | 1 - .../gui/inventory/CreativeInventoryScreen.cpp | 1 - targets/minecraft/client/player/Input.cpp | 1 - .../minecraft/client/player/LocalPlayer.cpp | 1 - targets/platform/PlatformServices.cpp | 2 - targets/platform/input/IPlatformInput.h | 46 +------------------ .../{InputActions.h => InputConstants.h} | 45 ++++++++++++++++++ targets/platform/input/sdl2/SDL2Input.cpp | 2 +- targets/platform/profile/IPlatformProfile.h | 25 ---------- targets/platform/profile/ProfileConstants.h | 44 +++++++++--------- targets/platform/profile/profile.h | 1 + targets/platform/profile/stub/StubProfile.cpp | 2 + 75 files changed, 74 insertions(+), 161 deletions(-) rename targets/platform/input/{InputActions.h => InputConstants.h} (53%) diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 5b0cb2de6..7dd456d9f 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -2,7 +2,6 @@ #include "app/common/Game.h" #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index cb5244516..7c17e7e83 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -16,7 +16,6 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/sdl2/Render.h" #include "platform/XboxStubs.h" diff --git a/targets/app/common/Tutorial/Constraints/InputConstraint.cpp b/targets/app/common/Tutorial/Constraints/InputConstraint.cpp index fd63b22d7..92790a289 100644 --- a/targets/app/common/Tutorial/Constraints/InputConstraint.cpp +++ b/targets/app/common/Tutorial/Constraints/InputConstraint.cpp @@ -1,6 +1,5 @@ #include "InputConstraint.h" -#include "platform/input/InputActions.h" #include "platform/input/input.h" bool InputConstraint::isMappingConstrained(int iPad, int mapping) { diff --git a/targets/app/common/Tutorial/FullTutorial.cpp b/targets/app/common/Tutorial/FullTutorial.cpp index 4d6fbe1e9..9d357652c 100644 --- a/targets/app/common/Tutorial/FullTutorial.cpp +++ b/targets/app/common/Tutorial/FullTutorial.cpp @@ -3,7 +3,6 @@ #include #include -#include "platform/input/InputActions.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "app/common/Tutorial/Constraints/AreaConstraint.h" #include "app/common/Tutorial/Constraints/ChangeStateConstraint.h" diff --git a/targets/app/common/Tutorial/Tutorial.cpp b/targets/app/common/Tutorial/Tutorial.cpp index af24d08ea..e477c1ae4 100644 --- a/targets/app/common/Tutorial/Tutorial.cpp +++ b/targets/app/common/Tutorial/Tutorial.cpp @@ -6,7 +6,6 @@ #include #include -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index b58e60814..068e0206f 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -7,7 +7,6 @@ #include #include -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/sdl2/Render.h" #include "minecraft/GameEnums.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index d3ef721d0..d489b96c4 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -7,7 +7,6 @@ #include #include -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "minecraft/GameEnums.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp index a446a4a46..920582a1f 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp @@ -6,7 +6,6 @@ #include #include -#include "platform/input/InputActions.h" #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp index c67cc7e70..31cebcfc9 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp @@ -4,7 +4,6 @@ #include -#include "platform/input/InputActions.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.h b/targets/app/common/UI/Components/UIComponent_Tooltips.h index b0d59aa8c..c9ec16229 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.h +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.h @@ -3,7 +3,6 @@ #include #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/sdl2/Render.h" #include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIEnums.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index 6172541a8..21bfdb274 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -3,7 +3,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp index 7a102e0ae..d42483a53 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp @@ -1,6 +1,5 @@ #include "UIScene_DebugOptions.h" -#include "platform/input/InputActions.h" #include "app/common/Console_Debug_enum.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index f9ddf23d8..a169bbf51 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -5,7 +5,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index 855d9fa3d..5d77ae589 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -5,7 +5,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" 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 7f900f8b7..50beae266 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 @@ -7,7 +7,6 @@ #include #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "app/common/App_Defines.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp index 62cce0128..21f38703c 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp @@ -1,7 +1,6 @@ #include "UIScene_DLCMainMenu.h" -#include "platform/input/InputActions.h" #include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp index 61d7a1b25..b137ded49 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp @@ -4,7 +4,6 @@ #include #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/sdl2/Render.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_DLCList.h" 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 e9b9a972e..85cdd36cd 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 @@ -4,7 +4,6 @@ #include #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "app/common/App_Defines.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp index 138ef39bb..08a72f7fa 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp @@ -1,6 +1,5 @@ #include "UIScene_Intro.h" -#include "platform/input/InputActions.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" 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 196f1bde0..96af029b0 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 @@ -5,7 +5,6 @@ #include #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" 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 4109cae26..a92076a31 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 @@ -4,7 +4,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" 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 672f68b84..719b34536 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 @@ -8,7 +8,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Leaderboards/LeaderboardInterface.h" 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 e9206060b..3530b084b 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 @@ -5,7 +5,6 @@ #include #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" 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 88e565f95..d78366689 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 @@ -6,7 +6,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "app/common/App_Defines.h" 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 4db7251e5..896d14489 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 @@ -7,7 +7,6 @@ #include #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp index bc11fc542..1129f0402 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp @@ -3,7 +3,6 @@ #include -#include "platform/input/InputActions.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" 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 f30704895..d28a3ecf7 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 @@ -2,7 +2,6 @@ #include "UIScene_SaveMessage.h" #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "app/common/App_Defines.h" 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 656f849d0..aebbdef45 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 @@ -1,7 +1,6 @@ #include "UIScene_TrialExitUpsell.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "app/common/App_Defines.h" #include "app/common/UI/UIScene.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp index f348711ae..ec2a5d1f3 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp @@ -4,7 +4,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "minecraft/GameEnums.h" #include "app/common/BuildVer/BuildVer.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp index 8d60b0a33..6691f4bde 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp @@ -4,7 +4,6 @@ #include #include -#include "platform/input/InputActions.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" 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 009710a2b..5dabd1970 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp @@ -1,7 +1,6 @@ #include "UIScene_HelpAndOptionsMenu.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp index f8030cd5d..132fc8dca 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp @@ -6,7 +6,6 @@ #include -#include "platform/input/InputActions.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp index 0b06c417a..d85e378e0 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp @@ -3,7 +3,6 @@ #include -#include "platform/input/InputActions.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp index 9f4a3cc83..04eefddb5 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp @@ -1,6 +1,5 @@ #include "UIScene_LanguageSelector.h" -#include "platform/input/InputActions.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp index 173ddd7d9..dd5744486 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp @@ -1,7 +1,6 @@ #include "UIScene_ReinstallMenu.h" -#include "platform/input/InputActions.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp index d4a7a677c..26985f984 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp @@ -3,7 +3,6 @@ #include -#include "platform/input/InputActions.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp index 2b00fb243..6253885c7 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp @@ -2,7 +2,6 @@ #include -#include "platform/input/InputActions.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" 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 afececfb9..06cf9378a 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp @@ -2,7 +2,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" 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 931d26cdb..d69287aca 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp @@ -1,7 +1,6 @@ #include "UIScene_SettingsMenu.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" 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 442fa90d1..c41edec49 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp @@ -3,7 +3,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "minecraft/GameEnums.h" 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 c5ef9709b..75a502653 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp @@ -3,7 +3,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" 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 2b6b36740..9bbedf0eb 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -5,7 +5,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "app/common/App_Defines.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp index 32ec0ad59..21fce9209 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp @@ -4,7 +4,6 @@ #include #include -#include "platform/input/InputActions.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.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 3cbc49aea..13c05ad46 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 @@ -5,7 +5,6 @@ #include #include -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.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 27dd4b07a..f62f84c53 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 @@ -1,7 +1,6 @@ #include "UIScene_CraftingMenu.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.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 03a42c411..2e2ce00ad 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 @@ -3,7 +3,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "platform/sdl2/Storage.h" #include "minecraft/GameEnums.h" 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 cfc1b8f36..3a134ac1c 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 @@ -7,7 +7,6 @@ #include #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp index 394246c94..3f98e1319 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp @@ -3,7 +3,6 @@ #include -#include "platform/input/InputActions.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/NetworkPlayerInterface.h" 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 814e015d0..8e2a3358b 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 @@ -3,7 +3,6 @@ #include #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Console_Debug_enum.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp index 05fa69ef0..f22a2fe04 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp @@ -3,7 +3,6 @@ #include -#include "platform/input/InputActions.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/NetworkPlayerInterface.h" 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 9e1199570..f3d26fe92 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 @@ -5,7 +5,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp index bb7f91a6c..75bfb83f2 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp @@ -1,7 +1,6 @@ #include "UIScene_SignEntryMenu.h" -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp index 9b5a14269..33a08b6dd 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp @@ -3,7 +3,6 @@ #include -#include "platform/input/InputActions.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/NetworkPlayerInterface.h" diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp index 1645893d6..fa5325bb7 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp @@ -1,7 +1,6 @@ #include "UIScene_ConnectingProgress.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index ee69a4b49..83033654c 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -5,7 +5,6 @@ #include #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" diff --git a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp index c93d5be06..db1538ee4 100644 --- a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp +++ b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp @@ -1,6 +1,5 @@ #include "UIScene_Keyboard.h" -#include "platform/input/InputActions.h" #include "app/common/App_Defines.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp index 3b17861cd..7068b8c65 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp @@ -2,7 +2,6 @@ #include "UIScene_MessageBox.h" #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" diff --git a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp index ff9dc3e1e..cc96f8117 100644 --- a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp @@ -4,7 +4,6 @@ #include #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index cf808ed11..04dc7f98f 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -21,7 +21,7 @@ #endif #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" +#include "platform/input/input.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" #include "app/common/UI/All Platforms/IUIController.h" diff --git a/targets/app/common/UI/UIScene.cpp b/targets/app/common/UI/UIScene.cpp index efb0da2f0..71e857a65 100644 --- a/targets/app/common/UI/UIScene.cpp +++ b/targets/app/common/UI/UIScene.cpp @@ -5,7 +5,6 @@ #include #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/sdl2/Render.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index e25e79b58..84a6669a7 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -54,7 +54,6 @@ static void sigsegv_handler(int sig) { // #include "../Common/XUI/XUI_Scene_Container.h" // #include "NetworkManager.h" #include "platform/PlatformTypes.h" -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" diff --git a/targets/app/linux/Linux_UIController.h b/targets/app/linux/Linux_UIController.h index 09f5dfc30..ca59ed540 100644 --- a/targets/app/linux/Linux_UIController.h +++ b/targets/app/linux/Linux_UIController.h @@ -4,6 +4,7 @@ #include "app/common/UI/UIController.h" #include "app/linux/Iggy/include/iggy.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/profile/profile.h" class ConsoleUIController : public UIController { public: diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index e71d92634..9be44bec7 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -13,7 +13,6 @@ #include #include -#include "platform/input/InputActions.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" #include "platform/sdl2/Storage.h" diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index 7d2bcd549..0363f767a 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -1,7 +1,6 @@ #include "minecraft/IGameServices.h" #include "Screen.h" -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "Button.h" diff --git a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp index cf90fe3b4..ee0cb7559 100644 --- a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp @@ -6,7 +6,6 @@ #include #include -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/sdl2/Render.h" #include "AbstractContainerScreen.h" diff --git a/targets/minecraft/client/player/Input.cpp b/targets/minecraft/client/player/Input.cpp index c9973d902..3dded71b6 100644 --- a/targets/minecraft/client/player/Input.cpp +++ b/targets/minecraft/client/player/Input.cpp @@ -3,7 +3,6 @@ #include -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "LocalPlayer.h" #include "minecraft/GameEnums.h" diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index 8d71a91ff..7f5610f03 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -28,7 +28,6 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" // 4J Stu - Added for tutorial callbacks -#include "platform/input/InputActions.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" diff --git a/targets/platform/PlatformServices.cpp b/targets/platform/PlatformServices.cpp index cde97296c..0963a3e75 100644 --- a/targets/platform/PlatformServices.cpp +++ b/targets/platform/PlatformServices.cpp @@ -1,13 +1,11 @@ #include "PlatformServices.h" #include "StdFileIO.h" -#include "sdl2/Profile.h" #include "sdl2/Render.h" #include "sdl2/Storage.h" static StdFileIO s_stdFileIO; IPlatformFileIO& PlatformFileIO = s_stdFileIO; -IPlatformProfile& PlatformProfile = PlatformProfile; IPlatformRenderer& PlatformRender = RenderManager; IPlatformStorage& PlatformStorage = StorageManager; diff --git a/targets/platform/input/IPlatformInput.h b/targets/platform/input/IPlatformInput.h index 8b20b0c15..4fe09aa4e 100644 --- a/targets/platform/input/IPlatformInput.h +++ b/targets/platform/input/IPlatformInput.h @@ -3,51 +3,7 @@ #include #include "PlatformTypes.h" - -#define MAP_STYLE_0 0 -#define MAP_STYLE_1 1 -#define MAP_STYLE_2 2 - -#define _360_JOY_BUTTON_A 0x00000001 -#define _360_JOY_BUTTON_B 0x00000002 -#define _360_JOY_BUTTON_X 0x00000004 -#define _360_JOY_BUTTON_Y 0x00000008 - -#define _360_JOY_BUTTON_START 0x00000010 -#define _360_JOY_BUTTON_BACK 0x00000020 -#define _360_JOY_BUTTON_RB 0x00000040 -#define _360_JOY_BUTTON_LB 0x00000080 - -#define _360_JOY_BUTTON_RTHUMB 0x00000100 -#define _360_JOY_BUTTON_LTHUMB 0x00000200 -#define _360_JOY_BUTTON_DPAD_UP 0x00000400 -#define _360_JOY_BUTTON_DPAD_DOWN 0x00000800 - -#define _360_JOY_BUTTON_DPAD_LEFT 0x00001000 -#define _360_JOY_BUTTON_DPAD_RIGHT 0x00002000 -// fake digital versions of analog values -#define _360_JOY_BUTTON_LSTICK_RIGHT 0x00004000 -#define _360_JOY_BUTTON_LSTICK_LEFT 0x00008000 - -#define _360_JOY_BUTTON_RSTICK_DOWN 0x00010000 -#define _360_JOY_BUTTON_RSTICK_UP 0x00020000 -#define _360_JOY_BUTTON_RSTICK_RIGHT 0x00040000 -#define _360_JOY_BUTTON_RSTICK_LEFT 0x00080000 - -#define _360_JOY_BUTTON_LSTICK_DOWN 0x00100000 -#define _360_JOY_BUTTON_LSTICK_UP 0x00200000 -#define _360_JOY_BUTTON_RT 0x00400000 -#define _360_JOY_BUTTON_LT 0x00800000 - -// Stick axis maps - to allow changes for SouthPaw in-game axis mapping -#define AXIS_MAP_LX 0 -#define AXIS_MAP_LY 1 -#define AXIS_MAP_RX 2 -#define AXIS_MAP_RY 3 - -// Trigger map - to allow for swap triggers in-game -#define TRIGGER_MAP_0 0 -#define TRIGGER_MAP_1 1 +#include "InputConstants.h" class IPlatformInput { public: diff --git a/targets/platform/input/InputActions.h b/targets/platform/input/InputConstants.h similarity index 53% rename from targets/platform/input/InputActions.h rename to targets/platform/input/InputConstants.h index af4adf768..dabd6b6a9 100644 --- a/targets/platform/input/InputActions.h +++ b/targets/platform/input/InputConstants.h @@ -1,5 +1,50 @@ #pragma once +#define MAP_STYLE_0 0 +#define MAP_STYLE_1 1 +#define MAP_STYLE_2 2 + +#define _360_JOY_BUTTON_A 0x00000001 +#define _360_JOY_BUTTON_B 0x00000002 +#define _360_JOY_BUTTON_X 0x00000004 +#define _360_JOY_BUTTON_Y 0x00000008 + +#define _360_JOY_BUTTON_START 0x00000010 +#define _360_JOY_BUTTON_BACK 0x00000020 +#define _360_JOY_BUTTON_RB 0x00000040 +#define _360_JOY_BUTTON_LB 0x00000080 + +#define _360_JOY_BUTTON_RTHUMB 0x00000100 +#define _360_JOY_BUTTON_LTHUMB 0x00000200 +#define _360_JOY_BUTTON_DPAD_UP 0x00000400 +#define _360_JOY_BUTTON_DPAD_DOWN 0x00000800 + +#define _360_JOY_BUTTON_DPAD_LEFT 0x00001000 +#define _360_JOY_BUTTON_DPAD_RIGHT 0x00002000 +// fake digital versions of analog values +#define _360_JOY_BUTTON_LSTICK_RIGHT 0x00004000 +#define _360_JOY_BUTTON_LSTICK_LEFT 0x00008000 + +#define _360_JOY_BUTTON_RSTICK_DOWN 0x00010000 +#define _360_JOY_BUTTON_RSTICK_UP 0x00020000 +#define _360_JOY_BUTTON_RSTICK_RIGHT 0x00040000 +#define _360_JOY_BUTTON_RSTICK_LEFT 0x00080000 + +#define _360_JOY_BUTTON_LSTICK_DOWN 0x00100000 +#define _360_JOY_BUTTON_LSTICK_UP 0x00200000 +#define _360_JOY_BUTTON_RT 0x00400000 +#define _360_JOY_BUTTON_LT 0x00800000 + +// Stick axis maps - to allow changes for SouthPaw in-game axis mapping +#define AXIS_MAP_LX 0 +#define AXIS_MAP_LY 1 +#define AXIS_MAP_RX 2 +#define AXIS_MAP_RY 3 + +// Trigger map - to allow for swap triggers in-game +#define TRIGGER_MAP_0 0 +#define TRIGGER_MAP_1 1 + enum EControllerActions { ACTION_MENU_A, ACTION_MENU_B, diff --git a/targets/platform/input/sdl2/SDL2Input.cpp b/targets/platform/input/sdl2/SDL2Input.cpp index 4ec3a48dc..54d1b1ba4 100644 --- a/targets/platform/input/sdl2/SDL2Input.cpp +++ b/targets/platform/input/sdl2/SDL2Input.cpp @@ -17,7 +17,7 @@ #include #include -#include "../InputActions.h" +#include "../InputConstants.h" #include "../PlatformTypes.h" SDL2Input sdl2_input_instance; diff --git a/targets/platform/profile/IPlatformProfile.h b/targets/platform/profile/IPlatformProfile.h index 65f35bc3d..dd7d428f6 100644 --- a/targets/platform/profile/IPlatformProfile.h +++ b/targets/platform/profile/IPlatformProfile.h @@ -8,31 +8,6 @@ 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/profile/ProfileConstants.h b/targets/platform/profile/ProfileConstants.h index 8bdb8ae40..6ae5cec98 100644 --- a/targets/platform/profile/ProfileConstants.h +++ b/targets/platform/profile/ProfileConstants.h @@ -1,26 +1,26 @@ #pragma once -#include +#define TITLEID_MINECRAFT 0x584111F7 -inline constexpr int TUTORIAL_PROFILE_STORAGE_BITS = 512; -inline constexpr int TUTORIAL_PROFILE_STORAGE_BYTES = - TUTORIAL_PROFILE_STORAGE_BITS / 8; +#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 -inline constexpr int MAX_FAVORITE_SKINS = 10; - -inline constexpr std::uint32_t GAMESETTING_CLOUDS = 0x00000001; -inline constexpr std::uint32_t GAMESETTING_ONLINE = 0x00000002; -inline constexpr std::uint32_t GAMESETTING_FRIENDSOFFRIENDS = 0x00000008; -inline constexpr std::uint32_t GAMESETTING_DISPLAYUPDATEMSG = 0x00000030; -inline constexpr std::uint32_t GAMESETTING_BEDROCKFOG = 0x00000040; -inline constexpr std::uint32_t GAMESETTING_DISPLAYHUD = 0x00000080; -inline constexpr std::uint32_t GAMESETTING_DISPLAYHAND = 0x00000100; -inline constexpr std::uint32_t GAMESETTING_CUSTOMSKINANIM = 0x00000200; -inline constexpr std::uint32_t GAMESETTING_DEATHMESSAGES = 0x00000400; -inline constexpr std::uint32_t GAMESETTING_UISIZE = 0x00001800; -inline constexpr std::uint32_t GAMESETTING_UISIZE_SPLITSCREEN = 0x00006000; -inline constexpr std::uint32_t GAMESETTING_ANIMATEDCHARACTER = 0x00008000; -inline constexpr std::uint32_t GAMESETTING_PS3EULAREAD = 0x00010000; -inline constexpr std::uint32_t GAMESETTING_PSVITANETWORKMODEADHOC = 0x00020000; - -inline constexpr unsigned char MINECRAFT_LANGUAGE_DEFAULT = 0x00; +#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 diff --git a/targets/platform/profile/profile.h b/targets/platform/profile/profile.h index 1b8c70631..7b23288c8 100644 --- a/targets/platform/profile/profile.h +++ b/targets/platform/profile/profile.h @@ -1,3 +1,4 @@ #include "IPlatformProfile.h" +#include "ProfileConstants.h" extern IPlatformProfile& PlatformProfile; diff --git a/targets/platform/profile/stub/StubProfile.cpp b/targets/platform/profile/stub/StubProfile.cpp index a851a7f1b..1bc200e75 100644 --- a/targets/platform/profile/stub/StubProfile.cpp +++ b/targets/platform/profile/stub/StubProfile.cpp @@ -6,6 +6,8 @@ #include "../ProfileConstants.h" #include "input/input.h" +#include "../../../app/common/Tutorial/TutorialEnum.h" // 4jcraft TODO +#include "../../../app/common/App_Defines.h" // 4jcraft TODO StubProfile stub_profile_instance; IPlatformProfile& PlatformProfile = stub_profile_instance; From 28931d538026dffb214b16bccb02273528fcee01 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 14:43:07 -0500 Subject: [PATCH 04/15] split out platform/storage --- targets/app/common/App_structs.h | 8 +- targets/app/common/Audio/SoundEngine.cpp | 2 +- targets/app/common/BannedListManager.cpp | 2 +- targets/app/common/DLC/DLCAudioFile.cpp | 12 +- targets/app/common/DLC/DLCManager.cpp | 34 ++-- targets/app/common/DLCController.cpp | 32 ++-- targets/app/common/DLCController.h | 6 +- targets/app/common/Game.cpp | 14 +- targets/app/common/Game.h | 40 ++--- .../LevelGenerationOptions.cpp | 6 +- targets/app/common/GameSettingsManager.cpp | 4 +- targets/app/common/GameSettingsManager.h | 2 +- targets/app/common/Game_XuiActions.cpp | 32 ++-- targets/app/common/MenuController.cpp | 20 +-- targets/app/common/MenuController.h | 16 +- .../app/common/Network/GameNetworkManager.cpp | 6 +- targets/app/common/NetworkController.cpp | 34 ++-- targets/app/common/NetworkController.h | 16 +- .../common/UI/All Platforms/IUIController.h | 4 +- .../UI/All Platforms/IUIScene_PauseMenu.cpp | 42 ++--- .../UI/All Platforms/IUIScene_PauseMenu.h | 18 +- .../app/common/UI/All Platforms/UIStructs.h | 4 +- .../IUIScene_StartGame.cpp | 10 +- .../IUIScene_StartGame.h | 8 +- .../UIScene_CreateWorldMenu.cpp | 8 +- .../UIScene_CreateWorldMenu.h | 6 +- .../UIScene_DLCMainMenu.cpp | 2 +- .../UIScene_DLCMainMenu.h | 4 +- .../UIScene_DLCOffersMenu.cpp | 6 +- .../UIScene_DLCOffersMenu.h | 4 +- .../UIScene_JoinMenu.cpp | 2 +- .../Frontend Menu screens/UIScene_JoinMenu.h | 4 +- .../UIScene_LeaderboardsMenu.cpp | 2 +- .../UIScene_LeaderboardsMenu.h | 4 +- .../UIScene_LoadMenu.cpp | 64 ++++---- .../Frontend Menu screens/UIScene_LoadMenu.h | 12 +- .../UIScene_LoadOrJoinMenu.cpp | 154 +++++++++--------- .../UIScene_LoadOrJoinMenu.h | 16 +- .../UIScene_MainMenu.cpp | 20 +-- .../Frontend Menu screens/UIScene_MainMenu.h | 6 +- .../UIScene_HelpAndOptionsMenu.cpp | 4 +- .../Help & Options/UIScene_SettingsMenu.cpp | 4 +- .../Help & Options/UIScene_SettingsMenu.h | 4 +- .../Help & Options/UIScene_SkinSelectMenu.cpp | 4 +- .../Help & Options/UIScene_SkinSelectMenu.h | 4 +- .../UIScene_DeathMenu.cpp | 4 +- .../UIScene_InGameInfoMenu.cpp | 4 +- .../UIScene_InGameInfoMenu.h | 4 +- .../UIScene_InGamePlayerOptionsMenu.cpp | 4 +- .../UIScene_InGamePlayerOptionsMenu.h | 4 +- .../UIScene_InGameSaveManagementMenu.cpp | 40 ++--- .../UIScene_InGameSaveManagementMenu.h | 2 +- .../UIScene_PauseMenu.cpp | 12 +- .../In-Game Menu Screens/UIScene_PauseMenu.h | 4 +- .../common/UI/Scenes/UIScene_MessageBox.cpp | 12 +- .../app/common/UI/Scenes/UIScene_MessageBox.h | 4 +- targets/app/common/UI/UIController.cpp | 36 ++-- targets/app/common/UI/UIController.h | 24 +-- targets/app/linux/LinuxGame.cpp | 6 +- targets/app/linux/Linux_Minecraft.cpp | 10 +- targets/app/windows/Windows64_App.cpp | 4 +- .../app/windows/src/Windows64_Minecraft.cpp | 2 +- targets/java/src/File.cpp | 2 +- targets/minecraft/client/Minecraft.cpp | 4 +- .../client/gui/CreateWorldScreen.cpp | 6 +- .../client/multiplayer/ClientConnection.cpp | 10 +- .../client/multiplayer/ClientConnection.h | 6 +- .../minecraft/client/skins/DLCTexturePack.cpp | 6 +- targets/minecraft/server/MinecraftServer.cpp | 6 +- .../minecraft/server/level/ServerLevel.cpp | 8 +- .../server/network/PendingConnection.cpp | 4 +- .../ConsoleSaveFileOriginal.cpp | 4 +- .../ConsoleSaveFileSplit.cpp | 4 +- .../level/storage/DirectoryLevelStorage.cpp | 2 +- targets/platform/PlatformServices.cpp | 2 - targets/platform/PlatformServices.h | 2 - targets/platform/ShutdownManager.h | 2 +- targets/platform/meson.build | 2 +- .../platform/{ => storage}/IPlatformStorage.h | 43 ++++- targets/platform/storage/storage.h | 3 + .../stub/StubStorage.cpp} | 141 ++++++++-------- .../Storage.h => storage/stub/StubStorage.h} | 89 +++------- 82 files changed, 611 insertions(+), 617 deletions(-) rename targets/platform/{ => storage}/IPlatformStorage.h (90%) create mode 100644 targets/platform/storage/storage.h rename targets/platform/{sdl2/Storage.cpp => storage/stub/StubStorage.cpp} (51%) rename targets/platform/{sdl2/Storage.h => storage/stub/StubStorage.h} (77%) diff --git a/targets/app/common/App_structs.h b/targets/app/common/App_structs.h index 408db6ccf..4ffa65c1e 100644 --- a/targets/app/common/App_structs.h +++ b/targets/app/common/App_structs.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" @@ -171,10 +171,10 @@ typedef struct _DLCRequest { typedef struct _TMSPPRequest { eTMSContentState eState; eDLCContentType eType; - C4JStorage::eGlobalStorage eStorageFacility; - C4JStorage::eTMS_FILETYPEVAL eFileTypeVal; + IPlatformStorage::eGlobalStorage eStorageFacility; + IPlatformStorage::eTMS_FILETYPEVAL eFileTypeVal; // char szFilename[MAX_TMSFILENAME_SIZE]; - int (*CallbackFunc)(void*, int, int, C4JStorage::PTMSPP_FILEDATA, + int (*CallbackFunc)(void*, int, int, IPlatformStorage::PTMSPP_FILEDATA, const char* szFilename); wchar_t wchFilename[MAX_TMSFILENAME_SIZE]; diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index 66ea8b8af..3eee15e86 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -1470,7 +1470,7 @@ void SoundEngine::playMusicUpdate() { std::string strFile = "TPACK:\\Data\\" + string(szName) + ".binka"; std::string mountedPath = - StorageManager.GetMountedPath(strFile); + PlatformStorage.GetMountedPath(strFile); strcpy(m_szStreamName, mountedPath.c_str()); } else { SetIsPlayingStreamingGameMusic(false); diff --git a/targets/app/common/BannedListManager.cpp b/targets/app/common/BannedListManager.cpp index d7171781c..216c1637b 100644 --- a/targets/app/common/BannedListManager.cpp +++ b/targets/app/common/BannedListManager.cpp @@ -56,7 +56,7 @@ void BannedListManager::addLevel(int iPad, PlayerUID xuid, // 4J-PB - write to TMS++ now // bool - // bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(std::uint8_t*)pBannedList, + // bRes=PlatformStorage.WriteTMSFile(iPad,IPlatformStorage::eGlobalStorage_TitleUser,L"BannedList",(std::uint8_t*)pBannedList, // dwDataBytes); delete[] pBannedList; diff --git a/targets/app/common/DLC/DLCAudioFile.cpp b/targets/app/common/DLC/DLCAudioFile.cpp index b7042a45e..cbe684142 100644 --- a/targets/app/common/DLC/DLCAudioFile.cpp +++ b/targets/app/common/DLC/DLCAudioFile.cpp @@ -6,7 +6,7 @@ #include #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" @@ -53,19 +53,19 @@ void ReadAudioDlcStruct(T* out, const std::uint8_t* data, } inline unsigned int AudioParamAdvance(unsigned int wcharCount) { - return static_cast(sizeof(C4JStorage::DLC_FILE_PARAM) + + return static_cast(sizeof(IPlatformStorage::DLC_FILE_PARAM) + wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE); } inline unsigned int AudioDetailAdvance(unsigned int wcharCount) { - return static_cast(sizeof(C4JStorage::DLC_FILE_DETAILS) + + return static_cast(sizeof(IPlatformStorage::DLC_FILE_DETAILS) + wcharCount * AUDIO_DLC_WCHAR_BIN_SIZE); } inline std::wstring ReadAudioParamString(const std::uint8_t* data, unsigned int offset) { return ReadAudioDlcWString(data + offset + - offsetof(C4JStorage::DLC_FILE_PARAM, wchData)); + offsetof(IPlatformStorage::DLC_FILE_PARAM, wchData)); } } // namespace @@ -196,7 +196,7 @@ bool DLCAudioFile::processDLCDataFile(std::uint8_t* pbData, unsigned int uiParameterTypeCount = ReadAudioDlcValue(pbData, uiCurrentByte); uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_PARAM paramBuf; + IPlatformStorage::DLC_FILE_PARAM paramBuf; ReadAudioDlcStruct(¶mBuf, pbData, uiCurrentByte); for (unsigned int i = 0; i < uiParameterTypeCount; i++) { @@ -214,7 +214,7 @@ bool DLCAudioFile::processDLCDataFile(std::uint8_t* pbData, unsigned int uiFileCount = ReadAudioDlcValue(pbData, uiCurrentByte); uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_DETAILS fileBuf; + IPlatformStorage::DLC_FILE_DETAILS fileBuf; ReadAudioDlcStruct(&fileBuf, pbData, uiCurrentByte); unsigned int tempByteOffset = uiCurrentByte; diff --git a/targets/app/common/DLC/DLCManager.cpp b/targets/app/common/DLC/DLCManager.cpp index a9dedfd62..c40c7c7dd 100644 --- a/targets/app/common/DLC/DLCManager.cpp +++ b/targets/app/common/DLC/DLCManager.cpp @@ -14,7 +14,7 @@ #include #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "DLCFile.h" #include "DLCPack.h" #include "app/common/GameRules/GameRuleManager.h" @@ -69,9 +69,9 @@ static_assert(sizeof(wchar_t) == 2, #endif #define DLC_PARAM_ADV(n) \ - (sizeof(C4JStorage::DLC_FILE_PARAM) + (n) * DLC_WCHAR_BIN_SIZE) + (sizeof(IPlatformStorage::DLC_FILE_PARAM) + (n) * DLC_WCHAR_BIN_SIZE) #define DLC_DETAIL_ADV(n) \ - (sizeof(C4JStorage::DLC_FILE_DETAILS) + (n) * DLC_WCHAR_BIN_SIZE) + (sizeof(IPlatformStorage::DLC_FILE_DETAILS) + (n) * DLC_WCHAR_BIN_SIZE) namespace { template @@ -90,7 +90,7 @@ std::wstring getMountedDlcReadPath(const std::string& path) { std::wstring readPath = convStringToWstring(path); #if defined(_WINDOWS64) - const std::string mountedPath = StorageManager.GetMountedPath(path.c_str()); + const std::string mountedPath = PlatformStorage.GetMountedPath(path.c_str()); if (!mountedPath.empty()) { readPath = convStringToWstring(mountedPath); } @@ -359,12 +359,12 @@ unsigned int DLCManager::checkForCorruptDLCAndAlert( swprintf(wchFormat, 132, L"%ls\n\n%%ls", firstCorruptPack->getName().c_str()); - C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IPlatformStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA, 1, PlatformProfile.GetPrimaryPad(), nullptr, nullptr, wchFormat); } else { - C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IPlatformStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC_MULTIPLE, uiIDA, 1, PlatformProfile.GetPrimaryPad()); } @@ -413,17 +413,17 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, memcpy((out), (buf) + (off), sizeof(unsigned int)) #define DLC_READ_PARAM(out, buf, off) \ - memcpy((out), (buf) + (off), sizeof(C4JStorage::DLC_FILE_PARAM)) + memcpy((out), (buf) + (off), sizeof(IPlatformStorage::DLC_FILE_PARAM)) #define DLC_READ_DETAIL(out, buf, off) \ - memcpy((out), (buf) + (off), sizeof(C4JStorage::DLC_FILE_DETAILS)) + memcpy((out), (buf) + (off), sizeof(IPlatformStorage::DLC_FILE_DETAILS)) // for details, read in the function below #define DLC_PARAM_WSTR(buf, off) \ - DLC_WSTRING((buf) + (off) + offsetof(C4JStorage::DLC_FILE_PARAM, wchData)) + DLC_WSTRING((buf) + (off) + offsetof(IPlatformStorage::DLC_FILE_PARAM, wchData)) #define DLC_DETAIL_WSTR(buf, off) \ - DLC_WSTRING((buf) + (off) + offsetof(C4JStorage::DLC_FILE_DETAILS, wchFile)) + DLC_WSTRING((buf) + (off) + offsetof(IPlatformStorage::DLC_FILE_DETAILS, wchFile)) { std::unordered_map parameterMapping; unsigned int uiCurrentByte = 0; @@ -466,7 +466,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, DLC_READ_UINT(&uiParameterCount, pbData, uiCurrentByte); uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_PARAM parBuf; + IPlatformStorage::DLC_FILE_PARAM parBuf; DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte); // uint32_t dwwchCount=0; for (unsigned int i = 0; i < uiParameterCount; i++) { @@ -481,13 +481,13 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, uiCurrentByte += DLC_PARAM_ADV(parBuf.dwWchCount); DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte); } - // ulCurrentByte+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM); + // ulCurrentByte+=ulParameterCount * sizeof(IPlatformStorage::DLC_FILE_PARAM); unsigned int uiFileCount; DLC_READ_UINT(&uiFileCount, pbData, uiCurrentByte); uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_DETAILS fileBuf; + IPlatformStorage::DLC_FILE_DETAILS fileBuf; DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte); unsigned int dwTemp = uiCurrentByte; @@ -496,7 +496,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, DLC_READ_DETAIL(&fileBuf, pbData, dwTemp); } std::uint8_t* pbTemp = - &pbData[dwTemp]; //+ sizeof(C4JStorage::DLC_FILE_DETAILS)*ulFileCount; + &pbData[dwTemp]; //+ sizeof(IPlatformStorage::DLC_FILE_DETAILS)*ulFileCount; DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte); for (unsigned int i = 0; i < uiFileCount; i++) { @@ -540,7 +540,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, pbTemp += DLC_PARAM_ADV(parBuf.dwWchCount); DLC_READ_PARAM(&parBuf, pbTemp, 0); } - // pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM); + // pbTemp+=ulParameterCount * sizeof(IPlatformStorage::DLC_FILE_PARAM); if (dlcTexturePack != nullptr) { unsigned int texturePackFilesProcessed = 0; @@ -643,7 +643,7 @@ std::uint32_t DLCManager::retrievePackID(std::uint8_t* pbData, unsigned int uiParameterCount = ReadDlcValue(pbData, uiCurrentByte); uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_PARAM paramBuf; + IPlatformStorage::DLC_FILE_PARAM paramBuf; ReadDlcStruct(¶mBuf, pbData, uiCurrentByte); for (unsigned int i = 0; i < uiParameterCount; i++) { // Map DLC strings to application strings, then store the DLC index @@ -661,7 +661,7 @@ std::uint32_t DLCManager::retrievePackID(std::uint8_t* pbData, unsigned int uiFileCount = ReadDlcValue(pbData, uiCurrentByte); uiCurrentByte += sizeof(int); - C4JStorage::DLC_FILE_DETAILS fileBuf; + IPlatformStorage::DLC_FILE_DETAILS fileBuf; ReadDlcStruct(&fileBuf, pbData, uiCurrentByte); unsigned int dwTemp = uiCurrentByte; diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index b7f1d50ee..7965ef4c9 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -9,7 +9,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "platform/profile/profile.h" #include "platform/XboxStubs.h" @@ -46,7 +46,7 @@ std::uint32_t DLCController::m_dwContentTypeA[e_Marketplace_MAX] = { }; int DLCController::marketplaceCountsCallback( - void* pParam, C4JStorage::DLC_TMS_DETAILS* pTMSDetails, int iPad) { + void* pParam, IPlatformStorage::DLC_TMS_DETAILS* pTMSDetails, int iPad) { app.DebugPrintf("Marketplace Counts= New - %d Total - %d\n", pTMSDetails->dwNewOffers, pTMSDetails->dwTotalOffers); @@ -73,9 +73,9 @@ bool DLCController::startInstallDLCProcess(int iPad) { m_iTotalDLCInstalled = 0; app.DebugPrintf( "--- DLCController::startInstallDLCProcess - " - "StorageManager.GetInstalledDLC\n"); + "PlatformStorage.GetInstalledDLC\n"); - StorageManager.GetInstalledDLC( + PlatformStorage.GetInstalledDLC( iPad, [this](int iInstalledC, int pad) { return dlcInstalledCallback(iInstalledC, pad); }); @@ -99,7 +99,7 @@ int DLCController::dlcInstalledCallback(int iInstalledC, int iPad) { void DLCController::mountNextDLC(int iPad) { app.DebugPrintf("--- DLCController::mountNextDLC: pad=%i.\n", iPad); if (m_iTotalDLCInstalled < m_iTotalDLC) { - if (StorageManager.MountInstalledDLC( + if (PlatformStorage.MountInstalledDLC( iPad, m_iTotalDLCInstalled, [this](int pad, std::uint32_t dwErr, std::uint32_t dwLicenceMask) { @@ -110,7 +110,7 @@ void DLCController::mountNextDLC(int iPad) { ++m_iTotalDLCInstalled; mountNextDLC(iPad); } else { - app.DebugPrintf("StorageManager.MountInstalledDLC ok\n"); + app.DebugPrintf("PlatformStorage.MountInstalledDLC ok\n"); } } else { m_bDLCInstallPending = false; @@ -135,7 +135,7 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr, app.m_dlcManager.incrementUnnamedCorruptCount(); } else { XCONTENT_DATA ContentData = - StorageManager.GetDLC(m_iTotalDLCInstalled); + PlatformStorage.GetDLC(m_iTotalDLCInstalled); DLCPack* pack = app.m_dlcManager.getPack(CONTENT_DATA_DISPLAY_NAME(ContentData)); @@ -176,7 +176,7 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr, pack->updateLicenseMask(dwLicenceMask); } - StorageManager.UnmountInstalledDLC(); + PlatformStorage.UnmountInstalledDLC(); } ++m_iTotalDLCInstalled; mountNextDLC(iPad); @@ -190,7 +190,7 @@ void DLCController::handleDLC(DLCPack* pack) { #if defined(_WINDOWS64) || defined(__linux__) std::vector dlcFilenames; #endif - StorageManager.GetMountedDLCFileList("DLCDrive", dlcFilenames); + PlatformStorage.GetMountedDLCFileList("DLCDrive", dlcFilenames); for (int i = 0; i < dlcFilenames.size(); i++) { app.m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i], pack); @@ -436,13 +436,13 @@ bool DLCController::retrieveNextDLCContent() { app.DebugPrintf("RetrieveNextDLCContent - type = %d\n", pCurrent->dwType); #endif - C4JStorage::EDLCStatus status = StorageManager.GetDLCOffers( + IPlatformStorage::EDLCStatus status = PlatformStorage.GetDLCOffers( PlatformProfile.GetPrimaryPad(), [this](int iOfferC, std::uint32_t dwType, int pad) { return dlcOffersReturned(iOfferC, dwType, pad); }, pCurrent->dwType); - if (status == C4JStorage::EDLC_Pending) { + if (status == IPlatformStorage::EDLC_Pending) { pCurrent->eState = e_DLC_ContentState_Retrieving; } else { app.DebugPrintf("RetrieveNextDLCContent - PROBLEM\n"); @@ -597,9 +597,9 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType, &DLCController::tmsPPFileReturned; pTMSPPreq->lpCallbackParam = this; pTMSPPreq->eStorageFacility = - C4JStorage::eGlobalStorage_Title; + IPlatformStorage::eGlobalStorage_Title; pTMSPPreq->eFileTypeVal = - C4JStorage::TMS_FILETYPE_BINARY; + IPlatformStorage::TMS_FILETYPE_BINARY; memcpy(pTMSPPreq->wchFilename, pDLC->wchDataFile, sizeof(wchar_t) * MAX_BANNERNAME_SIZE); @@ -645,9 +645,9 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType, &DLCController::tmsPPFileReturned; pTMSPPreq->lpCallbackParam = this; pTMSPPreq->eStorageFacility = - C4JStorage::eGlobalStorage_Title; + IPlatformStorage::eGlobalStorage_Title; pTMSPPreq->eFileTypeVal = - C4JStorage::TMS_FILETYPE_BINARY; + IPlatformStorage::TMS_FILETYPE_BINARY; memcpy(pTMSPPreq->wchFilename, pDLC->wchBanner, sizeof(wchar_t) * MAX_BANNERNAME_SIZE); pTMSPPreq->eType = eType; @@ -670,7 +670,7 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType, } int DLCController::tmsPPFileReturned(void* pParam, int iPad, int iUserData, - C4JStorage::PTMSPP_FILEDATA pFileData, + IPlatformStorage::PTMSPP_FILEDATA pFileData, const char* szFilename) { DLCController* pClass = (DLCController*)pParam; diff --git a/targets/app/common/DLCController.h b/targets/app/common/DLCController.h index 0fc5d7425..c793de17f 100644 --- a/targets/app/common/DLCController.h +++ b/targets/app/common/DLCController.h @@ -8,7 +8,7 @@ #include "app/common/App_structs.h" #include "app/common/DLC/DLCManager.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "platform/XboxStubs.h" struct SCreditTextItemDef; @@ -32,7 +32,7 @@ public: void clearDLCInstalled() { m_bDLCInstallProcessCompleted = false; } static int marketplaceCountsCallback(void* pParam, - C4JStorage::DLC_TMS_DETAILS*, + IPlatformStorage::DLC_TMS_DETAILS*, int iPad); // DLC info registration @@ -73,7 +73,7 @@ public: unsigned int addTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote = false); static int tmsPPFileReturned(void* pParam, int iPad, int iUserData, - C4JStorage::PTMSPP_FILEDATA pFileData, + IPlatformStorage::PTMSPP_FILEDATA pFileData, const char* szFilename); // Credit text diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 7dd456d9f..68e8992fd 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -4,7 +4,7 @@ #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" @@ -234,10 +234,10 @@ void Game::SetAppPaused(bool val) { m_bIsAppPaused = val; } int Game::BannedLevelDialogReturned( - void* pParam, int iPad, const C4JStorage::EMessageResult result) { + void* pParam, int iPad, const IPlatformStorage::EMessageResult result) { Game* pApp = (Game*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { } else { if (iPad == PlatformProfile.GetPrimaryPad()) { pApp->SetAction(iPad, eAppAction_ExitWorld); @@ -316,10 +316,10 @@ int Game::GetLocalPlayerCount(void) { // std::uint32_t dwSize=0; // // 4J-PB - out for now for DaveK so he doesn't get the // birthday cape #ifdef _CONTENT_PACKAGE -// C4JStorage::ETMSStatus eTMSStatus; -// eTMSStatus=StorageManager.ReadTMSFile(PlatformProfile.GetPrimaryPad(),C4JStorage::eGlobalStorage_Title,C4JStorage::eTMS_FileType_Graphic, +// IPlatformStorage::ETMSStatus eTMSStatus; +// eTMSStatus=PlatformStorage.ReadTMSFile(PlatformProfile.GetPrimaryPad(),IPlatformStorage::eGlobalStorage_Title,IPlatformStorage::eTMS_FileType_Graphic, // L"Default_Cape.png",&pBuffer, &dwSize); -// if(eTMSStatus==C4JStorage::ETMSStatus_Idle) +// if(eTMSStatus==IPlatformStorage::ETMSStatus_Idle) // { // app.AddMemoryTextureFile(wTemp,pBuffer,dwSize); // } @@ -330,7 +330,7 @@ int Game::GetLocalPlayerCount(void) { // int Game::DLCReadCallback(void* -// pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData) +// pParam,IPlatformStorage::DLC_FILE_DETAILS *pDLCData) // { // // diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index beb528a7c..ba7e61adb 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -5,7 +5,7 @@ #include "util/Timer.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" // using namespace std; @@ -145,7 +145,7 @@ public: bool IsAppPaused(); void SetAppPaused(bool val); - int displaySavingMessage(const C4JStorage::ESavingMessage eMsg, int iPad) { + int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, int iPad) { return m_gameSettingsManager.displaySavingMessage(eMsg, iPad); } bool GetGameStarted() { return m_bGameStarted; } @@ -486,11 +486,11 @@ public: return NetworkController::signoutExitWorldThreadProc(lpParameter); } static int PrimaryPlayerSignedOutReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult result) { + const IPlatformStorage::EMessageResult result) { return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad, result); } static int EthernetDisconnectReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult result) { + const IPlatformStorage::EMessageResult result) { return NetworkController::ethernetDisconnectReturned(pParam, iPad, result); } static void ProfileReadErrorCallback(void* pParam) { @@ -523,7 +523,7 @@ public: #endif void SetDebugSequence(const char* pchSeq); // bool UploadFileToGlobalStorage(int iQuadrant, - // C4JStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ); + // IPlatformStorage::eGlobalStorage eStorageFacility, std::wstring *wsFile ); // Installed DLC - delegated to DLCController bool StartInstallDLCProcess(int iPad) { return m_dlcController.startInstallDLCProcess(iPad); } @@ -539,7 +539,7 @@ public: bool DLCInstallProcessCompleted() { return m_dlcController.dlcInstallProcessCompleted(); } void ClearDLCInstalled() { m_dlcController.clearDLCInstalled(); } static int MarketplaceCountsCallback(void* pParam, - C4JStorage::DLC_TMS_DETAILS* details, + IPlatformStorage::DLC_TMS_DETAILS* details, int iPad) { return DLCController::marketplaceCountsCallback(pParam, details, iPad); } @@ -677,9 +677,9 @@ public: private: static int BannedLevelDialogReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult); + const IPlatformStorage::EMessageResult); static int TexturePackDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { return MenuController::texturePackDialogReturned(pParam, iPad, result); } @@ -730,41 +730,41 @@ public: private: static int UnlockFullExitReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { return MenuController::unlockFullExitReturned(pParam, iPad, result); } static int UnlockFullSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { return MenuController::unlockFullSaveReturned(pParam, iPad, result); } static int UnlockFullInviteReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { return MenuController::unlockFullInviteReturned(pParam, iPad, result); } static int TrialOverReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { return MenuController::trialOverReturned(pParam, iPad, result); } static int ExitAndJoinFromInvite(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { return NetworkController::exitAndJoinFromInvite(pParam, iPad, result); } static int ExitAndJoinFromInviteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return NetworkController::exitAndJoinFromInviteSaveDialogReturned(pParam, iPad, result); } static int ExitAndJoinFromInviteAndSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return NetworkController::exitAndJoinFromInviteAndSaveReturned(pParam, iPad, result); } static int ExitAndJoinFromInviteDeclineSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return NetworkController::exitAndJoinFromInviteDeclineSaveReturned(pParam, iPad, result); } static int FatalErrorDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int WarningTrialTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return NetworkController::warningTrialTexturePackReturned(pParam, iPad, result); } @@ -817,7 +817,7 @@ public: MenuController::exitGameFromRemoteSave(lpParameter); } static int ExitGameFromRemoteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return MenuController::exitGameFromRemoteSaveDialogReturned(pParam, iPad, result); } @@ -1021,7 +1021,7 @@ public: int GetDLCInfoTexturesOffersCount() { return m_dlcController.getDLCInfoTexturesOffersCount(); } static int TMSPPFileReturned(void* pParam, int iPad, int iUserData, - C4JStorage::PTMSPP_FILEDATA pFileData, + IPlatformStorage::PTMSPP_FILEDATA pFileData, const char* szFilename) { return DLCController::tmsPPFileReturned(pParam, iPad, iUserData, pFileData, szFilename); } diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index cf60b3801..90eaef659 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -32,7 +32,7 @@ #include "minecraft/world/phys/AABB.h" #include "platform/PlatformServices.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "strings.h" #include "util/StringHelpers.h" @@ -551,7 +551,7 @@ void LevelGenerationOptions::loadBaseSaveData() { mountIndex = m_parentDLCPack->GetDLCMountIndex(); if (mountIndex > -1) { - if (StorageManager.MountInstalledDLC( + if (PlatformStorage.MountInstalledDLC( PlatformProfile.GetPrimaryPad(), mountIndex, [this](int pad, std::uint32_t err, std::uint32_t lic) { return onPackMounted(pad, err, lic); @@ -638,7 +638,7 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr, } } } - uint32_t result = StorageManager.UnmountInstalledDLC("WPACK"); + uint32_t result = PlatformStorage.UnmountInstalledDLC("WPACK"); } lgo->setLoadedData(); diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index d34c8915d..bee25383a 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -22,7 +22,7 @@ #include "minecraft/world/level/tile/Tile.h" #include "platform/input/input.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/Audio/SoundEngine.h" #include @@ -1126,7 +1126,7 @@ void GameSettingsManager::setSpecialTutorialCompletionFlag(int iPad, } int GameSettingsManager::displaySavingMessage( - C4JStorage::ESavingMessage eVal, int iPad) { + IPlatformStorage::ESavingMessage eVal, int iPad) { ui.ShowSavingMessage(iPad, eVal); return 0; } diff --git a/targets/app/common/GameSettingsManager.h b/targets/app/common/GameSettingsManager.h index d3b437f6f..293969b20 100644 --- a/targets/app/common/GameSettingsManager.h +++ b/targets/app/common/GameSettingsManager.h @@ -64,7 +64,7 @@ public: static void setActionConfirmed(void* param); // Saving message - int displaySavingMessage(const C4JStorage::ESavingMessage eMsg, int iPad); + int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, int iPad); // Game settings array - public, referenced by Game via alias GAME_SETTINGS* GameSettingsA[XUSER_MAX_COUNT]; diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index 93a438579..e959e2a36 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -29,7 +29,7 @@ #include "minecraft/stats/StatsCounter.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "util/StringHelpers.h" #include "app/common/Audio/SoundEngine.h" @@ -49,11 +49,11 @@ void Game::HandleXuiActions(void) { { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; - C4JStorage::EMessageResult result = + IPlatformStorage::EMessageResult result = ui.RequestErrorMessage(IDS_CANT_PLACE_NEAR_SPAWN_TITLE, IDS_CANT_PLACE_NEAR_SPAWN_TEXT, uiIDA, 1, XUSER_INDEX_ANY); - if (result != C4JStorage::EMessage_Busy) + if (result != IPlatformStorage::EMessage_Busy) SetGlobalXuiAction(eAppAction_Idle); } break; @@ -127,7 +127,7 @@ void Game::HandleXuiActions(void) { // stop the dialog asking if we want to overwrite it coming // up on an autosave bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); + PlatformStorage.DoesSaveExist(&bSaveExists); SetAction(i, eAppAction_Idle); if (!GetChangingSessionType()) { @@ -147,7 +147,7 @@ void Game::HandleXuiActions(void) { // Check that there is a name for the save - if we're saving // from the tutorial and this is the first save from the // tutorial, we'll not have a name - /*if(StorageManager.GetSaveName()==nullptr) + /*if(PlatformStorage.GetSaveName()==nullptr) { app.NavigateToScene(i,eUIScene_SaveWorld); } @@ -163,7 +163,7 @@ void Game::HandleXuiActions(void) { // int saveOrCheckpointId = 0; // bool validSave = - // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); // SentientManager.RecordLevelSaveOrCheckpoint(PlatformProfile.GetPrimaryPad(), // saveOrCheckpointId); @@ -229,7 +229,7 @@ void Game::HandleXuiActions(void) { // int saveOrCheckpointId = 0; // bool validSave = - // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); // SentientManager.RecordLevelSaveOrCheckpoint(PlatformProfile.GetPrimaryPad(), // saveOrCheckpointId); @@ -680,7 +680,7 @@ void Game::HandleXuiActions(void) { // inform the player they are being returned to the menus // because they signed out - StorageManager.SetSaveDeviceSelected(i, false); + PlatformStorage.SetSaveDeviceSelected(i, false); // need to clear the player stats - can't assume it'll be // done in setlevel - we may not be in the game StatsCounter* pStats = Minecraft::GetInstance()->stats[i]; @@ -877,7 +877,7 @@ void Game::HandleXuiActions(void) { // set the state back to pre-game PlatformProfile.ResetProfileProcessState(); // clear the save device - StorageManager.SetSaveDeviceSelected(i, false); + PlatformStorage.SetSaveDeviceSelected(i, false); ui.UpdatePlayerBasePositions(); // there are multiple layers in the help menu, so a navigate @@ -926,7 +926,7 @@ void Game::HandleXuiActions(void) { SetAction(i, eAppAction_Idle); // Check the player really wants to do this - if (!StorageManager.GetSaveDisabled() && + if (!PlatformStorage.GetSaveDisabled() && i == PlatformProfile.GetPrimaryPad() && g_NetworkManager.IsHost() && GetGameStarted()) { uiIDA[0] = IDS_CONFIRM_CANCEL; @@ -1000,7 +1000,7 @@ void Game::HandleXuiActions(void) { 1); const unsigned int result = - StorageManager.UnmountInstalledDLC("TPACK"); + PlatformStorage.UnmountInstalledDLC("TPACK"); app.DebugPrintf("Unmount result is %d\n", result); } @@ -1211,11 +1211,11 @@ void Game::HandleXuiActions(void) { case eAppAction_FailedToJoinNoPrivileges: { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; - C4JStorage::EMessageResult result = ui.RequestErrorMessage( + IPlatformStorage::EMessageResult result = ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, PlatformProfile.GetPrimaryPad()); - if (result != C4JStorage::EMessage_Busy) + if (result != IPlatformStorage::EMessage_Busy) SetAction(i, eAppAction_Idle); } break; case eAppAction_ProfileReadError: @@ -1269,12 +1269,12 @@ void Game::HandleXuiActions(void) { swprintf(wchFormat, 40, L"%ls\n\n%%ls", player->GetOnlineName()); - C4JStorage::EMessageResult result = + IPlatformStorage::EMessageResult result = ui.RequestErrorMessage( IDS_BANNED_LEVEL_TITLE, IDS_PLAYER_BANNED_LEVEL, uiIDA, 2, i, &Game::BannedLevelDialogReturned, this, wchFormat); - if (result != C4JStorage::EMessage_Busy) + if (result != IPlatformStorage::EMessage_Busy) SetAction(i, eAppAction_Idle); } else { SetAction(i, eAppAction_Idle); @@ -1431,7 +1431,7 @@ void Game::HandleXuiActions(void) { */ case eTMSAction_TMS_RetrieveFiles_Complete: SetTMSAction(i, eTMSAction_Idle); - // if(StorageManager.SetSaveDevice(&CScene_Main::DeviceSelectReturned,pClass)) + // if(PlatformStorage.SetSaveDevice(&CScene_Main::DeviceSelectReturned,pClass)) // { // // save device already // selected diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index 79bf9ea90..0549a1cc3 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -19,7 +19,7 @@ #include "minecraft/world/level/tile/entity/HopperTileEntity.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include #include @@ -431,12 +431,12 @@ bool MenuController::loadBeaconMenu( } int MenuController::texturePackDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return 0; } int MenuController::unlockFullInviteReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { Minecraft* pMinecraft = Minecraft::GetInstance(); bool bNoPlayer; @@ -448,16 +448,16 @@ int MenuController::unlockFullInviteReturned( } int MenuController::unlockFullSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return 0; } int MenuController::unlockFullExitReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { Game* pApp = (Game*)pParam; Minecraft* pMinecraft = Minecraft::GetInstance(); - if (result != C4JStorage::EMessage_ResultAccept) { + if (result != IPlatformStorage::EMessage_ResultAccept) { pApp->SetAction(pMinecraft->player->GetXboxPad(), eAppAction_ExitWorldTrial); } @@ -466,11 +466,11 @@ int MenuController::unlockFullExitReturned( } int MenuController::trialOverReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { Game* pApp = (Game*)pParam; Minecraft* pMinecraft = Minecraft::GetInstance(); - if (result != C4JStorage::EMessage_ResultAccept) { + if (result != IPlatformStorage::EMessage_ResultAccept) { pApp->SetAction(pMinecraft->player->GetXboxPad(), eAppAction_ExitTrial); } @@ -521,8 +521,8 @@ void MenuController::exitGameFromRemoteSave(void* lpParameter) { } int MenuController::exitGameFromRemoteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { - if (result == C4JStorage::EMessage_ResultDecline) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { + if (result == IPlatformStorage::EMessage_ResultDecline) { app.SetAction(iPad, eAppAction_ExitWorld); } else { UIScene_FullscreenProgress* pScene = diff --git a/targets/app/common/MenuController.h b/targets/app/common/MenuController.h index c373df31e..8c2b74f5c 100644 --- a/targets/app/common/MenuController.h +++ b/targets/app/common/MenuController.h @@ -5,7 +5,7 @@ #include #include "app/common/App_structs.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "platform/XboxStubs.h" class Player; @@ -97,23 +97,23 @@ public: // Dialog callbacks static int texturePackDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int fatalErrorDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int trialOverReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int unlockFullExitReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int unlockFullSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int unlockFullInviteReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); // Remote save static int remoteSaveThreadProc(void* lpParameter); static void exitGameFromRemoteSave(void* lpParameter); static int exitGameFromRemoteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); // Image text data void getImageTextData(std::uint8_t* imageData, unsigned int imageBytes, diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index f9138db5e..2f76df99a 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -12,7 +12,7 @@ #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" @@ -1301,7 +1301,7 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, // 4J-PB - it's possible there is no primary pad here, when accepting an // invite from the dashboard - // StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + // PlatformStorage.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, // IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, // uiIDA,1,PlatformProfile.GetPrimaryPad(),nullptr,nullptr, // app.GetStringTable()); @@ -1505,7 +1505,7 @@ void CGameNetworkManager::ServerStoppedWait() { result = m_hServerStoppedEvent->waitForSignal(20); // Tick some simple things PlatformProfile.Tick(); - StorageManager.Tick(); + PlatformStorage.Tick(); PlatformInput.Tick(); RenderManager.Tick(); ui.tick(); diff --git a/targets/app/common/NetworkController.cpp b/targets/app/common/NetworkController.cpp index 367f90252..295079fdb 100644 --- a/targets/app/common/NetworkController.cpp +++ b/targets/app/common/NetworkController.cpp @@ -19,7 +19,7 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "platform/input/input.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/Audio/SoundEngine.h" #include @@ -97,7 +97,7 @@ void NetworkController::processInvite(std::uint32_t dwUserIndex, } int NetworkController::primaryPlayerSignedOutReturned( - void* pParam, int iPad, const C4JStorage::EMessageResult) { + void* pParam, int iPad, const IPlatformStorage::EMessageResult) { if (g_NetworkManager.IsInSession()) { app.SetAction(iPad, eAppAction_PrimaryPlayerSignedOutReturned); } else { @@ -107,7 +107,7 @@ int NetworkController::primaryPlayerSignedOutReturned( } int NetworkController::ethernetDisconnectReturned( - void* pParam, int iPad, const C4JStorage::EMessageResult) { + void* pParam, int iPad, const IPlatformStorage::EMessageResult) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (Minecraft::GetInstance()->player != nullptr) { @@ -241,7 +241,7 @@ void NetworkController::signInChangeCallback(void* pParam, bPrimaryPlayerChanged) { pApp->SetAction(iPrimaryPlayer, eAppAction_PrimaryPlayerSignedOut); pApp->InvalidateBannedList(iPrimaryPlayer); - StorageManager.ClearDLCOffers(); + PlatformStorage.ClearDLCOffers(); pApp->ClearAndResetDLCDownloadQueue(); pApp->ClearDLCInstalled(); } else { @@ -349,7 +349,7 @@ void NetworkController::signInChangeCallback(void* pParam, m_uiLastSignInData = uiSignInData; } else if (iPrimaryPlayer != -1) { pApp->InvalidateBannedList(iPrimaryPlayer); - StorageManager.ClearDLCOffers(); + PlatformStorage.ClearDLCOffers(); pApp->ClearAndResetDLCDownloadQueue(); pApp->ClearDLCInstalled(); } @@ -410,10 +410,10 @@ void NetworkController::liveLinkChangeCallback(void* pParam, bool bConnected) { } int NetworkController::exitAndJoinFromInvite( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { Game* pApp = (Game*)pParam; - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { pApp->SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); } @@ -421,11 +421,11 @@ int NetworkController::exitAndJoinFromInvite( } int NetworkController::exitAndJoinFromInviteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { Game* pClass = (Game*)pParam; - if (result == C4JStorage::EMessage_ResultDecline || - result == C4JStorage::EMessage_ResultThirdOption) { - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline || + result == IPlatformStorage::EMessage_ResultThirdOption) { + if (result == IPlatformStorage::EMessage_ResultDecline) { if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); @@ -446,7 +446,7 @@ int NetworkController::exitAndJoinFromInviteSaveDialogReturned( } } bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); + PlatformStorage.DoesSaveExist(&bSaveExists); if (bSaveExists) { unsigned int uiIDA[2]; uiIDA[0] = IDS_CONFIRM_CANCEL; @@ -479,13 +479,13 @@ int NetworkController::exitAndJoinFromInviteSaveDialogReturned( } int NetworkController::warningTrialTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return 0; } int NetworkController::exitAndJoinFromInviteAndSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { - if (result == C4JStorage::EMessage_ResultDecline) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { + if (result == IPlatformStorage::EMessage_ResultDecline) { if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); DLCPack* pDLCPack = tPack->getDLCPack(); @@ -509,8 +509,8 @@ int NetworkController::exitAndJoinFromInviteAndSaveReturned( } int NetworkController::exitAndJoinFromInviteDeclineSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { - if (result == C4JStorage::EMessage_ResultDecline) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { + if (result == IPlatformStorage::EMessage_ResultDecline) { MinecraftServer::getInstance()->setSaveOnExit(false); app.SetAction(iPad, eAppAction_ExitAndJoinFromInviteConfirmed); } diff --git a/targets/app/common/NetworkController.h b/targets/app/common/NetworkController.h index 0c1a706c0..4d226d8dd 100644 --- a/targets/app/common/NetworkController.h +++ b/targets/app/common/NetworkController.h @@ -4,7 +4,7 @@ #include "app/common/App_structs.h" #include "platform/NetTypes.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "platform/XboxStubs.h" #include "minecraft/network/packet/DisconnectPacket.h" @@ -33,9 +33,9 @@ public: static void clearSignInChangeUsersMask(); static int signoutExitWorldThreadProc(void* lpParameter); static int primaryPlayerSignedOutReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult); + const IPlatformStorage::EMessageResult); static int ethernetDisconnectReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult); + const IPlatformStorage::EMessageResult); static void profileReadErrorCallback(void* pParam); // Notifications @@ -51,15 +51,15 @@ public: std::uint32_t dwLocalUsersMask, const INVITE_INFO* pInviteInfo); static int exitAndJoinFromInvite(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int exitAndJoinFromInviteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int exitAndJoinFromInviteAndSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int exitAndJoinFromInviteDeclineSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int warningTrialTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); // Disconnect DisconnectPacket::eDisconnectReason getDisconnectReason() { diff --git a/targets/app/common/UI/All Platforms/IUIController.h b/targets/app/common/UI/All Platforms/IUIController.h index c8a71800e..210788677 100644 --- a/targets/app/common/UI/All Platforms/IUIController.h +++ b/targets/app/common/UI/All Platforms/IUIController.h @@ -1,6 +1,6 @@ #pragma once -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "UIEnums.h" #include "UIStructs.h" #include "minecraft/sounds/SoundTypes.h" @@ -82,7 +82,7 @@ public: virtual void ShowAutosaveCountdownTimer(bool show) = 0; virtual void UpdateAutosaveCountdownTimer(unsigned int uiSeconds) = 0; virtual void ShowSavingMessage(unsigned int iPad, - C4JStorage::ESavingMessage eVal) = 0; + IPlatformStorage::ESavingMessage eVal) = 0; virtual bool PressStartPlaying(unsigned int iPad) = 0; virtual void ShowPressStart(unsigned int iPad) = 0; diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp index 24269ddad..2a106b1f8 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp @@ -32,12 +32,12 @@ class TexturePack; int IUIScene_PauseMenu::ExitGameDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { IUIScene_PauseMenu* pScene = dynamic_cast( ui.GetSceneFromCallbackId((std::size_t)pParam)); // Results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { if (pScene) pScene->SetIgnoreInput(true); app.SetAction(iPad, eAppAction_ExitWorld); } @@ -45,15 +45,15 @@ int IUIScene_PauseMenu::ExitGameDialogReturned( } int IUIScene_PauseMenu::ExitGameSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { IUIScene_PauseMenu* pScene = dynamic_cast( ui.GetSceneFromCallbackId((std::size_t)pParam)); // Exit with or without saving // Decline means save in this dialog - if (result == C4JStorage::EMessage_ResultDecline || - result == C4JStorage::EMessage_ResultThirdOption) { - if (result == C4JStorage::EMessage_ResultDecline) // Save + if (result == IPlatformStorage::EMessage_ResultDecline || + result == IPlatformStorage::EMessage_ResultThirdOption) { + if (result == IPlatformStorage::EMessage_ResultDecline) // Save { // 4J-PB - Is the player trying to save but they are using a trial // texturepack ? @@ -86,7 +86,7 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned( // does the save exist? bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); + PlatformStorage.DoesSaveExist(&bSaveExists); // 4J-PB - we check if the save exists inside the libs // we need to ask if they are sure they want to overwrite the // existing game @@ -122,16 +122,16 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned( } int IUIScene_PauseMenu::ExitGameAndSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // 4J-PB - we won't come in here if we have a trial texture pack IUIScene_PauseMenu* pScene = dynamic_cast( ui.GetSceneFromCallbackId((std::size_t)pParam)); // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // int32_t saveOrCheckpointId = 0; // bool validSave = - // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); // SentientManager.RecordLevelSaveOrCheckpoint(PlatformProfile.GetPrimaryPad(), // saveOrCheckpointId); if (pScene) pScene->SetIgnoreInput(true); @@ -167,12 +167,12 @@ int IUIScene_PauseMenu::ExitGameAndSaveReturned( } int IUIScene_PauseMenu::ExitGameDeclineSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { IUIScene_PauseMenu* pScene = dynamic_cast( ui.GetSceneFromCallbackId((std::size_t)pParam)); // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { if (pScene) pScene->SetIgnoreInput(true); MinecraftServer::getInstance()->setSaveOnExit(false); // flag a app action of exit game @@ -206,7 +206,7 @@ int IUIScene_PauseMenu::ExitGameDeclineSaveReturned( } int IUIScene_PauseMenu::WarningTrialTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return 0; } @@ -452,9 +452,9 @@ void IUIScene_PauseMenu::_ExitWorld(void* lpParameter) { } int IUIScene_PauseMenu::SaveGameDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // flag a app action of save game app.SetAction(iPad, eAppAction_SaveGame); } @@ -462,9 +462,9 @@ int IUIScene_PauseMenu::SaveGameDialogReturned( } int IUIScene_PauseMenu::EnableAutosaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // Set the global flag, so that we don't disable saving again once the // save is complete app.SetGameHostOption(eGameHostOption_DisableSaving, 0); @@ -475,7 +475,7 @@ int IUIScene_PauseMenu::EnableAutosaveDialogReturned( app.SetGameHostOption(eGameHostOption_DisableSaving, 1); } // Re-enable saving temporarily - StorageManager.SetSaveDisabled(false); + PlatformStorage.SetSaveDisabled(false); // flag a app action of save game app.SetAction(iPad, eAppAction_SaveGame); @@ -483,13 +483,13 @@ int IUIScene_PauseMenu::EnableAutosaveDialogReturned( } int IUIScene_PauseMenu::DisableAutosaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // Set the global flag, so that we disable saving again once the save is // complete app.SetGameHostOption(eGameHostOption_DisableSaving, 1); - StorageManager.SetSaveDisabled(false); + PlatformStorage.SetSaveDisabled(false); // flag a app action of save game app.SetAction(iPad, eAppAction_SaveGame); diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h index 366cf6a4d..46522bac3 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h @@ -1,7 +1,7 @@ #pragma once #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/DLC/DLCPack.h" class DLCPack; @@ -12,21 +12,21 @@ protected: public: static int ExitGameDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int ExitGameSaveDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int ExitGameAndSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int ExitGameDeclineSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int WarningTrialTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int SaveGameDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int EnableAutosaveDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int DisableAutosaveDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int SaveWorldThreadProc(void* lpParameter); static int ExitWorldThreadProc(void* lpParameter); diff --git a/targets/app/common/UI/All Platforms/UIStructs.h b/targets/app/common/UI/All Platforms/UIStructs.h index f164eb8ab..1e5cf5b7b 100644 --- a/targets/app/common/UI/All Platforms/UIStructs.h +++ b/targets/app/common/UI/All Platforms/UIStructs.h @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/App_Defines.h" #include "UIEnums.h" #include "platform/C4JThread.h" @@ -397,7 +397,7 @@ typedef struct _MessageBoxInfo { uint32_t* uiOptionA; uint32_t uiOptionC; uint32_t dwPad; - int (*Func)(void*, int, const C4JStorage::EMessageResult); + int (*Func)(void*, int, const IPlatformStorage::EMessageResult); void* lpParam; // C4JStringTable *pStringTable; // 4J Stu - We don't need this for our // internal message boxes 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 897fc2d5e..022f2a29b 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 @@ -242,10 +242,10 @@ void IUIScene_StartGame::UpdateCurrentTexturePack(int iSlot) { } int IUIScene_StartGame::TrialTexturePackWarningReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { IUIScene_StartGame* pScene = (IUIScene_StartGame*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { pScene->checkStateAndStartGame(); } else { pScene->m_bIgnoreInput = false; @@ -254,10 +254,10 @@ int IUIScene_StartGame::TrialTexturePackWarningReturned( } int IUIScene_StartGame::UnlockTexturePackReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { IUIScene_StartGame* pScene = (IUIScene_StartGame*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { if (PlatformProfile.IsSignedIn(iPad)) { // the license change coming in when the offer has been installed // will cause this scene to refresh @@ -271,7 +271,7 @@ int IUIScene_StartGame::UnlockTexturePackReturned( } int IUIScene_StartGame::TexturePackDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { IUIScene_StartGame* pClass = (IUIScene_StartGame*)pParam; pClass->m_bIgnoreInput = false; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h index a7c13287d..b38d136ee 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -53,9 +53,9 @@ protected: void UpdateCurrentTexturePack(int iSlot); static int TrialTexturePackWarningReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int UnlockTexturePackReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int TexturePackDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); }; \ No newline at end of file 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 50beae266..e353b9026 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 @@ -704,9 +704,9 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, // create the world and launch std::wstring wWorldName = pClass->m_worldName; - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); // Make our next save default to the name of the level - StorageManager.SetSaveTitle((wchar_t*)wWorldName.c_str()); + PlatformStorage.SetSaveTitle((wchar_t*)wWorldName.c_str()); std::wstring wSeed; if (!pClass->m_MoreOptionsParams.seed.empty()) { @@ -977,10 +977,10 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam, } int UIScene_CreateWorldMenu::ConfirmCreateReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { bool isClientSide = PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h index 9bb7c90f3..099081bcd 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.h @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "IUIScene_StartGame.h" #include "app/common/DLC/DLCPack.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -107,10 +107,10 @@ protected: static void CreateGame(UIScene_CreateWorldMenu* pClass, int32_t LocalUsersMask); static int ConfirmCreateReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int StartGame_SignInReturned(void* pParam, bool bContinue, int iPad); static int MustSignInReturnedPSN(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); virtual void checkStateAndStartGame(); }; \ No newline at end of file diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp index 21f38703c..69c000834 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp @@ -94,7 +94,7 @@ void UIScene_DLCMainMenu::handlePress(F64 controlId, F64 childId) { void UIScene_DLCMainMenu::handleTimerComplete(int id) {} int UIScene_DLCMainMenu::ExitDLCMainMenu(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { UIScene_DLCMainMenu* pClass = (UIScene_DLCMainMenu*)pParam; pClass->navigateBack(); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h index 84b15c452..1467af02a 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" @@ -31,7 +31,7 @@ private: UI_END_MAP_ELEMENTS_AND_NAMES() static int ExitDLCMainMenu(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); public: UIScene_DLCMainMenu(int iPad, void* initData, UILayer* parentLayer); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp index b137ded49..3311a574e 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp @@ -58,7 +58,7 @@ UIScene_DLCOffersMenu::~UIScene_DLCOffersMenu() { void UIScene_DLCOffersMenu::handleTimerComplete(int id) {} int UIScene_DLCOffersMenu::ExitDLCOffersMenu( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_DLCOffersMenu* pClass = (UIScene_DLCOffersMenu*)pParam; ui.NavigateToHomeMenu(); // iPad,eUIScene_MainMenu); @@ -186,8 +186,8 @@ void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId) { int iIndex = (int)childId; uint64_t ullIndexA[1]; - ullIndexA[0] = StorageManager.GetOffer(iIndex).qwOfferID; - StorageManager.InstallOffer(1, ullIndexA, nullptr); + ullIndexA[0] = PlatformStorage.GetOffer(iIndex).qwOfferID; + PlatformStorage.InstallOffer(1, ullIndexA, nullptr); } break; } } diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h index 8f698873f..a2dc9c4f3 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -45,7 +45,7 @@ public: UIScene_DLCOffersMenu(int iPad, void* initData, UILayer* parentLayer); ~UIScene_DLCOffersMenu(); static int ExitDLCOffersMenu(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); virtual EUIScene getSceneType() { return eUIScene_DLCOffersMenu; } virtual void tick(); 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 96af029b0..68f768a4f 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 @@ -222,7 +222,7 @@ void UIScene_JoinMenu::friendSessionUpdated(bool success, void* pParam) { } int UIScene_JoinMenu::ErrorDialogReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult) { + const IPlatformStorage::EMessageResult) { UIScene_JoinMenu* scene = (UIScene_JoinMenu*)pParam; ui.NavigateBack(scene->m_iPad); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h index d39db7865..c77044633 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" @@ -72,7 +72,7 @@ public: void tick(); static void friendSessionUpdated(bool success, void* pParam); static int ErrorDialogReturned(void* pParam, int iPad, - const C4JStorage::EMessageResult); + const IPlatformStorage::EMessageResult); virtual void updateTooltips(); virtual void updateComponents(); 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 719b34536..65ecfd09b 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 @@ -849,7 +849,7 @@ void UIScene_LeaderboardsMenu::handleRequestMoreData(F64 startIndex, bool up) { void UIScene_LeaderboardsMenu::handleTimerComplete(int id) {} int UIScene_LeaderboardsMenu::ExitLeaderboards( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LeaderboardsMenu* pClass = (UIScene_LeaderboardsMenu*)pParam; pClass->navigateBack(); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h index bd934779f..f43436509 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.h @@ -4,7 +4,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/Leaderboards/LeaderboardInterface.h" #include "app/common/Leaderboards/LeaderboardManager.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -113,7 +113,7 @@ private: UI_END_MAP_ELEMENTS_AND_NAMES() static int ExitLeaderboards(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); public: UIScene_LeaderboardsMenu(int iPad, void* initData, UILayer* parentLayer); 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 3530b084b..81ff8352c 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 @@ -764,15 +764,15 @@ void UIScene_LoadMenu::LaunchGame(void) { } else { // set the save to load PSAVE_DETAILS pSaveDetails = - StorageManager.ReturnSavesInfo(); + PlatformStorage.ReturnSavesInfo(); app.DebugPrintf( "Loading save s [%s]\n", pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex] .UTF8SaveTitle, pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex] .UTF8SaveFilename); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveData( + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveData( &pSaveDetails ->SaveInfoA[(int)m_iSaveGameInfoIndex], [this](bool bCorrupt, bool bOwner) { @@ -781,10 +781,10 @@ void UIScene_LoadMenu::LaunchGame(void) { #if TO_BE_IMPLEMENTED if (eLoadStatus == - C4JStorage::ELoadGame_DeviceRemoved) { + IPlatformStorage::ELoadGame_DeviceRemoved) { // disable saving - StorageManager.SetSaveDisabled(true); - StorageManager.SetSaveDeviceSelected(m_iPad, false); + PlatformStorage.SetSaveDisabled(true); + PlatformStorage.SetSaveDeviceSelected(m_iPad, false); unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage( @@ -816,24 +816,24 @@ void UIScene_LoadMenu::LaunchGame(void) { LoadDataComplete(this); } else { // set the save to load - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); app.DebugPrintf("Loading save %s [%s]\n", pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex] .UTF8SaveTitle, pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex] .UTF8SaveFilename); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveData( + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveData( &pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex], [this](bool bCorrupt, bool bOwner) { return loadSaveDataReturned(bCorrupt, bOwner); }); #if TO_BE_IMPLEMENTED - if (eLoadStatus == C4JStorage::ELoadGame_DeviceRemoved) { + if (eLoadStatus == IPlatformStorage::ELoadGame_DeviceRemoved) { // disable saving - StorageManager.SetSaveDisabled(true); - StorageManager.SetSaveDeviceSelected(m_iPad, false); + PlatformStorage.SetSaveDisabled(true); + PlatformStorage.SetSaveDeviceSelected(m_iPad, false); unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage( @@ -849,14 +849,14 @@ void UIScene_LoadMenu::LaunchGame(void) { } int UIScene_LoadMenu::CheckResetNetherReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // continue and reset the nether pClass->LaunchGame(); - } else if (result == C4JStorage::EMessage_ResultAccept) { + } else if (result == IPlatformStorage::EMessage_ResultAccept) { // turn off the reset nether and continue pClass->m_MoreOptionsParams.bResetNether = false; pClass->LaunchGame(); @@ -868,34 +868,34 @@ int UIScene_LoadMenu::CheckResetNetherReturned( } int UIScene_LoadMenu::ConfirmLoadReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { if (pClass->m_levelGen != nullptr) { pClass->m_bIsCorrupt = false; pClass->LoadDataComplete(pClass); } else { // set the save to load - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); app.DebugPrintf( "Loading save %s [%s]\n", pSaveDetails->SaveInfoA[(int)pClass->m_iSaveGameInfoIndex] .UTF8SaveTitle, pSaveDetails->SaveInfoA[(int)pClass->m_iSaveGameInfoIndex] .UTF8SaveFilename); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveData( + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveData( &pSaveDetails->SaveInfoA[(int)pClass->m_iSaveGameInfoIndex], [pClass](const bool bCorrupt, const bool bOwner) { return pClass->loadSaveDataReturned(bCorrupt, bOwner); }); #if TO_BE_IMPLEMENTED - if (eLoadStatus == C4JStorage::ELoadGame_DeviceRemoved) { + if (eLoadStatus == IPlatformStorage::ELoadGame_DeviceRemoved) { // disable saving - StorageManager.SetSaveDisabled(true); - StorageManager.SetSaveDeviceSelected(m_iPad, false); + PlatformStorage.SetSaveDisabled(true); + PlatformStorage.SetSaveDeviceSelected(m_iPad, false); unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage( @@ -1026,19 +1026,19 @@ int UIScene_LoadMenu::loadSaveDataReturned(bool bIsCorrupt, bool bIsOwner) { } int UIScene_LoadMenu::TrophyDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; return LoadDataComplete(pClass); } int UIScene_LoadMenu::DeleteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); - StorageManager.DeleteSaveData( + if (result == IPlatformStorage::EMessage_ResultDecline) { + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); + PlatformStorage.DeleteSaveData( &pSaveDetails->SaveInfoA[(int)pClass->m_iSaveGameInfoIndex], [pClass](const bool bSuccess) { return pClass->deleteSaveDataReturned(bSuccess); @@ -1063,11 +1063,11 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, if (pClass->m_levelGen == nullptr) { int32_t saveOrCheckpointId = 0; bool validSave = - StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); } else { - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); // Make our next save default to the name of the level - StorageManager.SetSaveTitle( + PlatformStorage.SetSaveTitle( pClass->m_levelGen->getDefaultSaveName().c_str()); } @@ -1080,7 +1080,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, ? true : false; - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); NetworkGameInitData* param = new NetworkGameInitData(); param->seed = pClass->m_seed; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h index 38cb289f3..837e68c12 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "IUIScene_StartGame.h" #include "app/common/DLC/DLCPack.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -120,19 +120,19 @@ private: void LaunchGame(void); static int ConfirmLoadReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static void StartGameFromSave(UIScene_LoadMenu* pClass, int localUsersMask); int loadSaveDataReturned(bool bIsCorrupt, bool bIsOwner); static int TrophyDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int LoadDataComplete(void* pParam); static int CheckResetNetherReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int DeleteSaveDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bSuccess); static int MustSignInReturnedPSN(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, 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 d78366689..6e668360f 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 @@ -194,10 +194,10 @@ void UIScene_LoadOrJoinMenu::updateTooltips() { } else if (DoesSavesListHaveFocus()) { if ((m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC)) { - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { iRB = IDS_TOOLTIPS_DELETESAVE; } else { - if (StorageManager.EnoughSpaceForAMinSaveGame()) { + if (PlatformStorage.EnoughSpaceForAMinSaveGame()) { iRB = IDS_TOOLTIPS_SAVEOPTIONS; } else { iRB = IDS_TOOLTIPS_DELETESAVE; @@ -216,7 +216,7 @@ void UIScene_LoadOrJoinMenu::updateTooltips() { iLB = IDS_TOOLTIPS_PARTY_GAMES; } - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { } else { #if defined(SONY_REMOTE_STORAGE_DOWNLOAD) // Is there a save from PS3 or PSVita available? @@ -247,9 +247,9 @@ void UIScene_LoadOrJoinMenu::Initialise() { m_iDefaultButtonsC = 0; m_iMashUpButtonsC = 0; - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { #if TO_BE_IMPLEMENTED - if (StorageManager.GetSaveDeviceSelected(m_iPad)) + if (PlatformStorage.GetSaveDeviceSelected(m_iPad)) #endif { // saving is disabled, but we should still be able to load from a @@ -266,7 +266,7 @@ void UIScene_LoadOrJoinMenu::Initialise() { } else { // 4J-PB - we need to check that there is enough space left to create a // copy of the save (for a rename) - bool bCanRename = StorageManager.EnoughSpaceForAMinSaveGame(); + bool bCanRename = PlatformStorage.EnoughSpaceForAMinSaveGame(); GetSaveInfo(); } @@ -376,7 +376,7 @@ void UIScene_LoadOrJoinMenu::tick() { #endif // Display the saves if we have them if (!m_bSavesDisplayed) { - m_pSaveDetails = StorageManager.ReturnSavesInfo(); + m_pSaveDetails = PlatformStorage.ReturnSavesInfo(); if (m_pSaveDetails != nullptr) { // CD - Fix - Adding define for ORBIS/XBOXONE @@ -419,15 +419,15 @@ void UIScene_LoadOrJoinMenu::tick() { m_bRetrievingSaveThumbnails = true; app.DebugPrintf("Requesting the first thumbnail\n"); // set the save to load - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveDataThumbnail( + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveDataThumbnail( &pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId], [this](std::uint8_t* data, unsigned int bytes) { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != C4JStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -485,16 +485,16 @@ void UIScene_LoadOrJoinMenu::tick() { app.DebugPrintf("Requesting another thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails = - StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveDataThumbnail( + PlatformStorage.ReturnSavesInfo(); + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveDataThumbnail( &pSaveDetails ->SaveInfoA[(int)m_iRequestingThumbnailId], [this](std::uint8_t* data, unsigned int bytes) { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != C4JStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -541,7 +541,7 @@ void UIScene_LoadOrJoinMenu::tick() { m_bSavesDisplayed = false; m_iSaveInfoC = 0; m_buttonListSaves.clearList(); - StorageManager.ClearSavesInfo(); + PlatformStorage.ClearSavesInfo(); GetSaveInfo(); m_iState = e_SavesIdle; break; @@ -597,14 +597,14 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() { m_iSaveInfoC = 0; m_controlSavesTimer.setVisible(true); - m_pSaveDetails = StorageManager.ReturnSavesInfo(); + m_pSaveDetails = PlatformStorage.ReturnSavesInfo(); if (m_pSaveDetails == nullptr) { - C4JStorage::ESaveGameState eSGIStatus = StorageManager.GetSavesInfo( + IPlatformStorage::ESaveGameState eSGIStatus = PlatformStorage.GetSavesInfo( m_iPad, nullptr, (char*)"save"); } #if TO_BE_IMPLEMENTED - if (eSGIStatus == C4JStorage::ESGIStatus_NoSaves) { + if (eSGIStatus == IPlatformStorage::ESGIStatus_NoSaves) { uiSaveC = 0; m_controlSavesTimer.setVisible(false); m_SavesList.SetEnable(true); @@ -696,7 +696,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, // the SD screen, disconnects from LIVE, and then selects a SD, the // title crashes. m_bIgnoreInput = true; - StorageManager.SetSaveDevice( + PlatformStorage.SetSaveDevice( &CScene_MultiGameJoinLoad::DeviceSelectReturned, this, true); ui.PlayUISFX(eSFX_Press); #endif @@ -721,7 +721,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, m_bIgnoreInput = true; // Could be delete save or Save Options - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { // delete the save game // Have to ask the player if they are sure they want to // delete this game @@ -734,7 +734,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, &UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned, this); } else { - if (StorageManager.EnoughSpaceForAMinSaveGame()) { + if (PlatformStorage.EnoughSpaceForAMinSaveGame()) { unsigned int uiIDA[4]; uiIDA[0] = IDS_CONFIRM_CANCEL; uiIDA[1] = IDS_TITLE_RENAMESAVE; @@ -1023,9 +1023,9 @@ void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions* levelGen) { // clear out the app's terrain features list app.ClearTerrainFeaturePosition(); - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); // Make our next save default to the name of the level - StorageManager.SetSaveTitle(levelGen->getDefaultSaveName().c_str()); + PlatformStorage.SetSaveTitle(levelGen->getDefaultSaveName().c_str()); bool isClientSide = false; bool isPrivate = false; @@ -1287,10 +1287,10 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk( File* saveFile, ESavePlatform savePlatform /*= SAVE_FILE_PLATFORM_LOCAL*/) { // we'll only be coming in here when the tutorial is loaded now - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); // Make our next save default to the name of the level - StorageManager.SetSaveTitle(saveFile->getName().c_str()); + PlatformStorage.SetSaveTitle(saveFile->getName().c_str()); int64_t fileSize = saveFile->length(); FileInputStream fis(*saveFile); @@ -1347,14 +1347,14 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud() { strlen(app.getRemoteStorage()->getLocalFilename()) + 1); // plus null File cloudFile(wFileName); - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); // Make our next save default to the name of the level wchar_t wSaveName[128]; mbstowcs( wSaveName, app.getRemoteStorage()->getSaveNameUTF8(), strlen(app.getRemoteStorage()->getSaveNameUTF8()) + 1); // plus null - StorageManager.SetSaveTitle(wSaveName); + PlatformStorage.SetSaveTitle(wSaveName); int64_t fileSize = cloudFile.length(); FileInputStream fis(cloudFile); @@ -1407,7 +1407,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud() { #endif int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; // results switched for this dialog @@ -1417,13 +1417,13 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned( pClass->m_iDefaultButtonsC != 0 && pClass->m_iSaveListIndex >= pClass->m_iDefaultButtonsC; - if (result == C4JStorage::EMessage_ResultDecline && validSelection) { + if (result == IPlatformStorage::EMessage_ResultDecline && validSelection) { if (app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) { pClass->m_bIgnoreInput = false; } else { { size_t cbId = pClass->GetCallbackUniqueId(); - StorageManager.DeleteSaveData( + PlatformStorage.DeleteSaveData( &pClass->m_pSaveDetails ->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC], @@ -1470,13 +1470,13 @@ int UIScene_LoadOrJoinMenu::renameSaveDataReturned(bool bRes) { } int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; // results switched for this dialog // EMessage_ResultAccept means cancel switch (result) { - case C4JStorage::EMessage_ResultDecline: // rename + case IPlatformStorage::EMessage_ResultDecline: // rename { pClass->m_bIgnoreInput = true; // bring up a keyboard @@ -1499,7 +1499,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( IPlatformInput::EKeyboardMode_Default); } break; - case C4JStorage::EMessage_ResultThirdOption: // delete - + case IPlatformStorage::EMessage_ResultThirdOption: // delete - { // delete the save game // Have to ask the player if they are sure they want to delete this @@ -1513,7 +1513,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( } break; #if defined(SONY_REMOTE_STORAGE_UPLOAD) - case C4JStorage::EMessage_ResultFourthOption: // upload to cloud + case IPlatformStorage::EMessage_ResultFourthOption: // upload to cloud { unsigned int uiIDA[2]; uiIDA[0] = IDS_CONFIRM_OK; @@ -1526,7 +1526,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( } break; #endif - case C4JStorage::EMessage_Cancelled: + case IPlatformStorage::EMessage_Cancelled: default: { // reset the tooltips pClass->updateTooltips(); @@ -1537,11 +1537,11 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( } int UIScene_LoadOrJoinMenu::TexturePackDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; // Exit with or without saving - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { // we need to enable background downloading for the DLC // XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); } @@ -1606,7 +1606,7 @@ int UIScene_LoadOrJoinMenu::loadCrossSaveDataCallback(bool bIsCorrupt, } int UIScene_LoadOrJoinMenu::CrossSaveFinishedCallback( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; pClass->m_eSaveTransferState = eSaveTransfer_Idle; return 0; @@ -1618,7 +1618,7 @@ int UIScene_LoadOrJoinMenu::crossSaveDeleteOnErrorReturned(bool bRes) { } int UIScene_LoadOrJoinMenu::RemoteSaveNotFoundCallback( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; pClass->m_eSaveTransferState = eSaveTransfer_Idle; return 0; @@ -1696,27 +1696,27 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { } break; case eSaveTransfer_CreateDummyFile: { - StorageManager.ResetSaveData(); - byte* compData = (byte*)StorageManager.AllocateSaveData( + PlatformStorage.ResetSaveData(); + byte* compData = (byte*)PlatformStorage.AllocateSaveData( app.getRemoteStorage()->getSaveFilesize()); // Make our next save default to the name of the level const char* pNameUTF8 = app.getRemoteStorage()->getSaveNameUTF8(); mbstowcs(wSaveName, pNameUTF8, strlen(pNameUTF8) + 1); // plus null - StorageManager.SetSaveTitle(wSaveName); + PlatformStorage.SetSaveTitle(wSaveName); std::uint8_t* pbThumbnailData = nullptr; unsigned int dwThumbnailDataSize = 0; std::uint8_t* pbDataSaveImage = nullptr; unsigned int dwDataSizeSaveImage = 0; - StorageManager.GetDefaultSaveImage( + PlatformStorage.GetDefaultSaveImage( &pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail // (as set by SetDefaultImages) for // use on saving games t - StorageManager.GetDefaultSaveThumbnail( + PlatformStorage.GetDefaultSaveThumbnail( &pbThumbnailData, &dwThumbnailDataSize); // Get the default save image (as // set by SetDefaultImages) for use @@ -1731,17 +1731,17 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { hostOptions, app.getRemoteStorage()->getSaveTexturePack()); // set the icon and save image - StorageManager.SetSaveImages( + PlatformStorage.SetSaveImages( pbThumbnailData, dwThumbnailDataSize, pbDataSaveImage, dwDataSizeSaveImage, bTextMetadata, iTextMetadataBytes); - app.getRemoteStorage()->waitForStorageManagerIdle(); - C4JStorage::ESaveGameState saveState = - StorageManager.SaveSaveData( + app.getRemoteStorage()->waitForPlatformStorageIdle(); + IPlatformStorage::ESaveGameState saveState = + PlatformStorage.SaveSaveData( [pClass](const bool bRes) { return pClass->createDummySaveDataCallback(bRes); }); - if (saveState == C4JStorage::ESaveGame_Save) { + if (saveState == IPlatformStorage::ESaveGame_Save) { pClass->m_eSaveTransferState = eSaveTransfer_CreatingDummyFile; } else { @@ -1766,10 +1766,10 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { m_wstrStageText); } - app.getRemoteStorage()->waitForStorageManagerIdle(); + app.getRemoteStorage()->waitForPlatformStorageIdle(); app.DebugPrintf("CALL GetSavesInfo B\n"); - C4JStorage::ESaveGameState eSGIStatus = - StorageManager.GetSavesInfo( + IPlatformStorage::ESaveGameState eSGIStatus = + PlatformStorage.GetSavesInfo( pClass->m_iPad, [pClass](SAVE_DETAILS* pSaveDetails, const bool bRes) { return pClass->crossSaveGetSavesInfoCallback( @@ -1794,16 +1794,16 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { case eSaveTransfer_GetFileData: { bSaveFileCreated = true; - StorageManager.GetSaveUniqueFileDir( + PlatformStorage.GetSaveUniqueFileDir( pClass->m_downloadedUniqueFilename); if (pClass->m_saveTransferDownloadCancelled) { pClass->m_eSaveTransferState = eSaveTransfer_Error; break; } - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); int idx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; - app.getRemoteStorage()->waitForStorageManagerIdle(); + app.getRemoteStorage()->waitForPlatformStorageIdle(); bool bGettingOK = app.getRemoteStorage()->getSaveData( pClass->m_downloadedUniqueFilename, SaveTransferReturned, pClass); @@ -1846,7 +1846,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { break; } - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); int saveInfoIndex = -1; for (int i = 0; i < pSaveDetails->iSaveC; i++) { if (strcmp(pSaveDetails->SaveInfoA[i].UTF8SaveFilename, @@ -1861,15 +1861,15 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { "CrossSaveGetSavesInfoCallback failed - couldn't find " "save\n"); } else { - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveData( + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveData( &pSaveDetails->SaveInfoA[saveInfoIndex], [pClass](const bool bIsCorrupt, const bool bIsOwner) { return pClass->loadCrossSaveDataCallback( bIsCorrupt, bIsOwner); }); - if (eLoadStatus == C4JStorage::ESaveGame_Load) { + if (eLoadStatus == IPlatformStorage::ESaveGame_Load) { pClass->m_eSaveTransferState = eSaveTransfer_LoadingSaveFromDisc; } else { @@ -1881,12 +1881,12 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { break; case eSaveTransfer_CreatingNewSave: { - unsigned int fileSize = StorageManager.GetSaveSize(); + unsigned int fileSize = PlatformStorage.GetSaveSize(); std::vector ba(fileSize); - StorageManager.GetSaveData(ba.data(), &fileSize); + PlatformStorage.GetSaveData(ba.data(), &fileSize); assert(ba.size() == fileSize); - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); { std::uint8_t* pbThumbnailData = nullptr; unsigned int dwThumbnailDataSize = 0; @@ -1894,13 +1894,13 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { std::uint8_t* pbDataSaveImage = nullptr; unsigned int dwDataSizeSaveImage = 0; - StorageManager.GetDefaultSaveImage( + PlatformStorage.GetDefaultSaveImage( &pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save // thumbnail (as set by // SetDefaultImages) for use on // saving games t - StorageManager.GetDefaultSaveThumbnail( + PlatformStorage.GetDefaultSaveThumbnail( &pbThumbnailData, &dwThumbnailDataSize); // Get the default save image // (as set by SetDefaultImages) @@ -1918,7 +1918,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { app.getRemoteStorage()->getSaveTexturePack()); // set the icon and save image - StorageManager.SetSaveImages( + PlatformStorage.SetSaveImages( pbThumbnailData, dwThumbnailDataSize, pbDataSaveImage, dwDataSizeSaveImage, bTextMetadata, iTextMetadataBytes); } @@ -1949,12 +1949,12 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { pClass->m_eSaveTransferState = eSaveTransfer_Saving; pMinecraft->progressRenderer->progressStage( IDS_SAVETRANSFER_STAGE_SAVING); - StorageManager.SetSaveTitle(wSaveName); - StorageManager.SetSaveUniqueFilename( + PlatformStorage.SetSaveTitle(wSaveName); + PlatformStorage.SetSaveUniqueFilename( pClass->m_downloadedUniqueFilename); app.getRemoteStorage() - ->waitForStorageManagerIdle(); // we need to wait for the + ->waitForPlatformStorageIdle(); // we need to wait for the // save system to be idle // here, as Flush doesn't // check for it. @@ -1981,7 +1981,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; app.getRemoteStorage() - ->waitForStorageManagerIdle(); // wait for everything to + ->waitForPlatformStorageIdle(); // wait for everything to // complete before we hand // control back to the // player @@ -2015,7 +2015,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { // if the save file has already been created we have to // delete it again if there's been an error PSAVE_DETAILS pSaveDetails = - StorageManager.ReturnSavesInfo(); + PlatformStorage.ReturnSavesInfo(); int saveInfoIndex = -1; for (int i = 0; i < pSaveDetails->iSaveC; i++) { if (strcmp(pSaveDetails->SaveInfoA[i].UTF8SaveFilename, @@ -2033,20 +2033,20 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { eSaveTransfer_ErrorMesssage; } else { // delete the save file - app.getRemoteStorage()->waitForStorageManagerIdle(); - C4JStorage::ESaveGameState eDeleteStatus = - StorageManager.DeleteSaveData( + app.getRemoteStorage()->waitForPlatformStorageIdle(); + IPlatformStorage::ESaveGameState eDeleteStatus = + PlatformStorage.DeleteSaveData( &pSaveDetails->SaveInfoA[saveInfoIndex], [pClass](const bool bRes) { return pClass ->crossSaveDeleteOnErrorReturned(bRes); }); - if (eDeleteStatus == C4JStorage::ESaveGame_Delete) { + if (eDeleteStatus == IPlatformStorage::ESaveGame_Delete) { pClass->m_eSaveTransferState = eSaveTransfer_ErrorDeletingSave; } else { app.DebugPrintf( - "StorageManager.DeleteSaveData failed!!\n"); + "PlatformStorage.DeleteSaveData failed!!\n"); pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; } @@ -2060,7 +2060,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { break; case eSaveTransfer_ErrorMesssage: { app.getRemoteStorage() - ->waitForStorageManagerIdle(); // wait for everything to + ->waitForPlatformStorageIdle(); // wait for everything to // complete before we hand // control back to the // player diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h index af480fcd1..666f636ff 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.h @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" @@ -140,11 +140,11 @@ public: unsigned int thumbnailBytes); static int LoadSaveCallback(void* lpParam, bool bRes); static int DeleteSaveDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int SaveOptionsDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int TexturePackDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bRes); int renameSaveDataReturned(bool bRes); int handleKeyboardCompleteWorldName(bool bRes); @@ -202,10 +202,10 @@ private: int crossSaveGetSavesInfoCallback(SAVE_DETAILS* pSaveDetails, bool bRes); int loadCrossSaveDataCallback(bool bIsCorrupt, bool bIsOwner); static int CrossSaveFinishedCallback(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); int crossSaveDeleteOnErrorReturned(bool bRes); static int RemoteSaveNotFoundCallback(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int DownloadSonyCrossSaveThreadProc(void* lpParameter); static void SaveTransferReturned(void* lpParam, SonyRemoteStorage::Status s, int error_code); @@ -238,8 +238,8 @@ private: int error_code); static void CancelSaveUploadCallback(void* lpParam); static int SaveTransferDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int CrossSaveUploadFinishedCallback( - void* pParam, int iPad, C4JStorage::EMessageResult result); + void* pParam, int iPad, IPlatformStorage::EMessageResult result); #endif }; \ No newline at end of file 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 896d14489..9c2566ebf 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 @@ -394,10 +394,10 @@ void UIScene_MainMenu::customDrawSplash(IggyCustomDrawCallbackRegion* region) { } int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { // we need to specify local game here to display local and LIVE profiles // in the list switch (pClass->m_eAction) { @@ -556,7 +556,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, if (app.GetTMSDLCInfoRead() && app.GetTMSXUIDsFileRead() && app.GetBanListRead(iPad)) { - if (StorageManager.SetSaveDevice( + if (PlatformStorage.SetSaveDevice( &UIScene_MainMenu::DeviceSelectReturned, pClass) == true) { // save device already selected @@ -749,11 +749,11 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, } int UIScene_MainMenu::ExitGameReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result) { + IPlatformStorage::EMessageResult result) { // UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; // buttons reversed on this - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // XLaunchNewImage(XLAUNCH_KEYWORD_DASH_ARCADE, 0); app.ExitGame(); } @@ -799,12 +799,12 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { #if TO_BE_IMPLEMENTED // Check if there is any new DLC app.ClearNewDLCAvailable(); - StorageManager.GetAvailableDLCCount(iPad); + PlatformStorage.GetAvailableDLCCount(iPad); // check if all the TMS files are loaded if (app.GetTMSDLCInfoRead() && app.GetTMSXUIDsFileRead() && app.GetBanListRead(iPad)) { - if (StorageManager.SetSaveDevice( + if (PlatformStorage.SetSaveDevice( &CScene_Main::DeviceSelectReturned, this) == true) { // change the minecraft player name pMinecraft->user->name = @@ -1048,17 +1048,17 @@ void UIScene_MainMenu::LoadTrial(void) { // clear out the app's terrain features list app.ClearTerrainFeaturePosition(); - StorageManager.ResetSaveData(); + PlatformStorage.ResetSaveData(); // No saving in the trial - StorageManager.SetSaveDisabled(true); + PlatformStorage.SetSaveDisabled(true); app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false); // Set the global flag, so that we don't disable saving again once the save // is complete app.SetGameHostOption(eGameHostOption_DisableSaving, 1); - StorageManager.SetSaveTitle(L"Tutorial"); + PlatformStorage.SetSaveTitle(L"Tutorial"); // Reset the autosave time app.SetAutosaveTimerTime(); diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h index f79a276da..89892fa19 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -145,14 +145,14 @@ private: static int Achievements_SignInReturned(void* pParam, bool bContinue, int iPad); static int MustSignInReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int Leaderboards_SignInReturned(void* pParam, bool bContinue, int iPad); static int UnlockFullGame_SignInReturned(void* pParam, bool bContinue, int iPad); static int ExitGameReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); bool m_bRunGameChosen; int32_t m_errorCode; bool m_bErrorDialogRunning; 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 5dabd1970..7284a450c 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp @@ -70,8 +70,8 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void* initData, // example) doHorizontalResizeCheck(); - // StorageManager.TMSPP_GetUserQuotaInfo(C4JStorage::eGlobalStorage_TitleUser,iPad); - // StorageManager.WebServiceRequestGetFriends(iPad); + // PlatformStorage.TMSPP_GetUserQuotaInfo(IPlatformStorage::eGlobalStorage_TitleUser,iPad); + // PlatformStorage.WebServiceRequestGetFriends(iPad); } UIScene_HelpAndOptionsMenu::~UIScene_HelpAndOptionsMenu() {} 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 d69287aca..13db8b4e4 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp @@ -144,11 +144,11 @@ void UIScene_SettingsMenu::handlePress(F64 controlId, F64 childId) { } int UIScene_SettingsMenu::ResetDefaultsDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_SettingsMenu* pClass = (UIScene_SettingsMenu*)pParam; // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { app.SetDefaultOptions( PlatformProfile.GetDashboardProfileSettings(pClass->m_iPad), pClass->m_iPad); diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h index fd47ffd53..c9109c033 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" @@ -52,5 +52,5 @@ protected: void handlePress(F64 controlId, F64 childId); static int ResetDefaultsDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); }; \ No newline at end of file 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 9bbedf0eb..914c330e9 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -1229,10 +1229,10 @@ void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) { } int UIScene_SkinSelectMenu::UnlockSkinReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_SkinSelectMenu* pScene = (UIScene_SkinSelectMenu*)pParam; - if ((result == C4JStorage::EMessage_ResultAccept) && + if ((result == IPlatformStorage::EMessage_ResultAccept) && PlatformProfile.IsSignedIn(iPad)) { if (PlatformProfile.IsSignedInLive(iPad)) { } else // Is signed in, but not live. diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h index bd2b004cd..28315e94a 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/DLC/DLCPack.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" @@ -162,7 +162,7 @@ private: void showNotOnlineDialog(int iPad); static int UnlockSkinReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int RenableInput(void* lpVoid, int, int); void AddFavoriteSkin(int iPad, int iSkinID); 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 2e2ce00ad..a31062d8b 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/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" @@ -108,7 +108,7 @@ void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId) { ->getSessionTimer(); } - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { uiIDA[0] = IDS_CONFIRM_CANCEL; uiIDA[1] = IDS_CONFIRM_OK; ui.RequestAlertMessage( 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 8e2a3358b..c5954b197 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 @@ -434,11 +434,11 @@ void UIScene_InGameInfoMenu::OnPlayerChanged(void* callbackParam, } int UIScene_InGameInfoMenu::KickPlayerReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { std::uint8_t smallId = *(std::uint8_t*)pParam; delete (std::uint8_t*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { Minecraft* pMinecraft = Minecraft::GetInstance(); std::shared_ptr localPlayer = pMinecraft->localplayers[iPad]; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h index cd670822e..ce3c4ee1d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h @@ -4,7 +4,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -74,7 +74,7 @@ protected: public: static int KickPlayerReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static void OnPlayerChanged(void* callbackParam, INetworkPlayer* pPlayer, bool leaving); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp index f22a2fe04..80c3ffc85 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp @@ -590,11 +590,11 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId) { } int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { std::uint8_t smallId = *(std::uint8_t*)pParam; delete (std::uint8_t*)pParam; - if (result == C4JStorage::EMessage_ResultAccept) { + if (result == IPlatformStorage::EMessage_ResultAccept) { Minecraft* pMinecraft = Minecraft::GetInstance(); std::shared_ptr localPlayer = pMinecraft->localplayers[iPad]; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h index 7a1863f6f..cadd3122d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.h @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -101,7 +101,7 @@ public: virtual void handlePress(F64 controlId, F64 childId); static int KickPlayerReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static void OnPlayerChanged(void* callbackParam, INetworkPlayer* pPlayer, bool leaving); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp index a32fe1edb..c31632e5a 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.cpp @@ -80,8 +80,8 @@ UIScene_InGameSaveManagementMenu::~UIScene_InGameSaveManagementMenu() { delete[] m_saveDetails; } app.unlockSaveNotification(); - StorageManager.SetSaveDisabled(false); - StorageManager.ContinueIncompleteOperation(); + PlatformStorage.SetSaveDisabled(false); + PlatformStorage.ContinueIncompleteOperation(); } void UIScene_InGameSaveManagementMenu::updateTooltips() { @@ -98,12 +98,12 @@ void UIScene_InGameSaveManagementMenu::updateTooltips() { void UIScene_InGameSaveManagementMenu::Initialise() { m_iSaveListIndex = 0; - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { GetSaveInfo(); } else { // 4J-PB - we need to check that there is enough space left to create a // copy of the save (for a rename) - bool bCanRename = StorageManager.EnoughSpaceForAMinSaveGame(); + bool bCanRename = PlatformStorage.EnoughSpaceForAMinSaveGame(); GetSaveInfo(); } @@ -154,7 +154,7 @@ void UIScene_InGameSaveManagementMenu::tick() { // Display the saves if we have them if (!m_bSavesDisplayed) { - m_pSaveDetails = StorageManager.ReturnSavesInfo(); + m_pSaveDetails = PlatformStorage.ReturnSavesInfo(); if (m_pSaveDetails != nullptr) { m_spaceIndicatorSaves.reset(); @@ -194,15 +194,15 @@ void UIScene_InGameSaveManagementMenu::tick() { m_bRetrievingSaveThumbnails = true; app.DebugPrintf("Requesting the first thumbnail\n"); // set the save to load - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveDataThumbnail( + PSAVE_DETAILS pSaveDetails = PlatformStorage.ReturnSavesInfo(); + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveDataThumbnail( &pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId], [this](std::uint8_t* data, unsigned int bytes) { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != C4JStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -259,16 +259,16 @@ void UIScene_InGameSaveManagementMenu::tick() { app.DebugPrintf("Requesting another thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails = - StorageManager.ReturnSavesInfo(); - C4JStorage::ESaveGameState eLoadStatus = - StorageManager.LoadSaveDataThumbnail( + PlatformStorage.ReturnSavesInfo(); + IPlatformStorage::ESaveGameState eLoadStatus = + PlatformStorage.LoadSaveDataThumbnail( &pSaveDetails ->SaveInfoA[(int)m_iRequestingThumbnailId], [this](std::uint8_t* data, unsigned int bytes) { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != C4JStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -295,7 +295,7 @@ void UIScene_InGameSaveManagementMenu::tick() { m_bSavesDisplayed = false; m_iSaveInfoC = 0; m_buttonListSaves.clearList(); - // StorageManager.ClearSavesInfo(); + // PlatformStorage.ClearSavesInfo(); // GetSaveInfo(); m_iState = e_SavesIdle; break; @@ -314,10 +314,10 @@ void UIScene_InGameSaveManagementMenu::GetSaveInfo() { m_iSaveInfoC = 0; m_controlSavesTimer.setVisible(true); - m_pSaveDetails = StorageManager.ReturnSavesInfo(); + m_pSaveDetails = PlatformStorage.ReturnSavesInfo(); if (m_pSaveDetails == nullptr) { - C4JStorage::ESaveGameState eSGIStatus = - StorageManager.GetSavesInfo(m_iPad, nullptr, (char*)"save"); + IPlatformStorage::ESaveGameState eSGIStatus = + PlatformStorage.GetSavesInfo(m_iPad, nullptr, (char*)"save"); } return; @@ -394,16 +394,16 @@ void UIScene_InGameSaveManagementMenu::handlePress(F64 controlId, F64 childId) { } int UIScene_InGameSaveManagementMenu::DeleteSaveDialogReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_InGameSaveManagementMenu* pClass = (UIScene_InGameSaveManagementMenu*)pParam; // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { if (app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) { pClass->m_bIgnoreInput = false; } else { - StorageManager.DeleteSaveData( + PlatformStorage.DeleteSaveData( &pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex], [pClass](const bool bRes) { return pClass->deleteSaveDataReturned(bRes); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h index bd95c92c5..a96c8d79c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameSaveManagementMenu.h @@ -93,7 +93,7 @@ public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, unsigned int thumbnailBytes); static int DeleteSaveDialogReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bRes); protected: 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 f3d26fe92..5ea18e53b 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 @@ -169,7 +169,7 @@ void UIScene_PauseMenu::updateControlsVisibility() { } // is saving disabled? - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { } } @@ -223,7 +223,7 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, // SD, the title crashes. m_bIgnoreInput = true; - StorageManager.SetSaveDevice( + PlatformStorage.SetSaveDevice( &UIScene_PauseMenu::DeviceSelectReturned, this, true); } rfHandled = true; @@ -332,7 +332,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { ->getSessionTimer(); } - if (StorageManager.GetSaveDisabled()) { + if (PlatformStorage.GetSaveDisabled()) { uiIDA[0] = IDS_CONFIRM_CANCEL; uiIDA[1] = IDS_CONFIRM_OK; ui.RequestAlertMessage( @@ -418,8 +418,8 @@ void UIScene_PauseMenu::PerformActionSaveGame() { // does the save exist? bool bSaveExists; - C4JStorage::ESaveGameState result = - StorageManager.DoesSaveExist(&bSaveExists); + IPlatformStorage::ESaveGameState result = + PlatformStorage.DoesSaveExist(&bSaveExists); { // we need to ask if they are sure they want to overwrite the @@ -470,7 +470,7 @@ void UIScene_PauseMenu::HandleDLCMountingComplete() { } int UIScene_PauseMenu::UnlockFullSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { Minecraft* pMinecraft = Minecraft::GetInstance(); return 0; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h index 1bbc797af..957dcba9d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/IUIScene_PauseMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -45,7 +45,7 @@ private: virtual void HandleDLCMountingComplete(); virtual void HandleDLCInstalled(); static int UnlockFullSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int SaveGame_SignInReturned(void* pParam, bool bContinue, int iPad); public: diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp index 7068b8c65..e96515fa1 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp @@ -114,7 +114,7 @@ void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, if (pressed) { navigateBack(); if (m_Func) - m_Func(m_lpParam, iPad, C4JStorage::EMessage_Cancelled); + m_Func(m_lpParam, iPad, IPlatformStorage::EMessage_Cancelled); } break; case ACTION_MENU_OK: @@ -129,19 +129,19 @@ void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, } void UIScene_MessageBox::handlePress(F64 controlId, F64 childId) { - C4JStorage::EMessageResult result = C4JStorage::EMessage_Cancelled; + IPlatformStorage::EMessageResult result = IPlatformStorage::EMessage_Cancelled; switch ((int)controlId) { case 0: - result = C4JStorage::EMessage_ResultAccept; + result = IPlatformStorage::EMessage_ResultAccept; break; case 1: - result = C4JStorage::EMessage_ResultDecline; + result = IPlatformStorage::EMessage_ResultDecline; break; case 2: - result = C4JStorage::EMessage_ResultThirdOption; + result = IPlatformStorage::EMessage_ResultThirdOption; break; case 3: - result = C4JStorage::EMessage_ResultFourthOption; + result = IPlatformStorage::EMessage_ResultFourthOption; break; } diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.h b/targets/app/common/UI/Scenes/UIScene_MessageBox.h index 69c91028d..721aade9c 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.h +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -26,7 +26,7 @@ private: eControl_COUNT }; - int (*m_Func)(void*, int, const C4JStorage::EMessageResult); + int (*m_Func)(void*, int, const IPlatformStorage::EMessageResult); void* m_lpParam; int m_buttonCount; diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 561d4cbdd..e5032cb49 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -697,7 +697,7 @@ void UIController::CleanUpSkinReload() { if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { if (!Minecraft::GetInstance()->skins->getSelected()->hasAudio()) { const unsigned int result = - StorageManager.UnmountInstalledDLC("TPACK"); + PlatformStorage.UnmountInstalledDLC("TPACK"); } } @@ -1368,7 +1368,7 @@ void UIController::NavigateToHomeMenu() { // { // pDLCTexPack->m_pSoundBank->Destroy(); // } - const unsigned int result = StorageManager.UnmountInstalledDLC("TPACK"); + const unsigned int result = PlatformStorage.UnmountInstalledDLC("TPACK"); app.DebugPrintf("Unmount result is %d\n", result); } @@ -2070,14 +2070,14 @@ void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds) { } void UIController::ShowSavingMessage(unsigned int iPad, - C4JStorage::ESavingMessage eVal) { + IPlatformStorage::ESavingMessage eVal) { bool show = false; switch (eVal) { - case C4JStorage::ESavingMessage_None: + case IPlatformStorage::ESavingMessage_None: show = false; break; - case C4JStorage::ESavingMessage_Short: - case C4JStorage::ESavingMessage_Long: + case IPlatformStorage::ESavingMessage_Short: + case IPlatformStorage::ESavingMessage_Long: show = true; break; } @@ -2154,28 +2154,28 @@ void UIController::HidePressStart() { void UIController::ClearPressStart() { m_iPressStartQuadrantsMask = 0; } -C4JStorage::EMessageResult UIController::RequestAlertMessage( +IPlatformStorage::EMessageResult UIController::RequestAlertMessage( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const C4JStorage::EMessageResult), void* lpParam, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, wchar_t* pwchFormatString) { return RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pwchFormatString, 0, false); } -C4JStorage::EMessageResult UIController::RequestErrorMessage( +IPlatformStorage::EMessageResult UIController::RequestErrorMessage( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const C4JStorage::EMessageResult), void* lpParam, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, wchar_t* pwchFormatString) { return RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pwchFormatString, 0, true); } -C4JStorage::EMessageResult UIController::RequestMessageBox( +IPlatformStorage::EMessageResult UIController::RequestMessageBox( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const C4JStorage::EMessageResult), void* lpParam, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, wchar_t* pwchFormatString, unsigned int dwFocusButton, bool bIsError) { @@ -2214,15 +2214,15 @@ C4JStorage::EMessageResult UIController::RequestMessageBox( // This may happen if we had to queue the message box, or there was // already a message box displaying and so the NavigateToScene returned // false; - return C4JStorage::EMessage_Pending; + return IPlatformStorage::EMessage_Pending; } else { - return C4JStorage::EMessage_Busy; + return IPlatformStorage::EMessage_Busy; } } -C4JStorage::EMessageResult UIController::RequestUGCMessageBox( +IPlatformStorage::EMessageResult UIController::RequestUGCMessageBox( int title /* = -1 */, int message /* = -1 */, int iPad /* = -1*/, - int (*Func)(void*, int, const C4JStorage::EMessageResult) /* = nullptr*/, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult) /* = nullptr*/, void* lpParam /* = nullptr*/) { // Default title / messages if (title == -1) { @@ -2242,9 +2242,9 @@ C4JStorage::EMessageResult UIController::RequestUGCMessageBox( lpParam); } -C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox( +IPlatformStorage::EMessageResult UIController::RequestContentRestrictedMessageBox( int title /* = -1 */, int message /* = -1 */, int iPad /* = -1*/, - int (*Func)(void*, int, const C4JStorage::EMessageResult) /* = nullptr*/, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult) /* = nullptr*/, void* lpParam /* = nullptr*/) { // Default title / messages if (title == -1) { diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index 04dc7f98f..e0b23c42c 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -23,7 +23,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/UI/All Platforms/IUIController.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -410,7 +410,7 @@ public: virtual void ShowAutosaveCountdownTimer(bool show); virtual void UpdateAutosaveCountdownTimer(unsigned int uiSeconds); virtual void ShowSavingMessage(unsigned int iPad, - C4JStorage::ESavingMessage eVal); + IPlatformStorage::ESavingMessage eVal); virtual void ShowPlayerDisplayname(bool show); virtual bool PressStartPlaying(unsigned int iPad); @@ -418,33 +418,33 @@ public: virtual void HidePressStart(); void ClearPressStart(); - virtual C4JStorage::EMessageResult RequestAlertMessage( + virtual IPlatformStorage::EMessageResult RequestAlertMessage( uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, uint32_t dwPad = XUSER_INDEX_ANY, - int (*Func)(void*, int, const C4JStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr, wchar_t* pwchFormatString = nullptr); - virtual C4JStorage::EMessageResult RequestErrorMessage( + virtual IPlatformStorage::EMessageResult RequestErrorMessage( uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, uint32_t dwPad = XUSER_INDEX_ANY, - int (*Func)(void*, int, const C4JStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr, wchar_t* pwchFormatString = nullptr); private: - virtual C4JStorage::EMessageResult RequestMessageBox( + virtual IPlatformStorage::EMessageResult RequestMessageBox( uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, uint32_t dwPad, - int (*Func)(void*, int, const C4JStorage::EMessageResult), + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, wchar_t* pwchFormatString, uint32_t dwFocusButton, bool bIsError); public: - C4JStorage::EMessageResult RequestUGCMessageBox( + IPlatformStorage::EMessageResult RequestUGCMessageBox( int title = -1, int message = -1, int iPad = -1, - int (*Func)(void*, int, const C4JStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr); - C4JStorage::EMessageResult RequestContentRestrictedMessageBox( + IPlatformStorage::EMessageResult RequestContentRestrictedMessageBox( int title = -1, int message = -1, int iPad = -1, - int (*Func)(void*, int, const C4JStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr); virtual void SetWinUserIndex(unsigned int iPad); diff --git a/targets/app/linux/LinuxGame.cpp b/targets/app/linux/LinuxGame.cpp index 5c970cbd7..7ed076b48 100644 --- a/targets/app/linux/LinuxGame.cpp +++ b/targets/app/linux/LinuxGame.cpp @@ -6,7 +6,7 @@ #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" @@ -72,8 +72,8 @@ void LinuxGame::TemporaryCreateGameStart() { app.ClearTerrainFeaturePosition(); std::wstring wWorldName = L"TestWorld"; - StorageManager.ResetSaveData(); - StorageManager.SetSaveTitle(wWorldName.c_str()); + PlatformStorage.ResetSaveData(); + PlatformStorage.SetSaveTitle(wWorldName.c_str()); bool isFlat = false; int64_t seedValue = diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index 84a6669a7..c8fe148be 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -57,7 +57,7 @@ static void sigsegv_handler(int sig) { #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "app/common/App_Defines.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Network/GameNetworkManager.h" @@ -457,10 +457,10 @@ int main(int argc, const char* argv[]) { initGameServices(&services); ui.init(1920, 1080); // storage manager is needed for the trial key check - StorageManager.Init( + PlatformStorage.Init( 0, app.GetString(IDS_DEFAULT_SAVENAME), (char*)"savegame.dat", FIFTY_ONE_MB, - [](const C4JStorage::ESavingMessage eMsg, int iPad) { + [](const IPlatformStorage::ESavingMessage eMsg, int iPad) { return app.displaySavingMessage(eMsg, iPad); }, (char*)""); @@ -497,7 +497,7 @@ int main(int argc, const char* argv[]) { }); // Set a callback for when there is a read error on profile data - // StorageManager.SetProfileReadErrorCallback(&Game::ProfileReadErrorCallback, + // PlatformStorage.SetProfileReadErrorCallback(&Game::ProfileReadErrorCallback, // &app); // QNet needs to be setup after profile manager, as we do not want its @@ -535,7 +535,7 @@ int main(int argc, const char* argv[]) { PlatformProfile.Tick(); - StorageManager.Tick(); + PlatformStorage.Tick(); RenderManager.Tick(); diff --git a/targets/app/windows/Windows64_App.cpp b/targets/app/windows/Windows64_App.cpp index 515ea05f0..74d266cb9 100644 --- a/targets/app/windows/Windows64_App.cpp +++ b/targets/app/windows/Windows64_App.cpp @@ -63,8 +63,8 @@ void WindowsGame::TemporaryCreateGameStart() { app.ClearTerrainFeaturePosition(); std::wstring wWorldName = L"TestWorld"; - StorageManager.ResetSaveData(); - StorageManager.SetSaveTitle(wWorldName.c_str()); + PlatformStorage.ResetSaveData(); + PlatformStorage.SetSaveTitle(wWorldName.c_str()); bool isFlat = false; int64_t seedValue = diff --git a/targets/app/windows/src/Windows64_Minecraft.cpp b/targets/app/windows/src/Windows64_Minecraft.cpp index 703c40451..3d0a960ea 100644 --- a/targets/app/windows/src/Windows64_Minecraft.cpp +++ b/targets/app/windows/src/Windows64_Minecraft.cpp @@ -794,7 +794,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // PlatformProfile.Tick(); - StorageManager.Tick(); + PlatformStorage.Tick(); RenderManager.Tick(); diff --git a/targets/java/src/File.cpp b/targets/java/src/File.cpp index 4af84d5de..dcc73d5b9 100644 --- a/targets/java/src/File.cpp +++ b/targets/java/src/File.cpp @@ -97,7 +97,7 @@ File::File(const std::wstring& pathname) { #ifdef _WINDOWS64 std::string path = std::filesystem::path(m_abstractPathName).string(); - std::string finalPath = StorageManager.GetMountedPath(path.c_str()); + std::string finalPath = PlatformStorage.GetMountedPath(path.c_str()); if (finalPath.size() == 0) finalPath = path; m_abstractPathName = convStringToWstring(finalPath); #endif diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 9be44bec7..52b18a4c7 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -15,7 +15,7 @@ #include "platform/profile/profile.h" #include "platform/sdl2/Render.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" @@ -1074,7 +1074,7 @@ void Minecraft::run_middle() { // autosave If saving isn't disabled, and the main // player has a app action running , or has any crafting // or containers open, don't autosave - if (!StorageManager.GetSaveDisabled() && + if (!PlatformStorage.GetSaveDisabled() && (gameServices().getXuiAction(PlatformInput.GetPrimaryPad()) == eAppAction_Idle)) { if (!ui.IsPauseMenuDisplayed( diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index b5facb94f..662eb92b1 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -8,7 +8,7 @@ #include #include -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "Button.h" #include "EditBox.h" #include "MessageScreen.h" @@ -206,8 +206,8 @@ void CreateWorldScreen::buttonClicked(Button* button) { worldName = L"2slimey"; } - StorageManager.ResetSaveData(); - StorageManager.SetSaveTitle((wchar_t*)worldName.c_str()); + PlatformStorage.ResetSaveData(); + PlatformStorage.SetSaveTitle((wchar_t*)worldName.c_str()); std::wstring seedString = seedEdit->getValue(); diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index dbf1416cc..8aa82c20b 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -3428,7 +3428,7 @@ void ClientConnection::handleUpdateGameRuleProgressPacket( // Fix for #13191 - The host of a game can get a message informing them that the // connection to the server has been lost int ClientConnection::HostDisconnectReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // 4J-PB - if they have a trial texture pack, they don't get to save the // world if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { @@ -3448,7 +3448,7 @@ int ClientConnection::HostDisconnectReturned( // Give the player the option to save their game // does the save exist? bool bSaveExists; - StorageManager.DoesSaveExist(&bSaveExists); + PlatformStorage.DoesSaveExist(&bSaveExists); // 4J-PB - we check if the save exists inside the libs // we need to ask if they are sure they want to overwrite the existing game if (bSaveExists) { @@ -3469,12 +3469,12 @@ int ClientConnection::HostDisconnectReturned( } int ClientConnection::ExitGameAndSaveReturned( - void* pParam, int iPad, C4JStorage::EMessageResult result) { + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // results switched for this dialog - if (result == C4JStorage::EMessage_ResultDecline) { + if (result == IPlatformStorage::EMessage_ResultDecline) { // int32_t saveOrCheckpointId = 0; // bool validSave = - // StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + // PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); // SentientManager.RecordLevelSaveOrCheckpoint(PlatformInput.GetPrimaryPad(), // saveOrCheckpointId); MinecraftServer::getInstance()->setSaveOnExit(true); diff --git a/targets/minecraft/client/multiplayer/ClientConnection.h b/targets/minecraft/client/multiplayer/ClientConnection.h index 1285bc367..d182f6ac1 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.h +++ b/targets/minecraft/client/multiplayer/ClientConnection.h @@ -6,7 +6,7 @@ #include #include "util/Timer.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/DisconnectPacket.h" @@ -188,9 +188,9 @@ public: // 4J Added static int HostDisconnectReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); static int ExitGameAndSaveReturned(void* pParam, int iPad, - C4JStorage::EMessageResult result); + IPlatformStorage::EMessageResult result); virtual void handleTextureChange( std::shared_ptr packet); virtual void handleTextureAndGeometryChange( diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 2d9cb5a6e..65aa87701 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -8,7 +8,7 @@ #include #include "platform/input/input.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Colours/ColourTable.h" @@ -238,7 +238,7 @@ void DLCTexturePack::loadData() { int mountIndex = m_dlcInfoPack->GetDLCMountIndex(); if (mountIndex > -1) { - if (StorageManager.MountInstalledDLC( + if (PlatformStorage.MountInstalledDLC( PlatformInput.GetPrimaryPad(), mountIndex, [this](int pad, std::uint32_t err, std::uint32_t lic) { return onPackMounted(pad, err, lic); @@ -420,7 +420,7 @@ void DLCTexturePack::loadUI() { AbstractTexturePack::loadUI(); if (hasAudio() == false && !ui.IsReloadingSkin()) { - StorageManager.UnmountInstalledDLC("TPACK"); + PlatformStorage.UnmountInstalledDLC("TPACK"); } } diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index 3a3120121..20468abb4 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -14,7 +14,7 @@ #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "ConsoleInput.h" #include "DispenserBootstrap.h" #include "minecraft/GameEnums.h" @@ -860,7 +860,7 @@ void MinecraftServer::saveGameRules() { void MinecraftServer::Suspend() { m_suspending = true; time_util::Timer timer; - if (m_bLoaded && (!StorageManager.GetSaveDisabled())) { + if (m_bLoaded && (!PlatformStorage.GetSaveDisabled())) { if (players != nullptr) { players->saveAll(nullptr); } @@ -907,7 +907,7 @@ void MinecraftServer::stopServer(bool didInit) { // 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. - if (m_saveOnExit && (!StorageManager.GetSaveDisabled()) && didInit) { + if (m_saveOnExit && (!PlatformStorage.GetSaveDisabled()) && didInit) { if (players != nullptr) { players->saveAll(Minecraft::GetInstance()->progressRenderer, true); diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index 86c9be140..d672999d4 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -8,7 +8,7 @@ #include #include "platform/input/input.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "EntityTracker.h" #include "platform/ShutdownManager.h" #include "app/common/Console_Debug_enum.h" @@ -925,7 +925,7 @@ Pos* ServerLevel::getDimensionSpecificSpawn() { // 4j Added for XboxOne PLM void ServerLevel::Suspend() { - if (StorageManager.GetSaveDisabled()) return; + if (PlatformStorage.GetSaveDisabled()) return; saveLevelData(); chunkSource->saveAllEntities(); } @@ -935,7 +935,7 @@ void ServerLevel::save(bool force, ProgressListener* progressListener, if (!chunkSource->shouldSave()) return; // 4J-PB - check that saves are enabled - if (StorageManager.GetSaveDisabled()) return; + if (PlatformStorage.GetSaveDisabled()) return; if (progressListener != nullptr) { if (bAutosave) { @@ -983,7 +983,7 @@ void ServerLevel::save(bool force, ProgressListener* progressListener, void ServerLevel::saveToDisc(ProgressListener* progressListener, bool autosave) { // 4J-PB - check that saves are enabled - if (StorageManager.GetSaveDisabled()) return; + if (PlatformStorage.GetSaveDisabled()) return; // Check if we are using a trial version of a texture pack (which will be // the case for going into the mash-up pack world with a trial version) diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index f3c22b92b..2a8746dc8 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -8,7 +8,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/sdl2/Storage.h" +#include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/BuildVer/BuildVer.h" #include "app/common/Network/NetworkPlayerInterface.h" @@ -103,7 +103,7 @@ void PendingConnection::sendPreLoginResponse() { std::uint8_t ugcFriendsOnlyBits = 0; char szUniqueMapName[14]; - StorageManager.GetSaveUniqueFilename(szUniqueMapName); + PlatformStorage.GetSaveUniqueFilename(szUniqueMapName); PlayerList* playerList = MinecraftServer::getInstance()->getPlayers(); for (auto it = playerList->players.begin(); it != playerList->players.end(); diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index 24a668711..a9374fa06 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -33,7 +33,7 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" #include "minecraft/world/level/storage/LevelData.h" -#include "platform/IPlatformStorage.h" +#include "platform/storage/storage.h" #include "platform/PlatformServices.h" #define RESERVE_ALLOCATION MEM_RESERVE @@ -587,7 +587,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { // 4J Stu - Added TU-1 interim // Attempt to allocate the required memory - // We do not own this, it belongs to the StorageManager + // We do not own this, it belongs to the PlatformStorage std::uint8_t* compData = (std::uint8_t*)PlatformStorage.AllocateSaveData(compLength); diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 353f50448..b4fc4b149 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -37,7 +37,7 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" #include "minecraft/world/level/storage/LevelData.h" -#include "platform/IPlatformStorage.h" +#include "platform/storage/storage.h" #include "platform/PlatformServices.h" class ProgressListener; @@ -1299,7 +1299,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { // 4J Stu - Added TU-1 interim // Attempt to allocate the required memory - // We do not own this, it belongs to the StorageManager + // We do not own this, it belongs to the PlatformStorage std::uint8_t* compData = (std::uint8_t*)PlatformStorage.AllocateSaveData(compLength); diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index 0fb639d42..edf927cda 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -42,7 +42,7 @@ #include "nbt/DoubleTag.h" #include "nbt/ListTag.h" #include "nbt/NbtIo.h" -#include "platform/IPlatformStorage.h" +#include "platform/storage/storage.h" #include "platform/PlatformServices.h" const std::wstring DirectoryLevelStorage::sc_szPlayerDir(L"players/"); diff --git a/targets/platform/PlatformServices.cpp b/targets/platform/PlatformServices.cpp index 0963a3e75..0a1ccf85a 100644 --- a/targets/platform/PlatformServices.cpp +++ b/targets/platform/PlatformServices.cpp @@ -2,10 +2,8 @@ #include "StdFileIO.h" #include "sdl2/Render.h" -#include "sdl2/Storage.h" static StdFileIO s_stdFileIO; IPlatformFileIO& PlatformFileIO = s_stdFileIO; IPlatformRenderer& PlatformRender = RenderManager; -IPlatformStorage& PlatformStorage = StorageManager; diff --git a/targets/platform/PlatformServices.h b/targets/platform/PlatformServices.h index 2fe965439..915771d3c 100644 --- a/targets/platform/PlatformServices.h +++ b/targets/platform/PlatformServices.h @@ -4,7 +4,6 @@ #include "IPlatformLeaderboard.h" #include "IPlatformNetwork.h" #include "IPlatformRenderer.h" -#include "IPlatformStorage.h" // Interface references to platform services. Game code uses these // instead of concrete globals directly. Bindings are established @@ -12,4 +11,3 @@ extern IPlatformFileIO& PlatformFileIO; extern IPlatformRenderer& PlatformRender; -extern IPlatformStorage& PlatformStorage; diff --git a/targets/platform/ShutdownManager.h b/targets/platform/ShutdownManager.h index c56ab13fe..33f1019be 100644 --- a/targets/platform/ShutdownManager.h +++ b/targets/platform/ShutdownManager.h @@ -18,7 +18,7 @@ public: eRunUpdateThread, eRenderChunkUpdateThread, eServerThread, - eStorageManagerThreads, + ePlatformStorageThreads, eConnectionReadThreads, eConnectionWriteThreads, eEventQueueThreads, diff --git a/targets/platform/meson.build b/targets/platform/meson.build index 883c80490..b41600830 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -27,9 +27,9 @@ endif sdl2_sources = files( 'input/sdl2/SDL2Input.cpp', 'profile/stub/StubProfile.cpp', + 'storage/stub/StubStorage.cpp', 'sdl2/Render.cpp', 'sdl2/render_stubs.cpp', - 'sdl2/Storage.cpp', ) lib_platform_sdl2 = static_library('platform_sdl2', diff --git a/targets/platform/IPlatformStorage.h b/targets/platform/storage/IPlatformStorage.h similarity index 90% rename from targets/platform/IPlatformStorage.h rename to targets/platform/storage/IPlatformStorage.h index d17f7e82e..6f835a119 100644 --- a/targets/platform/IPlatformStorage.h +++ b/targets/platform/storage/IPlatformStorage.h @@ -8,12 +8,36 @@ #include "PlatformTypes.h" -struct SAVE_INFO; +#define MAX_DISPLAYNAME_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 +#define MAX_DETAILS_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 +#define MAX_SAVEFILENAME_LENGTH 32 // CELL_SAVEDATA_DIRNAME_SIZE +// Current version of the dlc data creator +#define CURRENT_DLC_VERSION_NUM 3 + +struct CONTAINER_METADATA { + time_t modifiedTime; + unsigned int dataSize; + unsigned int thumbnailSize; +}; + +struct SAVE_INFO { + char UTF8SaveFilename[MAX_SAVEFILENAME_LENGTH]; + char UTF8SaveTitle[MAX_DISPLAYNAME_LENGTH]; + CONTAINER_METADATA metaData; + std::uint8_t* thumbnailData; +}; using PSAVE_INFO = SAVE_INFO*; -struct SAVE_DETAILS; + +struct SAVE_DETAILS { + int iSaveC; + PSAVE_INFO SaveInfoA; +}; using PSAVE_DETAILS = SAVE_DETAILS*; + class C4JStringTable; + + class IPlatformStorage { public: // Enums live here so both the interface consumer and the concrete @@ -112,6 +136,21 @@ public: std::uint8_t bPadding[1024 - sizeof(std::uint32_t) * 4]; }; + struct DLC_FILE_DETAILS { + unsigned int uiFileSize; + std::uint32_t dwType; + std::uint32_t dwWchCount; + wchar_t wchFile[1]; + }; + using PDLC_FILE_DETAILS = DLC_FILE_DETAILS*; + + struct DLC_FILE_PARAM { + std::uint32_t dwType; + std::uint32_t dwWchCount; + wchar_t wchData[1]; + }; + using PDLC_FILE_PARAM = DLC_FILE_PARAM*; + virtual ~IPlatformStorage() = default; // Lifecycle diff --git a/targets/platform/storage/storage.h b/targets/platform/storage/storage.h new file mode 100644 index 000000000..0a6d962e7 --- /dev/null +++ b/targets/platform/storage/storage.h @@ -0,0 +1,3 @@ +#include "IPlatformStorage.h" + +extern IPlatformStorage& PlatformStorage; diff --git a/targets/platform/sdl2/Storage.cpp b/targets/platform/storage/stub/StubStorage.cpp similarity index 51% rename from targets/platform/sdl2/Storage.cpp rename to targets/platform/storage/stub/StubStorage.cpp index 012214a69..f93fcf86e 100644 --- a/targets/platform/sdl2/Storage.cpp +++ b/targets/platform/storage/stub/StubStorage.cpp @@ -1,4 +1,4 @@ -#include "Storage.h" +#include "StubStorage.h" #include @@ -6,187 +6,188 @@ #include #include -C4JStorage StorageManager; +StubStorage stub_storage_instance; +IPlatformStorage& PlatformStorage = stub_storage_instance; static XMARKETPLACE_CONTENTOFFER_INFO s_dummyOffer = {}; static XCONTENT_DATA s_dummyContentData = {}; -C4JStorage::C4JStorage() : m_pStringTable(nullptr) {} +StubStorage::StubStorage() : m_pStringTable(nullptr) {} -void C4JStorage::Tick(void) {} +void StubStorage::Tick(void) {} -C4JStorage::EMessageResult C4JStorage::RequestMessageBox( +StubStorage::EMessageResult StubStorage::RequestMessageBox( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int pad, - std::function callback, + std::function callback, C4JStringTable* pStringTable, wchar_t* pwchFormatString, unsigned int focusButton) { return EMessage_ResultAccept; } -C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult() { +StubStorage::EMessageResult StubStorage::GetMessageBoxResult() { return EMessage_Undefined; } -bool C4JStorage::SetSaveDevice(std::function callback, +bool StubStorage::SetSaveDevice(std::function callback, bool bForceResetOfSaveDevice) { return true; } -void C4JStorage::Init(unsigned int uiSaveVersion, +void StubStorage::Init(unsigned int uiSaveVersion, const wchar_t* pwchDefaultSaveName, char* pszSavePackName, int iMinimumSaveSize, std::function callback, const char* szGroupID) {} -void C4JStorage::ResetSaveData() {} -void C4JStorage::SetDefaultSaveNameForKeyboardDisplay( +void StubStorage::ResetSaveData() {} +void StubStorage::SetDefaultSaveNameForKeyboardDisplay( const wchar_t* pwchDefaultSaveName) {} -void C4JStorage::SetSaveTitle(const wchar_t* pwchDefaultSaveName) {} -bool C4JStorage::GetSaveUniqueNumber(int* piVal) { +void StubStorage::SetSaveTitle(const wchar_t* pwchDefaultSaveName) {} +bool StubStorage::GetSaveUniqueNumber(int* piVal) { if (piVal) *piVal = 0; return true; } -bool C4JStorage::GetSaveUniqueFilename(char* pszName) { +bool StubStorage::GetSaveUniqueFilename(char* pszName) { if (pszName) pszName[0] = '\0'; return true; } -void C4JStorage::SetSaveUniqueFilename(char* szFilename) {} -void C4JStorage::SetState(ESaveGameControlState eControlState, +void StubStorage::SetSaveUniqueFilename(char* szFilename) {} +void StubStorage::SetState(ESaveGameControlState eControlState, std::function callback) {} -void C4JStorage::SetSaveDisabled(bool bDisable) {} -bool C4JStorage::GetSaveDisabled(void) { return false; } -unsigned int C4JStorage::GetSaveSize() { return 0; } -void C4JStorage::GetSaveData(void* pvData, unsigned int* puiBytes) { +void StubStorage::SetSaveDisabled(bool bDisable) {} +bool StubStorage::GetSaveDisabled(void) { return false; } +unsigned int StubStorage::GetSaveSize() { return 0; } +void StubStorage::GetSaveData(void* pvData, unsigned int* puiBytes) { if (puiBytes) *puiBytes = 0; } -void* C4JStorage::AllocateSaveData(unsigned int uiBytes) { +void* StubStorage::AllocateSaveData(unsigned int uiBytes) { return malloc(uiBytes); } -void C4JStorage::SetSaveImages(std::uint8_t* pbThumbnail, +void StubStorage::SetSaveImages(std::uint8_t* pbThumbnail, unsigned int thumbnailBytes, std::uint8_t* pbImage, unsigned int imageBytes, std::uint8_t* pbTextData, unsigned int textDataBytes) {} -C4JStorage::ESaveGameState C4JStorage::SaveSaveData( +StubStorage::ESaveGameState StubStorage::SaveSaveData( std::function callback) { return ESaveGame_Idle; } -void C4JStorage::CopySaveDataToNewSave(std::uint8_t* pbThumbnail, +void StubStorage::CopySaveDataToNewSave(std::uint8_t* pbThumbnail, unsigned int cbThumbnail, wchar_t* wchNewName, std::function callback) {} -void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {} -bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; } -C4JStorage::ESaveGameState C4JStorage::DoesSaveExist(bool* pbExists) { +void StubStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {} +bool StubStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; } +StubStorage::ESaveGameState StubStorage::DoesSaveExist(bool* pbExists) { if (pbExists) *pbExists = false; return ESaveGame_Idle; } -bool C4JStorage::EnoughSpaceForAMinSaveGame() { return true; } -void C4JStorage::SetSaveMessageVPosition(float fY) {} -C4JStorage::ESaveGameState C4JStorage::GetSavesInfo( +bool StubStorage::EnoughSpaceForAMinSaveGame() { return true; } +void StubStorage::SetSaveMessageVPosition(float fY) {} +StubStorage::ESaveGameState StubStorage::GetSavesInfo( int iPad, std::function callback, char* pszSavePackName) { return ESaveGame_Idle; } -PSAVE_DETAILS C4JStorage::ReturnSavesInfo() { return nullptr; } -void C4JStorage::ClearSavesInfo() {} -C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail( +PSAVE_DETAILS StubStorage::ReturnSavesInfo() { return nullptr; } +void StubStorage::ClearSavesInfo() {} +StubStorage::ESaveGameState StubStorage::LoadSaveDataThumbnail( PSAVE_INFO pSaveInfo, std::function callback) { return ESaveGame_Idle; } -void C4JStorage::GetSaveCacheFileInfo(unsigned int fileIndex, +void StubStorage::GetSaveCacheFileInfo(unsigned int fileIndex, XCONTENT_DATA& xContentData) { memset(&xContentData, 0, sizeof(xContentData)); } -void C4JStorage::GetSaveCacheFileInfo(unsigned int fileIndex, +void StubStorage::GetSaveCacheFileInfo(unsigned int fileIndex, std::uint8_t** ppbImageData, unsigned int* pImageBytes) { if (ppbImageData) *ppbImageData = nullptr; if (pImageBytes) *pImageBytes = 0; } -C4JStorage::ESaveGameState C4JStorage::LoadSaveData( +StubStorage::ESaveGameState StubStorage::LoadSaveData( PSAVE_INFO pSaveInfo, std::function callback) { return ESaveGame_Idle; } -C4JStorage::ESaveGameState C4JStorage::DeleteSaveData( +StubStorage::ESaveGameState StubStorage::DeleteSaveData( PSAVE_INFO pSaveInfo, std::function callback) { return ESaveGame_Idle; } -void C4JStorage::RegisterMarketplaceCountsCallback( - std::function callback) {} -void C4JStorage::SetDLCPackageRoot(char* pszDLCRoot) {} -C4JStorage::EDLCStatus C4JStorage::GetDLCOffers( +void StubStorage::RegisterMarketplaceCountsCallback( + std::function callback) {} +void StubStorage::SetDLCPackageRoot(char* pszDLCRoot) {} +StubStorage::EDLCStatus StubStorage::GetDLCOffers( int iPad, std::function callback, std::uint32_t dwOfferTypesBitmask) { return EDLC_NoOffers; } -unsigned int C4JStorage::CancelGetDLCOffers() { return 0; } -void C4JStorage::ClearDLCOffers() {} -XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(unsigned int dw) { +unsigned int StubStorage::CancelGetDLCOffers() { return 0; } +void StubStorage::ClearDLCOffers() {} +XMARKETPLACE_CONTENTOFFER_INFO& StubStorage::GetOffer(unsigned int dw) { return s_dummyOffer; } -int C4JStorage::GetOfferCount() { return 0; } -unsigned int C4JStorage::InstallOffer(int iOfferIDC, std::uint64_t* ullOfferIDA, +int StubStorage::GetOfferCount() { return 0; } +unsigned int StubStorage::InstallOffer(int iOfferIDC, std::uint64_t* ullOfferIDA, std::function callback, bool bTrial) { return 0; } -unsigned int C4JStorage::GetAvailableDLCCount(int iPad) { return 0; } -C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC( +unsigned int StubStorage::GetAvailableDLCCount(int iPad) { return 0; } +StubStorage::EDLCStatus StubStorage::GetInstalledDLC( int iPad, std::function callback) { if (callback) { callback(0, iPad); } return EDLC_NoInstalledDLC; } -XCONTENT_DATA& C4JStorage::GetDLC(unsigned int dw) { +XCONTENT_DATA& StubStorage::GetDLC(unsigned int dw) { return s_dummyContentData; } -std::uint32_t C4JStorage::MountInstalledDLC( +std::uint32_t StubStorage::MountInstalledDLC( int iPad, std::uint32_t dwDLC, std::function callback, const char* szMountDrive) { return 0; } -unsigned int C4JStorage::UnmountInstalledDLC(const char* szMountDrive) { +unsigned int StubStorage::UnmountInstalledDLC(const char* szMountDrive) { return 0; } -void C4JStorage::GetMountedDLCFileList(const char* szMountDrive, +void StubStorage::GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList) { fileList.clear(); } -std::string C4JStorage::GetMountedPath(std::string szMount) { return ""; } -C4JStorage::ETMSStatus C4JStorage::ReadTMSFile( +std::string StubStorage::GetMountedPath(std::string szMount) { return ""; } +StubStorage::ETMSStatus StubStorage::ReadTMSFile( int iQuadrant, eGlobalStorage eStorageFacility, - C4JStorage::eTMS_FileType eFileType, wchar_t* pwchFilename, + StubStorage::eTMS_FileType eFileType, wchar_t* pwchFilename, std::uint8_t** ppBuffer, unsigned int* pBufferSize, std::function callback, int iAction) { return ETMSStatus_Fail; } -bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, +bool StubStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, wchar_t* pwchFilename, std::uint8_t* pBuffer, unsigned int bufferSize) { return false; } -bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, +bool StubStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, wchar_t* pwchFilename) { return false; } -void C4JStorage::StoreTMSPathName(wchar_t* pwchName) {} -C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile( - int iPad, C4JStorage::eGlobalStorage eStorageFacility, - C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, const char* szFilename, +void StubStorage::StoreTMSPathName(wchar_t* pwchName) {} +StubStorage::ETMSStatus StubStorage::TMSPP_ReadFile( + int iPad, StubStorage::eGlobalStorage eStorageFacility, + StubStorage::eTMS_FILETYPEVAL eFileTypeVal, const char* szFilename, std::function callback, int iUserData) { return ETMSStatus_Fail; } -unsigned int C4JStorage::CRC(unsigned char* buf, int len) { +unsigned int StubStorage::CRC(unsigned char* buf, int len) { unsigned int crc = 0xFFFFFFFF; for (int i = 0; i < len; i++) { crc ^= buf[i]; @@ -197,26 +198,26 @@ unsigned int C4JStorage::CRC(unsigned char* buf, int len) { return ~crc; } -int C4JStorage::AddSubfile(int regionIndex) { +int StubStorage::AddSubfile(int regionIndex) { (void)regionIndex; return 0; } -unsigned int C4JStorage::GetSubfileCount() { return 0; } -void C4JStorage::GetSubfileDetails(unsigned int i, int* regionIndex, +unsigned int StubStorage::GetSubfileCount() { return 0; } +void StubStorage::GetSubfileDetails(unsigned int i, int* regionIndex, void** data, unsigned int* size) { (void)i; if (regionIndex) *regionIndex = 0; if (data) *data = 0; if (size) *size = 0; } -void C4JStorage::ResetSubfiles() {} -void C4JStorage::UpdateSubfile(int index, void* data, unsigned int size) { +void StubStorage::ResetSubfiles() {} +void StubStorage::UpdateSubfile(int index, void* data, unsigned int size) { (void)index; (void)data; (void)size; } -void C4JStorage::SaveSubfiles(std::function callback) { +void StubStorage::SaveSubfiles(std::function callback) { if (callback) callback(true); } -C4JStorage::ESaveGameState C4JStorage::GetSaveState() { return ESaveGame_Idle; } -void C4JStorage::ContinueIncompleteOperation() {} +StubStorage::ESaveGameState StubStorage::GetSaveState() { return ESaveGame_Idle; } +void StubStorage::ContinueIncompleteOperation() {} diff --git a/targets/platform/sdl2/Storage.h b/targets/platform/storage/stub/StubStorage.h similarity index 77% rename from targets/platform/sdl2/Storage.h rename to targets/platform/storage/stub/StubStorage.h index 8599bfcf5..e654c377c 100644 --- a/targets/platform/sdl2/Storage.h +++ b/targets/platform/storage/stub/StubStorage.h @@ -12,54 +12,11 @@ class C4JStringTable; -#define MAX_DISPLAYNAME_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 -#define MAX_DETAILS_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 -#define MAX_SAVEFILENAME_LENGTH 32 // CELL_SAVEDATA_DIRNAME_SIZE - -struct CONTAINER_METADATA { - time_t modifiedTime; - unsigned int dataSize; - unsigned int thumbnailSize; -}; - -struct SAVE_INFO { - char UTF8SaveFilename[MAX_SAVEFILENAME_LENGTH]; - char UTF8SaveTitle[MAX_DISPLAYNAME_LENGTH]; - CONTAINER_METADATA metaData; - std::uint8_t* thumbnailData; -}; -using PSAVE_INFO = SAVE_INFO*; - -struct SAVE_DETAILS { - int iSaveC; - PSAVE_INFO SaveInfoA; -}; -using PSAVE_DETAILS = SAVE_DETAILS*; - typedef std::vector OfferDataArray; typedef std::vector XContentDataArray; -// typedef std::vector SaveDetailsArray; -// Current version of the dlc data creator -#define CURRENT_DLC_VERSION_NUM 3 - -class C4JStorage : public IPlatformStorage { +class StubStorage : public IPlatformStorage { public: - struct DLC_FILE_DETAILS { - unsigned int uiFileSize; - std::uint32_t dwType; - std::uint32_t dwWchCount; - wchar_t wchFile[1]; - }; - using PDLC_FILE_DETAILS = DLC_FILE_DETAILS*; - - struct DLC_FILE_PARAM { - std::uint32_t dwType; - std::uint32_t dwWchCount; - wchar_t wchData[1]; - }; - using PDLC_FILE_PARAM = DLC_FILE_PARAM*; - struct CACHEINFOSTRUCT { wchar_t wchDisplayName[XCONTENT_MAX_DISPLAYNAME_LENGTH]; char szFileName[XCONTENT_MAX_FILENAME_LENGTH]; @@ -104,20 +61,20 @@ public: }; using PTMSPP_FILE_LIST = TMSPP_FILE_LIST*; - C4JStorage(); + StubStorage(); void Tick(void); // Messages - C4JStorage::EMessageResult RequestMessageBox( + StubStorage::EMessageResult RequestMessageBox( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int pad = XUSER_INDEX_ANY, - std::function callback = + std::function callback = nullptr, C4JStringTable* pStringTable = nullptr, wchar_t* pwchFormatString = nullptr, unsigned int focusButton = 0); - C4JStorage::EMessageResult GetMessageBoxResult(); + StubStorage::EMessageResult GetMessageBoxResult(); // save device bool SetSaveDevice(std::function callback, @@ -150,27 +107,27 @@ public: unsigned int textDataBytes); // Sets the thumbnail & image for the // save, optionally setting the // metadata in the png - C4JStorage::ESaveGameState SaveSaveData( + StubStorage::ESaveGameState SaveSaveData( std::function callback); void CopySaveDataToNewSave(std::uint8_t* pbThumbnail, unsigned int cbThumbnail, wchar_t* wchNewName, std::function callback); void SetSaveDeviceSelected(unsigned int uiPad, bool bSelected); bool GetSaveDeviceSelected(unsigned int iPad); - C4JStorage::ESaveGameState DoesSaveExist(bool* pbExists); + StubStorage::ESaveGameState DoesSaveExist(bool* pbExists); bool EnoughSpaceForAMinSaveGame(); void SetSaveMessageVPosition( float fY); // The 'Saving' message will display at a default position // unless changed // Get the info for the saves - C4JStorage::ESaveGameState GetSavesInfo( + StubStorage::ESaveGameState GetSavesInfo( int iPad, std::function callback, char* pszSavePackName); PSAVE_DETAILS ReturnSavesInfo(); void ClearSavesInfo(); // Clears results - C4JStorage::ESaveGameState LoadSaveDataThumbnail( + StubStorage::ESaveGameState LoadSaveDataThumbnail( PSAVE_INFO pSaveInfo, std::function @@ -184,18 +141,18 @@ public: unsigned int* pImageBytes); // Load the save. Need to call GetSaveData once the callback is called - C4JStorage::ESaveGameState LoadSaveData( + StubStorage::ESaveGameState LoadSaveData( PSAVE_INFO pSaveInfo, std::function callback); - C4JStorage::ESaveGameState DeleteSaveData( + StubStorage::ESaveGameState DeleteSaveData( PSAVE_INFO pSaveInfo, std::function callback); // DLC void RegisterMarketplaceCountsCallback( - std::function callback); + std::function callback); void SetDLCPackageRoot(char* pszDLCRoot); - C4JStorage::EDLCStatus GetDLCOffers( + StubStorage::EDLCStatus GetDLCOffers( int iPad, std::function callback, std::uint32_t dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT); unsigned int CancelGetDLCOffers(); @@ -207,7 +164,7 @@ public: bool bTrial = false); unsigned int GetAvailableDLCCount(int iPad); - C4JStorage::EDLCStatus GetInstalledDLC( + StubStorage::EDLCStatus GetInstalledDLC( int iPad, std::function callback); XCONTENT_DATA& GetDLC(unsigned int dw); std::uint32_t MountInstalledDLC( @@ -220,9 +177,9 @@ public: std::string GetMountedPath(std::string szMount); // Global title storage - C4JStorage::ETMSStatus ReadTMSFile( + StubStorage::ETMSStatus ReadTMSFile( int iQuadrant, eGlobalStorage eStorageFacility, - C4JStorage::eTMS_FileType eFileType, wchar_t* pwchFilename, + StubStorage::eTMS_FileType eFileType, wchar_t* pwchFilename, std::uint8_t** ppBuffer, unsigned int* pBufferSize, std::function callback = nullptr, int iAction = 0); @@ -235,18 +192,18 @@ public: // TMS++ #ifdef _XBOX - C4JStorage::ETMSStatus WriteTMSFile( - int iPad, C4JStorage::eGlobalStorage eStorageFacility, - C4JStorage::eTMS_FileType eFileType, char* pchFilePath, char* pchBuffer, + StubStorage::ETMSStatus WriteTMSFile( + int iPad, StubStorage::eGlobalStorage eStorageFacility, + StubStorage::eTMS_FileType eFileType, char* pchFilePath, char* pchBuffer, unsigned int bufferSize, TMSCLIENT_CALLBACK Func, void* lpParam); int GetUserQuotaInfo(int iPad, TMSCLIENT_CALLBACK Func, void* lpParam); #endif // Older TMS++ write/quota entry points were kept in platform-specific // implementations and are intentionally not part of this shared API. - C4JStorage::ETMSStatus TMSPP_ReadFile( - int iPad, C4JStorage::eGlobalStorage eStorageFacility, - C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, const char* szFilename, + StubStorage::ETMSStatus TMSPP_ReadFile( + int iPad, StubStorage::eGlobalStorage eStorageFacility, + StubStorage::eTMS_FILETYPEVAL eFileTypeVal, const char* szFilename, std::function callback = nullptr, int iUserData = 0); @@ -278,5 +235,3 @@ public: C4JStringTable* m_pStringTable; }; - -extern C4JStorage StorageManager; From 8a1b3cc1c4ce5ce1d53741e14a6137d8980e4907 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 15:55:45 -0500 Subject: [PATCH 05/15] attempt to clean up renderer --- targets/app/common/DLC/DLCAudioFile.cpp | 4 +- targets/app/common/DLC/DLCSkinFile.cpp | 4 +- targets/app/common/Game.cpp | 4 +- targets/app/common/GameSettingsManager.cpp | 6 +- targets/app/common/LocalizationManager.cpp | 4 +- .../app/common/Network/GameNetworkManager.cpp | 8 +- .../IUIScene_AbstractContainerMenu.cpp | 4 +- .../All Platforms/IUIScene_CraftingMenu.cpp | 8 +- .../All Platforms/IUIScene_CreativeMenu.cpp | 2 +- .../common/UI/All Platforms/IUIScene_HUD.cpp | 4 +- .../common/UI/Components/UIComponent_Chat.cpp | 48 +-- .../common/UI/Components/UIComponent_Chat.h | 4 +- .../common/UI/Components/UIComponent_Logo.cpp | 20 +- .../Components/UIComponent_MenuBackground.cpp | 48 +-- .../Components/UIComponent_MenuBackground.h | 4 +- .../UI/Components/UIComponent_Panorama.cpp | 38 +- .../UI/Components/UIComponent_Panorama.h | 4 +- .../UI/Components/UIComponent_Tooltips.cpp | 68 ++-- .../UI/Components/UIComponent_Tooltips.h | 4 +- .../Components/UIComponent_TutorialPopup.cpp | 60 +-- .../UI/Components/UIComponent_TutorialPopup.h | 4 +- .../app/common/UI/Components/UIScene_HUD.cpp | 74 ++-- .../app/common/UI/Components/UIScene_HUD.h | 4 +- .../UI/Controls/UIControl_EnchantmentBook.cpp | 2 +- .../Controls/UIControl_EnchantmentButton.cpp | 2 +- .../UI/Controls/UIControl_MinecraftHorse.cpp | 2 +- .../UI/Controls/UIControl_MinecraftPlayer.cpp | 2 +- .../Controls/UIControl_PlayerSkinPreview.cpp | 2 +- .../UIScene_DLCOffersMenu.cpp | 4 +- .../UIScene_LaunchMoreOptionsMenu.cpp | 6 +- .../UIScene_LoadMenu.cpp | 4 +- .../UIScene_MainMenu.cpp | 2 +- .../UIScene_SettingsOptionsMenu.cpp | 10 +- .../Help & Options/UIScene_SkinSelectMenu.cpp | 4 +- .../UIScene_AbstractContainerMenu.cpp | 2 +- .../UIScene_AbstractContainerMenu.h | 4 +- targets/app/common/UI/UIBitmapFont.cpp | 2 +- targets/app/common/UI/UIController.cpp | 60 +-- targets/app/common/UI/UIController.h | 8 +- targets/app/common/UI/UIGroup.cpp | 8 +- targets/app/common/UI/UIGroup.h | 8 +- targets/app/common/UI/UILayer.cpp | 6 +- targets/app/common/UI/UILayer.h | 6 +- targets/app/common/UI/UIScene.cpp | 32 +- targets/app/common/UI/UIScene.h | 4 +- targets/app/linux/LinuxGL.cpp | 168 --------- targets/app/linux/LinuxGL.h | 42 --- targets/app/linux/LinuxGame.cpp | 4 +- targets/app/linux/Linux_Minecraft.cpp | 20 +- targets/app/linux/Linux_UIController.cpp | 2 +- .../app/windows/Windows64_UIController.cpp | 2 +- .../app/windows/src/Windows64_Minecraft.cpp | 10 +- targets/minecraft/client/BufferedImage.cpp | 10 +- targets/minecraft/client/Lighting.cpp | 3 +- targets/minecraft/client/MemoryTracker.cpp | 3 +- targets/minecraft/client/Minecraft.cpp | 59 ++- targets/minecraft/client/Options.cpp | 1 - targets/minecraft/client/gui/Button.cpp | 2 +- targets/minecraft/client/gui/DeathScreen.cpp | 2 +- targets/minecraft/client/gui/Font.cpp | 3 +- targets/minecraft/client/gui/Gui.cpp | 47 ++- targets/minecraft/client/gui/GuiComponent.cpp | 3 +- targets/minecraft/client/gui/Minimap.cpp | 4 +- targets/minecraft/client/gui/Screen.cpp | 2 +- targets/minecraft/client/gui/SlideButton.cpp | 2 +- .../client/gui/TradeSwitchButton.cpp | 1 + .../gui/achievement/AchievementPopup.cpp | 4 +- .../gui/achievement/AchievementScreen.cpp | 2 +- .../gui/inventory/AbstractBeaconButton.cpp | 2 +- .../client/gui/inventory/BeaconScreen.cpp | 2 +- .../gui/inventory/BrewingStandScreen.cpp | 1 + .../gui/inventory/CreativeInventoryScreen.cpp | 2 +- .../gui/inventory/EnchantmentScreen.cpp | 3 +- .../gui/inventory/HorseInventoryScreen.cpp | 1 + .../client/gui/inventory/InventoryScreen.cpp | 2 +- .../client/gui/inventory/MerchantScreen.cpp | 1 + .../client/gui/inventory/RepairScreen.cpp | 2 +- .../client/gui/inventory/TextEditScreen.cpp | 2 +- .../minecraft/client/model/ChickenModel.cpp | 2 +- targets/minecraft/client/model/GhastModel.cpp | 2 +- .../minecraft/client/model/HumanoidModel.cpp | 2 +- targets/minecraft/client/model/ModelHorse.cpp | 2 +- .../minecraft/client/model/OcelotModel.cpp | 2 +- .../minecraft/client/model/QuadrupedModel.cpp | 3 +- targets/minecraft/client/model/WolfModel.cpp | 2 +- .../client/model/dragon/DragonModel.cpp | 4 +- .../client/model/dragon/EnderCrystalModel.cpp | 3 +- .../minecraft/client/model/geom/ModelPart.cpp | 2 +- .../client/particle/FootstepParticle.cpp | 2 +- .../client/particle/HugeExplosionParticle.cpp | 2 +- .../client/particle/ParticleEngine.cpp | 2 +- .../client/particle/TakeAnimationParticle.cpp | 2 +- .../minecraft/client/player/LocalPlayer.cpp | 4 +- targets/minecraft/client/renderer/Chunk.cpp | 10 +- .../client/renderer/GameRenderer.cpp | 67 ++-- .../client/renderer/ItemInHandRenderer.cpp | 14 +- .../client/renderer/LevelRenderer.cpp | 43 ++- .../renderer/MobSkinTextureProcessor.cpp | 1 - .../client/renderer/OffsettedRenderList.cpp | 2 +- .../minecraft/client/renderer/Tesselator.cpp | 40 +- .../minecraft/client/renderer/Textures.cpp | 41 ++- targets/minecraft/client/renderer/Textures.h | 4 +- .../client/renderer/TileRenderer.cpp | 2 +- .../client/renderer/culling/Frustum.cpp | 6 +- .../client/renderer/entity/ArrowRenderer.cpp | 3 +- .../client/renderer/entity/BatRenderer.cpp | 3 +- .../client/renderer/entity/BoatRenderer.cpp | 2 +- .../renderer/entity/CaveSpiderRenderer.cpp | 2 +- .../renderer/entity/CreeperRenderer.cpp | 2 +- .../renderer/entity/DefaultRenderer.cpp | 2 +- .../renderer/entity/EnderCrystalRenderer.cpp | 2 +- .../renderer/entity/EnderDragonRenderer.cpp | 2 +- .../renderer/entity/EndermanRenderer.cpp | 3 +- .../entity/EntityRenderDispatcher.cpp | 2 +- .../client/renderer/entity/EntityRenderer.cpp | 2 +- .../renderer/entity/ExperienceOrbRenderer.cpp | 2 +- .../renderer/entity/FallingTileRenderer.cpp | 2 +- .../renderer/entity/FireballRenderer.cpp | 2 +- .../renderer/entity/FishingHookRenderer.cpp | 2 +- .../client/renderer/entity/GhastRenderer.cpp | 2 +- .../renderer/entity/GiantMobRenderer.cpp | 2 +- .../client/renderer/entity/HorseRenderer.cpp | 5 +- .../renderer/entity/HumanoidMobRenderer.cpp | 3 +- .../renderer/entity/ItemFrameRenderer.cpp | 2 +- .../client/renderer/entity/ItemRenderer.cpp | 6 +- .../renderer/entity/ItemSpriteRenderer.cpp | 2 +- .../renderer/entity/LavaSlimeRenderer.cpp | 2 +- .../renderer/entity/LeashKnotRenderer.cpp | 2 +- .../renderer/entity/LightningBoltRenderer.cpp | 2 +- .../renderer/entity/LivingEntityRenderer.cpp | 4 +- .../renderer/entity/MinecartRenderer.cpp | 2 +- .../client/renderer/entity/MobRenderer.cpp | 2 +- .../renderer/entity/MushroomCowRenderer.cpp | 3 +- .../client/renderer/entity/OcelotRenderer.cpp | 2 +- .../renderer/entity/PaintingRenderer.cpp | 3 +- .../client/renderer/entity/PlayerRenderer.cpp | 3 +- .../client/renderer/entity/SheepRenderer.cpp | 2 +- .../renderer/entity/SkeletonRenderer.cpp | 2 +- .../client/renderer/entity/SlimeRenderer.cpp | 2 +- .../renderer/entity/SnowManRenderer.cpp | 2 +- .../client/renderer/entity/SpiderRenderer.cpp | 2 +- .../client/renderer/entity/SquidRenderer.cpp | 2 +- .../renderer/entity/TntMinecartRenderer.cpp | 2 +- .../client/renderer/entity/TntRenderer.cpp | 2 +- .../renderer/entity/VillagerGolemRenderer.cpp | 2 +- .../renderer/entity/VillagerRenderer.cpp | 2 +- .../client/renderer/entity/WitchRenderer.cpp | 2 +- .../renderer/entity/WitherBossRenderer.cpp | 2 +- .../renderer/entity/WitherSkullRenderer.cpp | 2 +- .../client/renderer/entity/WolfRenderer.cpp | 2 +- .../client/renderer/texture/Texture.cpp | 20 +- .../renderer/tileentity/BeaconRenderer.cpp | 2 +- .../renderer/tileentity/ChestRenderer.cpp | 2 +- .../tileentity/EnchantTableRenderer.cpp | 2 +- .../tileentity/EnderChestRenderer.cpp | 2 +- .../tileentity/MobSpawnerRenderer.cpp | 2 +- .../tileentity/PistonPieceRenderer.cpp | 2 +- .../renderer/tileentity/SignRenderer.cpp | 2 +- .../renderer/tileentity/SkullTileRenderer.cpp | 2 +- .../tileentity/TheEndPortalRenderer.cpp | 2 +- .../tileentity/TileEntityRenderDispatcher.cpp | 2 +- .../minecraft/client/title/TitleScreen.cpp | 4 +- targets/platform/Platform.h | 2 +- targets/platform/PlatformServices.cpp | 5 +- targets/platform/PlatformServices.h | 2 - targets/platform/input/sdl2/SDL2Input.cpp | 2 +- targets/platform/meson.build | 10 +- targets/platform/profile/stub/StubProfile.h | 4 +- .../{ => renderer}/IPlatformRenderer.h | 1 + .../Render.cpp => renderer/gl/GLRenderer.cpp} | 345 +++++++++++++----- .../Render.h => renderer/gl/GLRenderer.h} | 113 +++--- .../{sdl2 => renderer/gl}/gl3_loader.h | 0 targets/platform/renderer/gl/render_stubs.cpp | 44 +++ .../gl}/shaders/fragment.frag | 0 .../gl}/shaders/fragment_es.frag | 0 .../{sdl2 => renderer/gl}/shaders/vertex.vert | 0 .../gl}/shaders/vertex_es.vert | 0 targets/platform/renderer/renderer.h | 4 + targets/platform/sdl2/render_stubs.cpp | 44 --- targets/platform/storage/stub/StubStorage.h | 2 +- 180 files changed, 988 insertions(+), 1030 deletions(-) delete mode 100644 targets/app/linux/LinuxGL.cpp delete mode 100644 targets/app/linux/LinuxGL.h rename targets/platform/{ => renderer}/IPlatformRenderer.h (99%) rename targets/platform/{sdl2/Render.cpp => renderer/gl/GLRenderer.cpp} (79%) rename targets/platform/{sdl2/Render.h => renderer/gl/GLRenderer.h} (86%) rename targets/platform/{sdl2 => renderer/gl}/gl3_loader.h (100%) create mode 100644 targets/platform/renderer/gl/render_stubs.cpp rename targets/platform/{sdl2 => renderer/gl}/shaders/fragment.frag (100%) rename targets/platform/{sdl2 => renderer/gl}/shaders/fragment_es.frag (100%) rename targets/platform/{sdl2 => renderer/gl}/shaders/vertex.vert (100%) rename targets/platform/{sdl2 => renderer/gl}/shaders/vertex_es.vert (100%) create mode 100644 targets/platform/renderer/renderer.h delete mode 100644 targets/platform/sdl2/render_stubs.cpp diff --git a/targets/app/common/DLC/DLCAudioFile.cpp b/targets/app/common/DLC/DLCAudioFile.cpp index cbe684142..c76b469ee 100644 --- a/targets/app/common/DLC/DLCAudioFile.cpp +++ b/targets/app/common/DLC/DLCAudioFile.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "platform/storage/storage.h" #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" @@ -123,7 +123,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, int maximumChars = 55; bool bIsSDMode = - !RenderManager.IsHiDef() && !RenderManager.IsWidescreen(); + !PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen(); if (bIsSDMode) { maximumChars = 45; diff --git a/targets/app/common/DLC/DLCSkinFile.cpp b/targets/app/common/DLC/DLCSkinFile.cpp index 0f3a1612c..ed6aea4f1 100644 --- a/targets/app/common/DLC/DLCSkinFile.cpp +++ b/targets/app/common/DLC/DLCSkinFile.cpp @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" @@ -57,7 +57,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, int maximumChars = 55; bool bIsSDMode = - !RenderManager.IsHiDef() && !RenderManager.IsWidescreen(); + !PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen(); if (bIsSDMode) { maximumChars = 45; diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 68e8992fd..a13bd8c95 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -3,7 +3,7 @@ #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "platform/storage/storage.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" @@ -627,7 +627,7 @@ bool Game::IsLocalMultiplayerAvailable() { ++connectedControllers; } - bool available = RenderManager.IsHiDef() && connectedControllers > 1; + bool available = PlatformRenderer.IsHiDef() && connectedControllers > 1; return available; diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index bee25383a..7cdafeeb8 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -21,7 +21,7 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/tile/Tile.h" #include "platform/input/input.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "platform/storage/storage.h" #include "app/common/Audio/SoundEngine.h" @@ -265,7 +265,7 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { case eGameSetting_Gamma: if (iPad == PlatformProfile.GetPrimaryPad()) { float fVal = ((float)GameSettingsA[iPad]->ucGamma) * 327.68f; - RenderManager.UpdateGamma((unsigned short)fVal); + PlatformRenderer.UpdateGamma((unsigned short)fVal); } break; case eGameSetting_Difficulty: @@ -371,7 +371,7 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { for (std::uint8_t idx = 0; idx < XUSER_MAX_COUNT; ++idx) { if (pMinecraft->localplayers[idx] != nullptr) { if (pMinecraft->localplayers[idx]->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_FULLSCREEN) { + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN) { ui.DisplayGamertag(idx, false); } else { ui.DisplayGamertag(idx, true); diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index 7c17e7e83..c17f068a8 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -17,7 +17,7 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "platform/input/input.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "platform/XboxStubs.h" #include "strings.h" #include "util/StringHelpers.h" @@ -107,7 +107,7 @@ int LocalizationManager::TipsSortFunction(const void* a, const void* b) { void LocalizationManager::initialiseTips() { memset(m_TipIDA, 0, sizeof(m_TipIDA)); - if (!RenderManager.IsHiDef()) { + if (!PlatformRenderer.IsHiDef()) { m_GameTipA[0].uiStringID = IDS_TIPS_GAMETIP_0; } diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 2f76df99a..996129d3d 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -11,7 +11,7 @@ #include "platform/input/input.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Game.h" @@ -1501,16 +1501,16 @@ void CGameNetworkManager::ServerStoppedWait() { if (C4JThread::isMainThread()) { int result = C4JThread::WaitResult::Timeout; do { - RenderManager.StartFrame(); + PlatformRenderer.StartFrame(); result = m_hServerStoppedEvent->waitForSignal(20); // Tick some simple things PlatformProfile.Tick(); PlatformStorage.Tick(); PlatformInput.Tick(); - RenderManager.Tick(); + PlatformRenderer.Tick(); ui.tick(); ui.render(); - RenderManager.Present(); + PlatformRenderer.Present(); } while (result == C4JThread::WaitResult::Timeout); } else { if (m_hServerStoppedEvent != nullptr) { diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index 068e0206f..a1b1c7c71 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -8,7 +8,7 @@ #include #include "platform/input/input.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" @@ -328,7 +328,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() { // 4J Stu - The cursor moves too fast in SD mode // The SD/splitscreen scenes are approximately 0.6 times the size of // the fullscreen on - if (!RenderManager.IsHiDef() || app.GetLocalPlayerCount() > 1) + if (!PlatformRenderer.IsHiDef() || app.GetLocalPlayerCount() > 1) fInputScale *= 0.6f; fInputX *= fInputScale; diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index d489b96c4..0aecabe23 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/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Tutorial/Tutorial.h" @@ -480,7 +480,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) { // Vita) bool bNoScrollSlots = false; if (m_bSplitscreen || - (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())) { + (!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen())) { bNoScrollSlots = true; } @@ -1034,7 +1034,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots() { // splits & Vita) bool bNoScrollSlots = false; if (m_bSplitscreen || - (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())) { + (!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen())) { bNoScrollSlots = true; } @@ -1314,7 +1314,7 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade) { // 12 for splitscreen, 14 for normal EHTMLFontSize size = eHTMLSize_Normal; if (m_bSplitscreen || - (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())) { + (!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen())) { size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; diff --git a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp index 920582a1f..e9de2ec6c 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp @@ -878,7 +878,7 @@ void IUIScene_CreativeMenu::staticCtor() { // Just use the text LT - the graphic doesn't fit in splitscreen either // In 480p there's not enough room for the LT button, so use text instead - // if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) + // if(!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen()) { specs[eCreativeInventoryTab_Brewing] = new TabSpec(L"Brewing", IDS_GROUPNAME_POTIONS_480, 5, brewingGroup); diff --git a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp index 5363e3683..a3557158c 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp @@ -4,7 +4,7 @@ #include #include "platform/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" @@ -70,7 +70,7 @@ void IUIScene_HUD::updateFrameTick() { int iGuiScale; if (pMinecraft->localplayers[iPad]->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_FULLSCREEN) { + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN) { iGuiScale = app.GetGameSettings(iPad, eGameSetting_UISize); } else { iGuiScale = app.GetGameSettings(iPad, eGameSetting_UISizeSplitscreen); diff --git a/targets/app/common/UI/Components/UIComponent_Chat.cpp b/targets/app/common/UI/Components/UIComponent_Chat.cpp index 38310d908..284ff6328 100644 --- a/targets/app/common/UI/Components/UIComponent_Chat.cpp +++ b/targets/app/common/UI/Components/UIComponent_Chat.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" @@ -32,18 +32,18 @@ UIComponent_Chat::UIComponent_Chat(int iPad, void* initData, std::wstring UIComponent_Chat::getMoviePath() { switch (m_parentLayer->getViewport()) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: m_bSplitscreen = true; return L"ComponentChatSplit"; break; - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: default: m_bSplitscreen = false; return L"ComponentChat"; @@ -89,20 +89,20 @@ void UIComponent_Chat::handleTimerComplete(int id) { } void UIComponent_Chat::render(S32 width, S32 height, - C4JRender::eViewportType viewport) { + IPlatformRenderer::eViewportType viewport) { if (m_bSplitscreen) { S32 xPos = 0; S32 yPos = 0; switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: yPos = (S32)(ui.getScreenHeight() / 2); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: xPos = (S32)(ui.getScreenWidth() / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: xPos = (S32)(ui.getScreenWidth() / 2); yPos = (S32)(ui.getScreenHeight() / 2); break; @@ -117,22 +117,22 @@ void UIComponent_Chat::render(S32 width, S32 height, S32 tileHeight = height; switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: tileHeight = (S32)(ui.getScreenHeight()); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: tileYStart = (S32)(m_movieHeight / 2); break; default: diff --git a/targets/app/common/UI/Components/UIComponent_Chat.h b/targets/app/common/UI/Components/UIComponent_Chat.h index 85e3439b0..9e7173c64 100644 --- a/targets/app/common/UI/Components/UIComponent_Chat.h +++ b/targets/app/common/UI/Components/UIComponent_Chat.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -69,7 +69,7 @@ public: // RENDERING virtual void render(S32 width, S32 height, - C4JRender::eViewportType viewport); + IPlatformRenderer::eViewportType viewport); protected: void handleTimerComplete(int id); diff --git a/targets/app/common/UI/Components/UIComponent_Logo.cpp b/targets/app/common/UI/Components/UIComponent_Logo.cpp index a0db6e84f..2a2c89357 100644 --- a/targets/app/common/UI/Components/UIComponent_Logo.cpp +++ b/targets/app/common/UI/Components/UIComponent_Logo.cpp @@ -1,6 +1,6 @@ #include "UIComponent_Logo.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" @@ -13,17 +13,17 @@ UIComponent_Logo::UIComponent_Logo(int iPad, void* initData, std::wstring UIComponent_Logo::getMoviePath() { switch (m_parentLayer->getViewport()) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: return L"ComponentLogoSplit"; break; - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: default: return L"ComponentLogo"; break; diff --git a/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp index 7d9f6b9bc..2fb371239 100644 --- a/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp @@ -1,6 +1,6 @@ #include "UIComponent_MenuBackground.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" @@ -20,17 +20,17 @@ UIComponent_MenuBackground::UIComponent_MenuBackground(int iPad, void* initData, std::wstring UIComponent_MenuBackground::getMoviePath() { switch (m_parentLayer->getViewport()) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: m_bSplitscreen = true; break; - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: default: m_bSplitscreen = false; break; @@ -42,20 +42,20 @@ std::wstring UIComponent_MenuBackground::getMoviePath() { } void UIComponent_MenuBackground::render(S32 width, S32 height, - C4JRender::eViewportType viewport) { + IPlatformRenderer::eViewportType viewport) { if (m_bSplitscreen) { S32 xPos = 0; S32 yPos = 0; switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: yPos = (S32)(ui.getScreenHeight() / 2); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: xPos = (S32)(ui.getScreenWidth() / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: xPos = (S32)(ui.getScreenWidth() / 2); yPos = (S32)(ui.getScreenHeight() / 2); break; @@ -70,22 +70,22 @@ void UIComponent_MenuBackground::render(S32 width, S32 height, S32 tileHeight = height; switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: tileHeight = (S32)(ui.getScreenHeight()); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: tileYStart = (S32)(m_movieHeight / 2); break; default: diff --git a/targets/app/common/UI/Components/UIComponent_MenuBackground.h b/targets/app/common/UI/Components/UIComponent_MenuBackground.h index c22bc08bf..4baa123ca 100644 --- a/targets/app/common/UI/Components/UIComponent_MenuBackground.h +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" @@ -35,5 +35,5 @@ public: // RENDERING virtual void render(S32 width, S32 height, - C4JRender::eViewportType viewport); + IPlatformRenderer::eViewportType viewport); }; \ No newline at end of file diff --git a/targets/app/common/UI/Components/UIComponent_Panorama.cpp b/targets/app/common/UI/Components/UIComponent_Panorama.cpp index ca284e743..6c964b4ef 100644 --- a/targets/app/common/UI/Components/UIComponent_Panorama.cpp +++ b/targets/app/common/UI/Components/UIComponent_Panorama.cpp @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" @@ -31,18 +31,18 @@ UIComponent_Panorama::UIComponent_Panorama(int iPad, void* initData, std::wstring UIComponent_Panorama::getMoviePath() { switch (m_parentLayer->getViewport()) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: m_bSplitscreen = true; return L"PanoramaSplit"; break; - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: default: m_bSplitscreen = false; return L"Panorama"; @@ -79,20 +79,20 @@ void UIComponent_Panorama::tick() { } void UIComponent_Panorama::render(S32 width, S32 height, - C4JRender::eViewportType viewport) { + IPlatformRenderer::eViewportType viewport) { bool specialViewport = - (viewport == C4JRender::VIEWPORT_TYPE_SPLIT_TOP) || - (viewport == C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM) || - (viewport == C4JRender::VIEWPORT_TYPE_SPLIT_LEFT) || - (viewport == C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT); + (viewport == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP) || + (viewport == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM) || + (viewport == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT) || + (viewport == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT); if (m_bSplitscreen && specialViewport) { S32 xPos = 0; S32 yPos = 0; switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: yPos = (S32)(ui.getScreenHeight() / 2); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: xPos = (S32)(ui.getScreenWidth() / 2); break; default: @@ -100,8 +100,8 @@ void UIComponent_Panorama::render(S32 width, S32 height, } ui.setupRenderPosition(xPos, yPos); - if ((viewport == C4JRender::VIEWPORT_TYPE_SPLIT_LEFT) || - (viewport == C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT)) { + if ((viewport == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT) || + (viewport == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT)) { // Need to render at full height, but only the left side of the // scene S32 tileXStart = 0; diff --git a/targets/app/common/UI/Components/UIComponent_Panorama.h b/targets/app/common/UI/Components/UIComponent_Panorama.h index 798cb339d..13d4a5e33 100644 --- a/targets/app/common/UI/Components/UIComponent_Panorama.h +++ b/targets/app/common/UI/Components/UIComponent_Panorama.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" @@ -44,7 +44,7 @@ public: // RENDERING virtual void render(S32 width, S32 height, - C4JRender::eViewportType viewport); + IPlatformRenderer::eViewportType viewport); private: void setPanorama(bool isDay); diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp index d8ecb30e7..4a0bfe67b 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp @@ -1,7 +1,7 @@ #include "UIComponent_Tooltips.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UILayer.h" @@ -30,18 +30,18 @@ UIComponent_Tooltips::UIComponent_Tooltips(int iPad, void* initData, std::wstring UIComponent_Tooltips::getMoviePath() { switch (m_parentLayer->getViewport()) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: m_bSplitscreen = true; return L"ToolTipsSplit"; break; - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: default: m_bSplitscreen = false; return L"ToolTips"; @@ -55,7 +55,7 @@ F64 UIComponent_Tooltips::getSafeZoneHalfWidth() { float safeWidth = 0.0f; // 85% safezone for tooltips in either SD mode - if (!RenderManager.IsHiDef()) { + if (!PlatformRenderer.IsHiDef()) { // 85% safezone safeWidth = m_movieWidth * (0.15f / 2); } else { @@ -73,39 +73,39 @@ void UIComponent_Tooltips::updateSafeZone() { F64 safeRight = 0.0; switch (m_parentLayer->getViewport()) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: safeTop = getSafeZoneHalfHeight(); safeLeft = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: safeBottom = getSafeZoneHalfHeight(); safeLeft = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: safeLeft = getSafeZoneHalfWidth(); safeBottom = getSafeZoneHalfHeight(); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: safeRight = getSafeZoneHalfWidth(); safeBottom = getSafeZoneHalfHeight(); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: safeTop = getSafeZoneHalfHeight(); safeLeft = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: safeTop = getSafeZoneHalfHeight(); safeRight = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: safeBottom = getSafeZoneHalfHeight(); safeLeft = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: safeBottom = getSafeZoneHalfHeight(); safeRight = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: default: safeTop = getSafeZoneHalfHeight(); safeBottom = getSafeZoneHalfHeight(); @@ -166,7 +166,7 @@ void UIComponent_Tooltips::tick() { } void UIComponent_Tooltips::render(S32 width, S32 height, - C4JRender::eViewportType viewport) { + IPlatformRenderer::eViewportType viewport) { if ((PlatformProfile.GetLockedProfile() != -1) && !ui.GetMenuDisplayed(m_iPad) && (app.GetGameSettings(m_iPad, eGameSetting_Tooltips) == 0 || @@ -178,15 +178,15 @@ void UIComponent_Tooltips::render(S32 width, S32 height, S32 xPos = 0; S32 yPos = 0; switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: yPos = (S32)(ui.getScreenHeight() / 2); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: xPos = (S32)(ui.getScreenWidth() / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: xPos = (S32)(ui.getScreenWidth() / 2); yPos = (S32)(ui.getScreenHeight() / 2); break; @@ -201,22 +201,22 @@ void UIComponent_Tooltips::render(S32 width, S32 height, S32 tileHeight = height; switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: tileHeight = (S32)(ui.getScreenHeight()); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: tileYStart = (S32)(m_movieHeight / 2); break; default: diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.h b/targets/app/common/UI/Components/UIComponent_Tooltips.h index c9ec16229..24501c2b9 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.h +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.h @@ -3,7 +3,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" @@ -70,7 +70,7 @@ public: // RENDERING virtual void render(S32 width, S32 height, - C4JRender::eViewportType viewport); + IPlatformRenderer::eViewportType viewport); virtual void SetTooltipText(unsigned int tooltip, int iTextID); virtual void SetEnableTooltips(bool bVal); diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp index 87a926c46..055133911 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp @@ -46,17 +46,17 @@ UIComponent_TutorialPopup::UIComponent_TutorialPopup(int iPad, void* initData, std::wstring UIComponent_TutorialPopup::getMoviePath() { switch (m_parentLayer->getViewport()) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: return L"TutorialPopupSplit"; break; - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: default: return L"TutorialPopup"; break; @@ -410,9 +410,9 @@ void UIComponent_TutorialPopup::UpdateInteractScenePosition(bool visible) { bool isTradingScene = (m_interactScene->getSceneType() == eUIScene_TradingMenu); switch (Minecraft::GetInstance()->localplayers[m_iPad]->m_iScreenSection) { - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: bAllowAnim = true; break; default: @@ -443,24 +443,24 @@ void UIComponent_TutorialPopup::UpdateInteractScenePosition(bool visible) { } void UIComponent_TutorialPopup::render(S32 width, S32 height, - C4JRender::eViewportType viewport) { - if (viewport != C4JRender::VIEWPORT_TYPE_FULLSCREEN) { + IPlatformRenderer::eViewportType viewport) { + if (viewport != IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN) { S32 xPos = 0; S32 yPos = 0; switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: xPos = (S32)(ui.getScreenWidth() / 2); yPos = (S32)(ui.getScreenHeight() / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: yPos = (S32)(ui.getScreenHeight() / 2); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: xPos = (S32)(ui.getScreenWidth() / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: xPos = (S32)(ui.getScreenWidth() / 2); yPos = (S32)(ui.getScreenHeight() / 2); break; @@ -469,22 +469,22 @@ void UIComponent_TutorialPopup::render(S32 width, S32 height, } // Adjust for safezone switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: yPos += getSafeZoneHalfHeight(); break; default: break; } switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: xPos -= getSafeZoneHalfWidth(); break; default: diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.h b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h index c594f213f..42411e7d7 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.h +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" @@ -104,7 +104,7 @@ public: // RENDERING virtual void render(S32 width, S32 height, - C4JRender::eViewportType viewport); + IPlatformRenderer::eViewportType viewport); virtual void customDraw(IggyCustomDrawCallbackRegion* region); diff --git a/targets/app/common/UI/Components/UIScene_HUD.cpp b/targets/app/common/UI/Components/UIScene_HUD.cpp index 4f5ce3bfc..fade0599f 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.cpp +++ b/targets/app/common/UI/Components/UIScene_HUD.cpp @@ -44,18 +44,18 @@ UIScene_HUD::UIScene_HUD(int iPad, void* initData, UILayer* parentLayer) std::wstring UIScene_HUD::getMoviePath() { switch (m_parentLayer->getViewport()) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: m_bSplitscreen = true; return L"HUDSplit"; break; - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: default: m_bSplitscreen = false; return L"HUD"; @@ -71,43 +71,43 @@ void UIScene_HUD::updateSafeZone() { F64 safeRight = 0.0; switch (m_parentLayer->getViewport()) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: safeTop = getSafeZoneHalfHeight(); safeLeft = getSafeZoneHalfWidth(); safeRight = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: safeBottom = getSafeZoneHalfHeight(); safeLeft = getSafeZoneHalfWidth(); safeRight = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: safeLeft = getSafeZoneHalfWidth(); safeTop = getSafeZoneHalfHeight(); safeBottom = getSafeZoneHalfHeight(); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: safeRight = getSafeZoneHalfWidth(); safeTop = getSafeZoneHalfHeight(); safeBottom = getSafeZoneHalfHeight(); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: safeTop = getSafeZoneHalfHeight(); safeLeft = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: safeTop = getSafeZoneHalfHeight(); safeRight = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: safeBottom = getSafeZoneHalfHeight(); safeLeft = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: safeBottom = getSafeZoneHalfHeight(); safeRight = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: default: safeTop = getSafeZoneHalfHeight(); safeBottom = getSafeZoneHalfHeight(); @@ -250,7 +250,7 @@ void UIScene_HUD::handleReload() { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localplayers[m_iPad]->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_FULLSCREEN) { + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN) { iGuiScale = app.GetGameSettings(m_iPad, eGameSetting_UISize); } else { iGuiScale = app.GetGameSettings(m_iPad, eGameSetting_UISizeSplitscreen); @@ -669,20 +669,20 @@ void UIScene_HUD::SetHealthAbsorb(int healthAbsorb) { } void UIScene_HUD::render(S32 width, S32 height, - C4JRender::eViewportType viewport) { + IPlatformRenderer::eViewportType viewport) { if (m_bSplitscreen) { S32 xPos = 0; S32 yPos = 0; switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: yPos = (S32)(ui.getScreenHeight() / 2); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: xPos = (S32)(ui.getScreenWidth() / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: xPos = (S32)(ui.getScreenWidth() / 2); yPos = (S32)(ui.getScreenHeight() / 2); break; @@ -697,22 +697,22 @@ void UIScene_HUD::render(S32 width, S32 height, S32 tileHeight = height; switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: tileHeight = (S32)(ui.getScreenHeight()); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: tileWidth = (S32)(ui.getScreenWidth()); tileYStart = (S32)(m_movieHeight / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: tileYStart = (S32)(m_movieHeight / 2); break; default: @@ -780,12 +780,12 @@ void UIScene_HUD::repositionHud() { m_parentLayer->getRenderDimensions(width, height); switch (m_parentLayer->getViewport()) { - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: height = (S32)(ui.getScreenHeight()); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: width = (S32)(ui.getScreenWidth()); break; default: diff --git a/targets/app/common/UI/Components/UIScene_HUD.h b/targets/app/common/UI/Components/UIScene_HUD.h index 9be484b44..ec38ace0f 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.h +++ b/targets/app/common/UI/Components/UIScene_HUD.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/IUIScene_HUD.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" @@ -186,7 +186,7 @@ public: // RENDERING virtual void render(S32 width, S32 height, - C4JRender::eViewportType viewport); + IPlatformRenderer::eViewportType viewport); protected: void handleTimerComplete(int id); diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp index be543ad91..bedd10491 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" #include "app/linux/Iggy/include/iggy.h" diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp index d62242c7a..706539071 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp index 046a5b163..679f84572 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h" #include "app/linux/Iggy/include/iggy.h" diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp index 32a866138..2f9ccf5cc 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h" #include "app/linux/Iggy/include/iggy.h" diff --git a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp index a8672eb73..664ba290d 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/linux/Iggy/include/iggy.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp index 3311a574e..2e2431ca1 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp @@ -4,7 +4,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_DLCList.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h" @@ -34,7 +34,7 @@ UIScene_DLCOffersMenu::UIScene_DLCOffersMenu(int iPad, void* initData, // Alert the app the we want to be informed of ethernet connections app.SetLiveLinkRequired(true); - m_bIsSD = !RenderManager.IsHiDef() && !RenderManager.IsWidescreen(); + m_bIsSD = !PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen(); m_labelOffers.init(app.GetString(IDS_DOWNLOADABLE_CONTENT_OFFERS)); m_buttonListOffers.init(eControl_OffersList); 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 a92076a31..aa6e82ad5 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/input.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" @@ -210,7 +210,7 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu( std::wstring wsText = app.GetString(IDS_GAMEOPTION_ONLINE); #endif EHTMLFontSize size = eHTMLSize_Normal; - if (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) { + if (!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen()) { size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; @@ -499,7 +499,7 @@ void UIScene_LaunchMoreOptionsMenu::handleFocusChange(F64 controlId, std::wstring wsText = app.GetString(stringId); EHTMLFontSize size = eHTMLSize_Normal; - if (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) { + if (!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen()) { size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; 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 81ff8352c..6e3fb18c2 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/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" @@ -249,7 +249,7 @@ void UIScene_LoadMenu::updateTooltips() { void UIScene_LoadMenu::updateComponents() { m_parentLayer->showComponent(m_iPad, eUIComponent_Panorama, true); - if (RenderManager.IsWidescreen()) { + if (PlatformRenderer.IsWidescreen()) { m_parentLayer->showComponent(m_iPad, eUIComponent_Logo, true); } else { m_parentLayer->showComponent(m_iPad, eUIComponent_Logo, false); 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 9c2566ebf..28032e4cd 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/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" 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 c41edec49..b708967fe 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/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -95,7 +95,7 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, app.GetString(m_iDifficultySettingA[app.GetGameSettings( m_iPad, eGameSetting_Difficulty)]); EHTMLFontSize size = eHTMLSize_Normal; - if (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) { + if (!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen()) { size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; @@ -200,7 +200,7 @@ void UIScene_SettingsOptionsMenu::updateComponents() { if (app.GetLocalPlayerCount() == 1) m_parentLayer->showComponent(m_iPad, eUIComponent_Logo, - RenderManager.IsHiDef()); + PlatformRenderer.IsHiDef()); else m_parentLayer->showComponent(m_iPad, eUIComponent_Logo, false); } @@ -299,7 +299,7 @@ void UIScene_SettingsOptionsMenu::handleReload() { app.GetString(m_iDifficultySettingA[app.GetGameSettings( m_iPad, eGameSetting_Difficulty)]); EHTMLFontSize size = eHTMLSize_Normal; - if (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) { + if (!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen()) { size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; @@ -380,7 +380,7 @@ void UIScene_SettingsOptionsMenu::handleSliderMove(F64 sliderId, std::wstring wsText = app.GetString(m_iDifficultySettingA[value]); EHTMLFontSize size = eHTMLSize_Normal; - if (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) { + if (!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen()) { size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; 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 914c330e9..6f164c91d 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/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/App_Defines.h" #include "app/common/Minecraft_Macros.h" #include "app/common/DLC/DLCManager.h" @@ -527,7 +527,7 @@ void UIScene_SkinSelectMenu::customDraw(IggyCustomDrawCallbackRegion* region) { // %d, stencil write= %d\n", region->stencil_func_mask, // region->stencil_func_ref, region->stencil_write_mask); if (region->stencil_func_ref != 0) - RenderManager.StateSetStencil(GL_EQUAL, region->stencil_func_ref, + PlatformRenderer.StateSetStencil(GL_EQUAL, region->stencil_func_ref, region->stencil_func_mask, region->stencil_write_mask); m_characters[characterId].render(region); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp index 21fce9209..6147b1661 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp @@ -194,7 +194,7 @@ void UIScene_AbstractContainerMenu::tick() { } void UIScene_AbstractContainerMenu::render(S32 width, S32 height, - C4JRender::eViewportType viewpBort) { + IPlatformRenderer::eViewportType viewpBort) { m_cacheSlotRenders = true; m_needsCacheRendered = m_needsCacheRendered || m_menu->needsRendered(); diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h index 448135457..84b037e5d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Cursor.h" @@ -83,7 +83,7 @@ public: } virtual void render(S32 width, S32 height, - C4JRender::eViewportType viewpBort); + IPlatformRenderer::eViewportType viewpBort); virtual void customDraw(IggyCustomDrawCallbackRegion* region); // INPUT diff --git a/targets/app/common/UI/UIBitmapFont.cpp b/targets/app/common/UI/UIBitmapFont.cpp index 74b41e2fa..1ed7820e5 100644 --- a/targets/app/common/UI/UIBitmapFont.cpp +++ b/targets/app/common/UI/UIBitmapFont.cpp @@ -274,7 +274,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph, F32 pixel_scale, float glyphScale = 1.0f, truePixelScale = 1.0f / m_cFontData->getFontData()->m_fAdvPerPixel; F32 targetPixelScale = pixel_scale; - // if(!RenderManager.IsWidescreen()) + // if(!PlatformRenderer.IsWidescreen()) //{ // // Fix for different scales in 480 // targetPixelScale = pixel_scale*2/3; diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index e5032cb49..2e557fc2a 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -245,7 +245,7 @@ UIController::UIController() { m_iPressStartQuadrantsMask = 0; - m_currentRenderViewport = C4JRender::VIEWPORT_TYPE_FULLSCREEN; + m_currentRenderViewport = IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN; m_bCustomRenderPosition = false; m_winUserIndex = 0; m_accumulatedTicks = 0; @@ -885,27 +885,27 @@ void UIController::renderScenes() { #endif } -void UIController::getRenderDimensions(C4JRender::eViewportType viewport, +void UIController::getRenderDimensions(IPlatformRenderer::eViewportType viewport, S32& width, S32& height) { switch (viewport) { - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: width = (S32)(getScreenWidth()); height = (S32)(getScreenHeight()); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: width = (S32)(getScreenWidth() / 2); height = (S32)(getScreenHeight() / 2); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: width = (S32)(getScreenWidth() / 2); height = (S32)(getScreenHeight() / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: width = (S32)(getScreenWidth() / 2); height = (S32)(getScreenHeight() / 2); break; @@ -914,36 +914,36 @@ void UIController::getRenderDimensions(C4JRender::eViewportType viewport, } } -void UIController::setupRenderPosition(C4JRender::eViewportType viewport) { +void UIController::setupRenderPosition(IPlatformRenderer::eViewportType viewport) { if (m_bCustomRenderPosition || m_currentRenderViewport != viewport) { m_currentRenderViewport = viewport; m_bCustomRenderPosition = false; S32 xPos = 0; S32 yPos = 0; switch (viewport) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: xPos = (S32)(getScreenWidth() / 4); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: xPos = (S32)(getScreenWidth() / 4); yPos = (S32)(getScreenHeight() / 2); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: yPos = (S32)(getScreenHeight() / 4); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: xPos = (S32)(getScreenWidth() / 2); yPos = (S32)(getScreenHeight() / 4); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: xPos = (S32)(getScreenWidth() / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: yPos = (S32)(getScreenHeight() / 2); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: xPos = (S32)(getScreenWidth() / 2); yPos = (S32)(getScreenHeight() / 2); break; @@ -971,18 +971,18 @@ void UIController::setupCustomDrawGameState() { m_customRenderingClearRect.bottom = LONG_MIN; #if defined(_WINDOWS64) - RenderManager.StartFrame(); + PlatformRenderer.StartFrame(); gdraw_D3D11_setViewport_4J(); #elif defined(__linux__) - RenderManager.StartFrame(); + PlatformRenderer.StartFrame(); #endif - RenderManager.Set_matrixDirty(); + PlatformRenderer.Set_matrixDirty(); // 4J Stu - We don't need to clear this here as iggy hasn't written anything // to the depth buffer. We DO however clear after we render which is why we // still setup the rectangle here - // RenderManager.Clear(GL_DEPTH_BUFFER_BIT, &m_customRenderingClearRect); + // PlatformRenderer.Clear(GL_DEPTH_BUFFER_BIT, &m_customRenderingClearRect); // glClear(GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); @@ -1061,9 +1061,9 @@ void UIController::setupCustomDrawGameStateAndMatrices( void UIController::endCustomDrawGameState() { #if defined(__linux__) - RenderManager.Clear(GL_DEPTH_BUFFER_BIT); + PlatformRenderer.Clear(GL_DEPTH_BUFFER_BIT); #else - RenderManager.Clear(GL_DEPTH_BUFFER_BIT, &m_customRenderingClearRect); + PlatformRenderer.Clear(GL_DEPTH_BUFFER_BIT, &m_customRenderingClearRect); #endif // glClear(GL_DEPTH_BUFFER_BIT); glDepthMask(false); @@ -1126,7 +1126,7 @@ GDrawTexture* RADLINK UIController::TextureSubstitutionCreateCallback( if (image.getData() != nullptr) { image.preMultiplyAlpha(); Textures* t = Minecraft::GetInstance()->textures; - int id = t->getTexture(&image, C4JRender::TEXTURE_FORMAT_RxGyBzAw, + int id = t->getTexture(&image, IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, false); // 4J Stu - All our flash controls that allow replacing textures use @@ -1951,13 +1951,13 @@ void UIController::UpdatePlayerBasePositions() { for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { if (pMinecraft->localplayers[idx] != nullptr) { if (pMinecraft->localplayers[idx]->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_FULLSCREEN) { + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN) { DisplayGamertag(idx, false); } else { DisplayGamertag(idx, true); } m_groups[idx + 1]->SetViewportType( - (C4JRender::eViewportType)pMinecraft->localplayers[idx] + (IPlatformRenderer::eViewportType)pMinecraft->localplayers[idx] ->m_iScreenSection); } else { // 4J Stu - This is a legacy thing from our XUI implementation that @@ -1965,7 +1965,7 @@ void UIController::UpdatePlayerBasePositions() { // no longer exist is SLOW This should probably be on all platforms, // but I don't have time to test them all just now! m_groups[idx + 1]->SetViewportType( - C4JRender::VIEWPORT_TYPE_FULLSCREEN); + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN); DisplayGamertag(idx, false); } } diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index e0b23c42c..877369a99 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -22,7 +22,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/input.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "platform/storage/storage.h" #include "app/common/UI/All Platforms/IUIController.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -158,7 +158,7 @@ private: int m_iPressStartQuadrantsMask; - C4JRender::eViewportType m_currentRenderViewport; + IPlatformRenderer::eViewportType m_currentRenderViewport; bool m_bCustomRenderPosition; static std::uint32_t m_dwTrialTimerLimitSecs; @@ -267,9 +267,9 @@ public: } virtual void render() = 0; - void getRenderDimensions(C4JRender::eViewportType viewport, S32& width, + void getRenderDimensions(IPlatformRenderer::eViewportType viewport, S32& width, S32& height); - void setupRenderPosition(C4JRender::eViewportType viewport); + void setupRenderPosition(IPlatformRenderer::eViewportType viewport); void setupRenderPosition(S32 xOrigin, S32 yOrigin); void SetSysUIShowing(bool bVal); diff --git a/targets/app/common/UI/UIGroup.cpp b/targets/app/common/UI/UIGroup.cpp index e810f4e24..b949956d4 100644 --- a/targets/app/common/UI/UIGroup.cpp +++ b/targets/app/common/UI/UIGroup.cpp @@ -1,7 +1,7 @@ #include "UIGroup.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -24,7 +24,7 @@ UIGroup::UIGroup(EUIGroup group, int iPad) { m_bIgnorePlayerJoinMenuDisplayed = false; // 4jcraft, moved this to the top // uninitialized memory was read. - m_viewportType = C4JRender::VIEWPORT_TYPE_FULLSCREEN; + m_viewportType = IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN; m_updateFocusStateCountdown = 0; @@ -242,7 +242,7 @@ void UIGroup::removeComponent(EUIScene scene, EUILayer layer) { m_layers[layer]->removeComponent(scene); } -void UIGroup::SetViewportType(C4JRender::eViewportType type) { +void UIGroup::SetViewportType(IPlatformRenderer::eViewportType type) { if (m_viewportType != type) { m_viewportType = type; for (unsigned int i = 0; i < eUILayer_COUNT; ++i) { @@ -251,7 +251,7 @@ void UIGroup::SetViewportType(C4JRender::eViewportType type) { } } -C4JRender::eViewportType UIGroup::GetViewportType() { return m_viewportType; } +IPlatformRenderer::eViewportType UIGroup::GetViewportType() { return m_viewportType; } void UIGroup::HandleDLCMountingComplete() { // Ignore this group if the player isn't signed in diff --git a/targets/app/common/UI/UIGroup.h b/targets/app/common/UI/UIGroup.h index 4d796989d..806c269c4 100644 --- a/targets/app/common/UI/UIGroup.h +++ b/targets/app/common/UI/UIGroup.h @@ -1,7 +1,7 @@ #pragma once #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Iggy/include/rrCore.h" #include "UILayer.h" @@ -24,7 +24,7 @@ private: UIComponent_PressStartToPlay* m_pressStartToPlay; UIScene_HUD* m_hud; - C4JRender::eViewportType m_viewportType; + IPlatformRenderer::eViewportType m_viewportType; EUIGroup m_group; int m_iPad; @@ -97,8 +97,8 @@ public: UIScene* addComponent(int iPad, EUIScene scene, EUILayer layer); void removeComponent(EUIScene scene, EUILayer layer); - void SetViewportType(C4JRender::eViewportType type); - C4JRender::eViewportType GetViewportType(); + void SetViewportType(IPlatformRenderer::eViewportType type); + IPlatformRenderer::eViewportType GetViewportType(); virtual void HandleDLCMountingComplete(); virtual void HandleDLCInstalled(); diff --git a/targets/app/common/UI/UILayer.cpp b/targets/app/common/UI/UILayer.cpp index 6db553aa1..ba67117b4 100644 --- a/targets/app/common/UI/UILayer.cpp +++ b/targets/app/common/UI/UILayer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Components/UIComponent_Chat.h" #include "app/common/UI/Components/UIComponent_DebugUIConsole.h" @@ -138,7 +138,7 @@ void UILayer::tick() { } } -void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport) { +void UILayer::render(S32 width, S32 height, IPlatformRenderer::eViewportType viewport) { if (!ui.IsExpectingOrReloadingSkin()) { for (auto it = m_components.begin(); it != m_components.end(); ++it) { auto itRef = m_componentRefCount.find((*it)->getSceneType()); @@ -808,7 +808,7 @@ void UILayer::HandleMessage(EUIMessage message, void* data) { bool UILayer::IsFullscreenGroup() { return m_parentGroup->IsFullscreenGroup(); } -C4JRender::eViewportType UILayer::getViewport() { +IPlatformRenderer::eViewportType UILayer::getViewport() { return m_parentGroup->GetViewportType(); } diff --git a/targets/app/common/UI/UILayer.h b/targets/app/common/UI/UILayer.h index 77f1a582a..540c3bd24 100644 --- a/targets/app/common/UI/UILayer.h +++ b/targets/app/common/UI/UILayer.h @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Iggy/include/rrCore.h" @@ -44,7 +44,7 @@ public: UILayer(UIGroup* parent); void tick(); - void render(S32 width, S32 height, C4JRender::eViewportType viewport); + void render(S32 width, S32 height, IPlatformRenderer::eViewportType viewport); void getRenderDimensions(S32& width, S32& height); void DestroyAll(); @@ -83,7 +83,7 @@ public: public: bool IsFullscreenGroup(); - C4JRender::eViewportType getViewport(); + IPlatformRenderer::eViewportType getViewport(); virtual void HandleDLCMountingComplete(); virtual void HandleDLCInstalled(); diff --git a/targets/app/common/UI/UIScene.cpp b/targets/app/common/UI/UIScene.cpp index 71e857a65..63a8d8d12 100644 --- a/targets/app/common/UI/UIScene.cpp +++ b/targets/app/common/UI/UIScene.cpp @@ -5,7 +5,7 @@ #include #include "platform/PlatformTypes.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" @@ -145,7 +145,7 @@ F64 UIScene::getSafeZoneHalfHeight() { float safeHeight = 0.0f; - if (!RenderManager.IsHiDef() && RenderManager.IsWidescreen()) { + if (!PlatformRenderer.IsHiDef() && PlatformRenderer.IsWidescreen()) { // 90% safezone safeHeight = height * (0.15f / 2); } else { @@ -159,7 +159,7 @@ F64 UIScene::getSafeZoneHalfWidth() { float width = ui.getScreenWidth(); float safeWidth = 0.0f; - if (!RenderManager.IsHiDef() && RenderManager.IsWidescreen()) { + if (!PlatformRenderer.IsHiDef() && PlatformRenderer.IsWidescreen()) { // 85% safezone safeWidth = width * (0.15f / 2); } else { @@ -177,35 +177,35 @@ void UIScene::updateSafeZone() { F64 safeRight = 0.0; switch (m_parentLayer->getViewport()) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: safeTop = getSafeZoneHalfHeight(); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: safeBottom = getSafeZoneHalfHeight(); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: safeLeft = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: safeRight = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: safeTop = getSafeZoneHalfHeight(); safeLeft = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: safeTop = getSafeZoneHalfHeight(); safeRight = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: safeBottom = getSafeZoneHalfHeight(); safeLeft = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: safeBottom = getSafeZoneHalfHeight(); safeRight = getSafeZoneHalfWidth(); break; - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: default: safeTop = getSafeZoneHalfHeight(); safeBottom = getSafeZoneHalfHeight(); @@ -497,7 +497,7 @@ void UIScene::doHorizontalResizeCheck() { m_funcHorizontalResizeCheck, 0, nullptr); } -void UIScene::render(S32 width, S32 height, C4JRender::eViewportType viewport) { +void UIScene::render(S32 width, S32 height, IPlatformRenderer::eViewportType viewport) { if (m_bIsReloading) return; if (!m_hasTickedOnce || !swf) return; ui.setupRenderPosition(viewport); @@ -560,7 +560,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region, bool useCommandBuffers = false; if (!useCommandBuffers || m_needsCacheRendered) { - if (useCommandBuffers) RenderManager.CBuffStart(list, true); + if (useCommandBuffers) PlatformRenderer.CBuffStart(list, true); ui.setupCustomDrawMatrices(this, customDrawRegion); _customDrawSlotControl(customDrawRegion, iPad, item, fAlpha, isFoil, bDecorations, @@ -581,11 +581,11 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region, delete drawData; } - if (useCommandBuffers) RenderManager.CBuffEnd(); + if (useCommandBuffers) PlatformRenderer.CBuffEnd(); } m_cachedSlotDraw.clear(); - if (useCommandBuffers) RenderManager.CBuffCall(list); + if (useCommandBuffers) PlatformRenderer.CBuffCall(list); // Finish GDraw and anything else that needs to be finalised ui.endCustomDraw(region); diff --git a/targets/app/common/UI/UIScene.h b/targets/app/common/UI/UIScene.h index b76240fce..9ff6a00f1 100644 --- a/targets/app/common/UI/UIScene.h +++ b/targets/app/common/UI/UIScene.h @@ -13,7 +13,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Base.h" @@ -198,7 +198,7 @@ public: // RENDERING virtual void render(S32 width, S32 height, - C4JRender::eViewportType viewpBort); + IPlatformRenderer::eViewportType viewpBort); virtual void customDraw(IggyCustomDrawCallbackRegion* region); diff --git a/targets/app/linux/LinuxGL.cpp b/targets/app/linux/LinuxGL.cpp deleted file mode 100644 index 4217f1d66..000000000 --- a/targets/app/linux/LinuxGL.cpp +++ /dev/null @@ -1,168 +0,0 @@ -#ifdef __linux__ - -#include "platform/sdl2/Render.h" -#include "platform/stubs.h" - -#include "java/ByteBuffer.h" -#include "java/FloatBuffer.h" -#include "java/IntBuffer.h" - -extern C4JRender RenderManager; - -#ifdef GLES -extern "C" { -extern void glClearDepthf(float depth); -void glClearDepth(double depth) { glClearDepthf((float)depth); } -void glTexGeni(unsigned int, unsigned int, int) {} -void glTexGenfv(unsigned int, unsigned int, const float*) {} -void glTexCoordPointer(int, unsigned int, int, const void*) {} -void glNormalPointer(unsigned int, int, const void*) {} -void glColorPointer(int, unsigned int, int, const void*) {} -void glVertexPointer(int, unsigned int, int, const void*) {} -void glEndList(void) {} -void glCallLists(int, unsigned int, const void*) {} -} -#endif - -inline int* getIntPtr(IntBuffer* buf) { - return buf ? (int*)buf->getBuffer() + buf->position() : nullptr; -} -inline void* getBytePtr(ByteBuffer* buf) { - return buf ? (char*)buf->getBuffer() + buf->position() : nullptr; -} - -void glGenTextures_4J(IntBuffer* buf) { - if (!buf) return; - int n = buf->limit() - buf->position(); - int* dst = getIntPtr(buf); - for (int i = 0; i < n; i++) dst[i] = RenderManager.TextureCreate(); -} - -void glDeleteTextures_4J(IntBuffer* buf) { - if (!buf) return; - int n = buf->limit() - buf->position(); - int* src = getIntPtr(buf); - for (int i = 0; i < n; i++) RenderManager.TextureFree(src[i]); -} - -void glTexImage2D_4J(int target, int level, int internalformat, int width, - int height, int border, int format, int type, - ByteBuffer* pixels) { - (void)target; - (void)internalformat; - (void)border; - (void)format; - (void)type; - RenderManager.TextureData(width, height, getBytePtr(pixels), level, - C4JRender::TEXTURE_FORMAT_RxGyBzAw); -} - -void glLight_4J(int light, int pname, FloatBuffer* params) { - const float* p = params->_getDataPointer(); - int idx = (light == 0x4001) ? 1 : 0; - if (pname == 0x1203) - RenderManager.StateSetLightDirection(idx, p[0], p[1], p[2]); - else if (pname == 0x1201) - RenderManager.StateSetLightColour(idx, p[0], p[1], p[2]); - else if (pname == 0x1200) - RenderManager.StateSetLightAmbientColour(p[0], p[1], p[2]); -} - -void glLightModel_4J(int pname, FloatBuffer* params) { - if (pname == 0x0B53) { - const float* p = params->_getDataPointer(); - RenderManager.StateSetLightAmbientColour(p[0], p[1], p[2]); - } -} - -void glFog_4J(int pname, FloatBuffer* params) { - const float* p = params->_getDataPointer(); - if (pname == 0x0B66) RenderManager.StateSetFogColour(p[0], p[1], p[2]); -} - -void glGetFloat_4J(int pname, FloatBuffer* params) { - const float* m = RenderManager.MatrixGet(pname); - if (m) memcpy(params->_getDataPointer(), m, 16 * sizeof(float)); -} - -void glCallLists_4J(IntBuffer* lists) { - if (!lists) return; - int count = lists->limit() - lists->position(); - int* ids = getIntPtr(lists); - for (int i = 0; i < count; i++) RenderManager.CBuffCall(ids[i], false); -} - -void glReadPixels_4J(int x, int y, int w, int h, int f, int t, ByteBuffer* p) { - (void)f; - (void)t; - RenderManager.ReadPixels(x, y, w, h, getBytePtr(p)); -} - -// dead stubs -void glTexCoordPointer_4J(int, int, FloatBuffer*) {} -void glNormalPointer_4J(int, ByteBuffer*) {} -void glColorPointer_4J(int, bool, int, ByteBuffer*) {} -void glVertexPointer_4J(int, int, FloatBuffer*) {} -void glEndList_4J(int) {} -void glTexGen_4J(int, int, FloatBuffer*) {} - -#include -#include -#include - -static PFNGLGENQUERIESARBPROC _glGenQueriesARB = nullptr; -static PFNGLBEGINQUERYARBPROC _glBeginQueryARB = nullptr; -static PFNGLENDQUERYARBPROC _glEndQueryARB = nullptr; -static PFNGLGETQUERYOBJECTUIVARBPROC _glGetQueryObjectuivARB = nullptr; -static bool _queriesInitialized = false; - -static void initQueryFuncs() { - if (_queriesInitialized) return; - _queriesInitialized = true; - _glGenQueriesARB = - (PFNGLGENQUERIESARBPROC)dlsym(RTLD_DEFAULT, "glGenQueriesARB"); - _glBeginQueryARB = - (PFNGLBEGINQUERYARBPROC)dlsym(RTLD_DEFAULT, "glBeginQueryARB"); - _glEndQueryARB = (PFNGLENDQUERYARBPROC)dlsym(RTLD_DEFAULT, "glEndQueryARB"); - _glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)dlsym( - RTLD_DEFAULT, "glGetQueryObjectuivARB"); -} - -void glGenQueriesARB_4J(IntBuffer* buf) { - initQueryFuncs(); - if (_glGenQueriesARB && buf) { - int n = buf->limit() - buf->position(); - if (n > 0) _glGenQueriesARB(n, (GLuint*)getIntPtr(buf)); - } -} - -void glBeginQueryARB_4J(int target, int id) { - initQueryFuncs(); - if (_glBeginQueryARB) _glBeginQueryARB((GLenum)target, (GLuint)id); -} - -void glEndQueryARB_4J(int target) { - initQueryFuncs(); - if (_glEndQueryARB) _glEndQueryARB((GLenum)target); -} - -void glGetQueryObjectuARB_4J(int id, int pname, IntBuffer* params) { - initQueryFuncs(); - if (_glGetQueryObjectuivARB && params) - // LWJGL does not change limits/positions during these calls, it - // reads/writes exactly at pointer!! - _glGetQueryObjectuivARB((GLuint)id, (GLenum)pname, - (GLuint*)getIntPtr(params)); -} -void glGetFloat(int pname, FloatBuffer* params) { - glGetFloat_4J(pname, params); -} -void LinuxGLLogLightmapState(const char* stage, int textureId, - bool scaleLight) { - static int logCount = 0; - if (logCount >= 16) return; - ++logCount; - fprintf(stderr, "[linux-lightmap] %s tex=%d scale=%d\n", stage, textureId, - scaleLight ? 1 : 0); -} -#endif \ No newline at end of file diff --git a/targets/app/linux/LinuxGL.h b/targets/app/linux/LinuxGL.h deleted file mode 100644 index 2d8ab33fb..000000000 --- a/targets/app/linux/LinuxGL.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#ifdef __linux__ - -#include -#include - -class FloatBuffer; -class IntBuffer; -class ByteBuffer; - -void glGenTextures(IntBuffer*); -int glGenTextures(); -void glDeleteTextures(IntBuffer*); -void glLight(int, int, FloatBuffer*); -void glLightModel(int, FloatBuffer*); -void glGetFloat(int a, FloatBuffer* b); -void glTexCoordPointer(int, int, int, int); -void glTexCoordPointer(int, int, FloatBuffer*); -void glNormalPointer(int, int, int); -void glNormalPointer(int, ByteBuffer*); -void glColorPointer(int, bool, int, ByteBuffer*); -void glColorPointer(int, int, int, int); -void glVertexPointer(int, int, int, int); -void glVertexPointer(int, int, FloatBuffer*); -void glNewList(int, int); -void glEndList(int vertexCount = 0); -void glTexImage2D(int, int, int, int, int, int, int, int, ByteBuffer*); -void glCallLists(IntBuffer*); -void glGenQueriesARB(IntBuffer*); -void glBeginQueryARB(int, int); -void glEndQueryARB(int); -void glGetQueryObjectuARB(int, int, IntBuffer*); -void glFog(int, FloatBuffer*); -void glTexGen(int, int, FloatBuffer*); -void glReadPixels(int, int, int, int, int, int, ByteBuffer*); -void glTexGeni(int, int, int); -void glMultiTexCoord2f(int, float, float); -void glClientActiveTexture(int); -void glActiveTexture(int); - -#endif diff --git a/targets/app/linux/LinuxGame.cpp b/targets/app/linux/LinuxGame.cpp index 7ed076b48..cba435278 100644 --- a/targets/app/linux/LinuxGame.cpp +++ b/targets/app/linux/LinuxGame.cpp @@ -5,7 +5,7 @@ #include #include "platform/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Game.h" @@ -28,7 +28,7 @@ void LinuxGame::SetRichPresenceContext(int iPad, int contextId) {} void LinuxGame::StoreLaunchData() {} void LinuxGame::ExitGame() { app.DebugPrintf("Linux_App LinuxGame::ExitGame AFTER START\n"); - RenderManager.Close(); + PlatformRenderer.Close(); } void LinuxGame::FatalLoadError() { app.DebugPrintf( diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index c8fe148be..51c7ee065 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/input.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "platform/storage/storage.h" #include "app/common/App_Defines.h" #include "app/common/Audio/SoundEngine.h" @@ -439,13 +439,13 @@ int main(int argc, const char* argv[]) { reqH = atoi(argv[++i]); } } - if (reqW > 0 && reqH > 0) RenderManager.SetWindowSize(reqW, reqH); - if (fs) RenderManager.SetFullscreen(true); + if (reqW > 0 && reqH > 0) PlatformRenderer.SetWindowSize(reqW, reqH); + if (fs) PlatformRenderer.SetFullscreen(true); } static bool bTrialTimerDisplayed = true; - RenderManager.Initialise(); + PlatformRenderer.Initialise(); // Read the file containing the product codes app.DebugPrintf("---ReadProductCodes()\n"); @@ -523,11 +523,11 @@ int main(int argc, const char* argv[]) { app.InitGameSettings(); app.InitialiseTips(); - while (!RenderManager.ShouldClose()) { - RenderManager.StartFrame(); + while (!PlatformRenderer.ShouldClose()) { + PlatformRenderer.StartFrame(); if (pMinecraft->pollResize()) { int fbw, fbh; - RenderManager.GetFramebufferSize(fbw, fbh); + PlatformRenderer.GetFramebufferSize(fbw, fbh); ui.setScreenSize(fbw, fbh); } app.UpdateTime(); @@ -537,7 +537,7 @@ int main(int argc, const char* argv[]) { PlatformStorage.Tick(); - RenderManager.Tick(); + PlatformRenderer.Tick(); // Tick the social networking manager. // CSocialManager::Instance()->Tick(); @@ -586,7 +586,7 @@ int main(int argc, const char* argv[]) { ui.render(); // Present the frame. - RenderManager.Present(); + PlatformRenderer.Present(); ui.CheckMenuDisplayed(); // has the game defined profile data been changed (by a profile load) @@ -638,7 +638,7 @@ int main(int argc, const char* argv[]) { // Graceful shutdown: destroy GL context and GLFW before any C++ dtors run. // Without this, static/global destructors that touch GL objects cause // SIGSEGV. - RenderManager.Shutdown(); + PlatformRenderer.Shutdown(); _exit(0); } // end main diff --git a/targets/app/linux/Linux_UIController.cpp b/targets/app/linux/Linux_UIController.cpp index 8a5417a43..7e17456b2 100644 --- a/targets/app/linux/Linux_UIController.cpp +++ b/targets/app/linux/Linux_UIController.cpp @@ -1,7 +1,7 @@ #include // GDraw GL backend for Linux -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "Linux_UIController.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/Iggy/gdraw/gdraw.h" diff --git a/targets/app/windows/Windows64_UIController.cpp b/targets/app/windows/Windows64_UIController.cpp index 2f33835f5..d37be6d73 100644 --- a/targets/app/windows/Windows64_UIController.cpp +++ b/targets/app/windows/Windows64_UIController.cpp @@ -150,7 +150,7 @@ GDrawTexture* ConsoleUIController::getSubstitutionTexture(int textureId) { this texture, or stream video into it. Wrapped textures take up a handle. They will never be freed or otherwise modified by GDraw; nor will GDraw change any reference counts. All this is up to the application. */ - ID3D11ShaderResourceView* tex = RenderManager.TextureGetTexture(textureId); + ID3D11ShaderResourceView* tex = PlatformRenderer.TextureGetTexture(textureId); ID3D11Resource* resource; tex->GetResource(&resource); ID3D11Texture2D* tex2d = (ID3D11Texture2D*)resource; diff --git a/targets/app/windows/src/Windows64_Minecraft.cpp b/targets/app/windows/src/Windows64_Minecraft.cpp index 3d0a960ea..c71f2e217 100644 --- a/targets/app/windows/src/Windows64_Minecraft.cpp +++ b/targets/app/windows/src/Windows64_Minecraft.cpp @@ -635,7 +635,7 @@ int32_t InitDevice() { vp.TopLeftY = 0; g_pImmediateContext->RSSetViewports(1, &vp); - RenderManager.Initialise(g_pd3dDevice, g_pSwapChain); + PlatformRenderer.Initialise(g_pd3dDevice, g_pSwapChain); return 0; } @@ -706,7 +706,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, app.loadMediaArchive(); - RenderManager.Initialise(g_pd3dDevice, g_pSwapChain); + PlatformRenderer.Initialise(g_pd3dDevice, g_pSwapChain); app.loadStringTable(); ui.init(g_pd3dDevice, g_pImmediateContext, g_pRenderTargetView, @@ -780,7 +780,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, DispatchMessage(&msg); continue; } - RenderManager.StartFrame(); + PlatformRenderer.StartFrame(); // static bool bPlay=false; // if(bPlay) @@ -796,7 +796,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, PlatformStorage.Tick(); - RenderManager.Tick(); + PlatformRenderer.Tick(); // Tick the social networking manager. // CSocialManager::Instance()->Tick(); @@ -830,7 +830,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, ui.tick(); ui.render(); // Present the frame. - RenderManager.Present(); + PlatformRenderer.Present(); ui.CheckMenuDisplayed(); // Any threading type things to deal with from the xui side? diff --git a/targets/minecraft/client/BufferedImage.cpp b/targets/minecraft/client/BufferedImage.cpp index 49d64c33a..4752a427b 100644 --- a/targets/minecraft/client/BufferedImage.cpp +++ b/targets/minecraft/client/BufferedImage.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" @@ -94,13 +94,13 @@ BufferedImage::BufferedImage(const std::wstring& File, if (foundOnDisk) { std::string nativePath = std::filesystem::path(finalPath).string(); - hr = RenderManager.LoadTextureData(nativePath.c_str(), + hr = PlatformRenderer.LoadTextureData(nativePath.c_str(), &ImageInfo, &data[l]); } else { std::wstring archiveKey = L"res/" + fileName; if (gameServices().hasArchiveFile(archiveKey)) { std::vector ba = gameServices().getArchiveFile(archiveKey); - hr = RenderManager.LoadTextureData(ba.data(), ba.size(), + hr = PlatformRenderer.LoadTextureData(ba.data(), ba.size(), &ImageInfo, &data[l]); } } @@ -152,7 +152,7 @@ BufferedImage::BufferedImage(DLCPack* dlcPack, const std::wstring& File, } D3DXIMAGE_INFO ImageInfo; - hr = RenderManager.LoadTextureData(pbData, dataBytes, &ImageInfo, + hr = PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, &data[l]); if (hr == ERROR_SUCCESS && l == 0) { width = ImageInfo.Width; @@ -169,7 +169,7 @@ BufferedImage::BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes) { D3DXIMAGE_INFO ImageInfo; memset(&ImageInfo, 0, sizeof(D3DXIMAGE_INFO)); int32_t hr = - RenderManager.LoadTextureData(pbData, dataBytes, &ImageInfo, &data[0]); + PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, &data[0]); if (hr == ERROR_SUCCESS) { width = ImageInfo.Width; diff --git a/targets/minecraft/client/Lighting.cpp b/targets/minecraft/client/Lighting.cpp index e5adc421a..132da9140 100644 --- a/targets/minecraft/client/Lighting.cpp +++ b/targets/minecraft/client/Lighting.cpp @@ -2,8 +2,7 @@ #include -#include "platform/sdl2/Render.h" -#include "platform/stubs.h" +#include "platform/renderer/renderer.h" #include "java/FloatBuffer.h" #include "minecraft/world/phys/Vec3.h" diff --git a/targets/minecraft/client/MemoryTracker.cpp b/targets/minecraft/client/MemoryTracker.cpp index c0a2b0bb7..215d5cc34 100644 --- a/targets/minecraft/client/MemoryTracker.cpp +++ b/targets/minecraft/client/MemoryTracker.cpp @@ -2,8 +2,9 @@ #include #include +#include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "java/ByteBuffer.h" std::unordered_map MemoryTracker::GL_LIST_IDS; diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 52b18a4c7..98882b84c 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -14,7 +14,7 @@ #include #include "platform/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" @@ -111,7 +111,6 @@ #include "app/common/Tutorial/FullTutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" #include "app/common/UI/UIFontData.h" -#include "platform/stubs.h" #include "util/StringHelpers.h" #include "java/File.h" #include "java/System.h" @@ -234,7 +233,7 @@ Minecraft::Minecraft(Component* mouseComponent, Canvas* parent, // code that the width is 3/4 what it actually is, to correctly present a // 4:3 image. Have added width_phys and height_phys for any code we add that // requires to know the real physical dimensions of the frame buffer. - if (RenderManager.IsWidescreen()) { + if (PlatformRenderer.IsWidescreen()) { this->width = width; } else { this->width = (width * 3) / 4; @@ -391,7 +390,7 @@ void Minecraft::init() { } progressRenderer = new ProgressRenderer(this); - RenderManager.CBuffLockStaticCreations(); + PlatformRenderer.CBuffLockStaticCreations(); } void Minecraft::renderLoadingScreen() { @@ -401,7 +400,7 @@ void Minecraft::renderLoadingScreen() { ScreenSizeCalculator ssc(options, width, height); // xxx - RenderManager.StartFrame(); + PlatformRenderer.StartFrame(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -442,7 +441,7 @@ void Minecraft::renderLoadingScreen() { // Display::swapBuffers(); // xxx - RenderManager.Present(); + PlatformRenderer.Present(); #endif } @@ -707,7 +706,7 @@ void Minecraft::updatePlayerViewportAssignments() { for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (localplayers[i] != nullptr) localplayers[i]->m_iScreenSection = - C4JRender::VIEWPORT_TYPE_FULLSCREEN; + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN; } } else if (viewportsRequired == 2) { // Split screen - TODO - option for vertical/horizontal split @@ -718,10 +717,10 @@ void Minecraft::updatePlayerViewportAssignments() { if (gameServices().getGameSettings(PlatformInput.GetPrimaryPad(), eGameSetting_SplitScreenVertical)) { localplayers[i]->m_iScreenSection = - C4JRender::VIEWPORT_TYPE_SPLIT_LEFT + found; + IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT + found; } else { localplayers[i]->m_iScreenSection = - C4JRender::VIEWPORT_TYPE_SPLIT_TOP + found; + IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP + found; } found++; } @@ -740,18 +739,18 @@ void Minecraft::updatePlayerViewportAssignments() { // quadrant, but ending up in the 3rd viewport. if (gameServices().getGameStarted()) { if ((localplayers[i]->m_iScreenSection >= - C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT) && + IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT) && (localplayers[i]->m_iScreenSection <= - C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT)) { + IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT)) { quadrantsAllocated [localplayers[i]->m_iScreenSection - - C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT] = true; + IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT] = true; } } else { // Reset the viewport so that it can be assigned in the next // loop localplayers[i]->m_iScreenSection = - C4JRender::VIEWPORT_TYPE_FULLSCREEN; + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN; } } } @@ -761,13 +760,13 @@ void Minecraft::updatePlayerViewportAssignments() { for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (localplayers[i] != nullptr) { if ((localplayers[i]->m_iScreenSection < - C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT) || + IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT) || (localplayers[i]->m_iScreenSection > - C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT)) { + IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT)) { for (int j = 0; j < 4; j++) { if (!quadrantsAllocated[j]) { localplayers[i]->m_iScreenSection = - C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + j; + IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + j; quadrantsAllocated[j] = true; break; } @@ -841,7 +840,7 @@ std::shared_ptr Minecraft::createExtraLocalPlayer( if (clientConnection == nullptr) return nullptr; if (clientConnection == m_pendingLocalConnections[idx]) { - int tempScreenSection = C4JRender::VIEWPORT_TYPE_FULLSCREEN; + int tempScreenSection = IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN; if (localplayers[idx] != nullptr && localgameModes[idx] == nullptr) { // A temp player displaying a connecting screen tempScreenSection = localplayers[idx]->m_iScreenSection; @@ -1383,7 +1382,7 @@ void Minecraft::run_middle() { !ui.IsIgnorePlayerJoinMenuDisplayed( PlatformInput.GetPrimaryPad()) && g_NetworkManager.SessionHasSpace() && - RenderManager.IsHiDef() && + PlatformRenderer.IsHiDef() && PlatformInput.ButtonPressed(i); if (tryJoin) { if (!ui.PressStartPlaying(i)) { @@ -1650,8 +1649,8 @@ void Minecraft::run_middle() { int iPrimaryPad = PlatformInput.GetPrimaryPad(); for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (setLocalPlayerIdx(i)) { - RenderManager.StateSetViewport( - (C4JRender::eViewportType) + PlatformRenderer.StateSetViewport( + (IPlatformRenderer::eViewportType) player->m_iScreenSection); gameRenderer->render(timer->a, bFirst); bFirst = false; @@ -1679,8 +1678,8 @@ void Minecraft::run_middle() { // GameRenderer directly so mc->screen draws. if (bFirst) { localPlayerIdx = 0; - RenderManager.StateSetViewport( - C4JRender::VIEWPORT_TYPE_FULLSCREEN); + PlatformRenderer.StateSetViewport( + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN); gameRenderer->render(timer->a, true); } #endif @@ -1689,21 +1688,21 @@ void Minecraft::run_middle() { // black if (unoccupiedQuadrant > -1) { // render a logo - RenderManager.StateSetViewport(( - C4JRender:: - eViewportType)(C4JRender:: + PlatformRenderer.StateSetViewport(( + IPlatformRenderer:: + eViewportType)(IPlatformRenderer:: VIEWPORT_TYPE_QUADRANT_TOP_LEFT + unoccupiedQuadrant)); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); ui.SetEmptyQuadrantLogo( - C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + + IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + unoccupiedQuadrant); } setLocalPlayerIdx(iPrimaryPad); - RenderManager.StateSetViewport( - C4JRender::VIEWPORT_TYPE_FULLSCREEN); + PlatformRenderer.StateSetViewport( + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN); } glFlush(); @@ -1936,7 +1935,7 @@ void Minecraft::pauseGame() { bool Minecraft::pollResize() { int fbw, fbh; - RenderManager.GetFramebufferSize(fbw, fbh); + PlatformRenderer.GetFramebufferSize(fbw, fbh); if (fbw != width_phys || fbh != height_phys) { resize(fbw, fbh); return true; @@ -1951,7 +1950,7 @@ void Minecraft::resize(int width, int height) { // for non-widescreen aspect ratio to fix UI scaling. this->width_phys = width; this->height_phys = height; - if (RenderManager.IsWidescreen()) { + if (PlatformRenderer.IsWidescreen()) { this->width = width; } else { this->width = (width * 3) / 4; diff --git a/targets/minecraft/client/Options.cpp b/targets/minecraft/client/Options.cpp index a9428d697..12142849f 100644 --- a/targets/minecraft/client/Options.cpp +++ b/targets/minecraft/client/Options.cpp @@ -4,7 +4,6 @@ #include "KeyMapping.h" #include "app/common/Audio/SoundEngine.h" #include "app/linux/LinuxGame.h" -#include "platform/stubs.h" #include "util/StringHelpers.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" diff --git a/targets/minecraft/client/gui/Button.cpp b/targets/minecraft/client/gui/Button.cpp index c7b960875..e35869bba 100644 --- a/targets/minecraft/client/gui/Button.cpp +++ b/targets/minecraft/client/gui/Button.cpp @@ -1,6 +1,6 @@ #include "Button.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" diff --git a/targets/minecraft/client/gui/DeathScreen.cpp b/targets/minecraft/client/gui/DeathScreen.cpp index 550e5b15e..fee4bcf7f 100644 --- a/targets/minecraft/client/gui/DeathScreen.cpp +++ b/targets/minecraft/client/gui/DeathScreen.cpp @@ -4,7 +4,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "Button.h" #include "PauseScreen.h" #include "util/StringHelpers.h" diff --git a/targets/minecraft/client/gui/Font.cpp b/targets/minecraft/client/gui/Font.cpp index 8d08bd9d2..a9ac0fce5 100644 --- a/targets/minecraft/client/gui/Font.cpp +++ b/targets/minecraft/client/gui/Font.cpp @@ -4,8 +4,9 @@ #include #include +#include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/BufferedImage.h" #include "util/StringHelpers.h" #include "java/Random.h" diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index edd5e9ff7..b820e6ea1 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -6,7 +6,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/input.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "Facing.h" #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" @@ -56,7 +56,6 @@ #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/PortalTile.h" #include "minecraft/world/level/tile/Tile.h" -#include "platform/stubs.h" #include "strings.h" @@ -104,7 +103,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // scaling above to move the gui out of the way of the // tool tips int guiScale; // = ( minecraft->player->m_iScreenSection == - // C4JRender::VIEWPORT_TYPE_FULLSCREEN ? 3 : 2 ); + // IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN ? 3 : 2 ); int iPad = minecraft->player->GetXboxPad(); int iWidthOffset = 0, iHeightOffset = 0; // used to get the interface looking right on a 2 @@ -112,7 +111,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // 4J-PB - selected the gui scale based on the slider settings if (minecraft->player->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_FULLSCREEN) { + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN) { guiScale = gameServices().getGameSettings(iPad, eGameSetting_UISize) + 2; } else { guiScale = @@ -148,14 +147,14 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // Check which screen section this player is in switch (minecraft->player->m_iScreenSection) { - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: // single player iSafezoneXHalf = screenWidth / 20; // 5% iSafezoneYHalf = screenHeight / 20; // 5% iSafezoneTopYHalf = iSafezoneYHalf; iTooltipsYOffset = 40 + splitYOffset; break; - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: iSafezoneXHalf = screenWidth / 10; // 5% (need to treat the whole screen is 2x this screen) @@ -168,7 +167,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { bTwoPlayerSplitscreen = true; currentGuiScaleFactor *= 0.5f; break; - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: iSafezoneXHalf = screenWidth / 10; // 5% (need to treat the whole screen is 2x this screen) @@ -183,7 +182,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { bTwoPlayerSplitscreen = true; currentGuiScaleFactor *= 0.5f; break; - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT: iSafezoneXHalf = screenWidth / 10; // 5% (the whole screen is 2x this screen) iSafezoneYHalf = splitYOffset + @@ -196,7 +195,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { bTwoPlayerSplitscreen = true; currentGuiScaleFactor *= 0.5f; break; - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT: iSafezoneXHalf = 0; iSafezoneYHalf = splitYOffset + screenHeight / 10; // 5% (need to treat the whole @@ -208,7 +207,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { bTwoPlayerSplitscreen = true; currentGuiScaleFactor *= 0.5f; break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: iSafezoneXHalf = screenWidth / 10; // 5% (the whole screen is 2x this screen) iSafezoneYHalf = splitYOffset; @@ -216,14 +215,14 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { iTooltipsYOffset = 44; currentGuiScaleFactor *= 0.5f; break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: iSafezoneXHalf = 0; iSafezoneYHalf = splitYOffset; // 5% iSafezoneTopYHalf = screenHeight / 10; iTooltipsYOffset = 44; currentGuiScaleFactor *= 0.5f; break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: iSafezoneXHalf = screenWidth / 10; // 5% (the whole screen is 2x this screen) iSafezoneYHalf = @@ -233,7 +232,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { iTooltipsYOffset = 44; currentGuiScaleFactor *= 0.5f; break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: + case IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: iSafezoneXHalf = 0; iSafezoneYHalf = splitYOffset + @@ -253,7 +252,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // if tooltips are off, set the y offset to zero if (gameServices().getGameSettings(iPad, eGameSetting_Tooltips) == 0 && bDisplayGui) { switch (minecraft->player->m_iScreenSection) { - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: iTooltipsYOffset = screenHeight / 10; break; default: @@ -358,10 +357,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { fVal = fAlphaIncrementPerCent * (float)ucAlpha; } - RenderManager.StateSetBlendFactor(0xffffff | + PlatformRenderer.StateSetBlendFactor(0xffffff | (((unsigned int)fVal) << 24)); currentGuiBlendFactor = fVal / 255.0f; - // RenderManager.StateSetBlendFactor(0x40ffffff); + // PlatformRenderer.StateSetBlendFactor(0x40ffffff); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); blitOffset = -90; @@ -410,7 +409,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { minecraft->textures->bindTexture( &GUI_ICONS_LOCATION); // L"/gui/icons.png")); glEnable(GL_BLEND); - RenderManager.StateSetBlendFactor(0xffffff | + PlatformRenderer.StateSetBlendFactor(0xffffff | (((unsigned int)fVal) << 24)); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); // glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR); @@ -1374,9 +1373,9 @@ void Gui::addMessage(const std::wstring& _string, int iPad, std::wstring string = _string; // 4J - Take copy of input as it is const // int iScale=1; - // if((minecraft->player->m_iScreenSection==C4JRender::VIEWPORT_TYPE_SPLIT_TOP) + // if((minecraft->player->m_iScreenSection==IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP) // || - // (minecraft->player->m_iScreenSection==C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM)) + // (minecraft->player->m_iScreenSection==IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM)) //{ // iScale=2; // } @@ -1404,10 +1403,10 @@ void Gui::addMessage(const std::wstring& _string, int iPad, int maximumChars; switch (minecraft->player->m_iScreenSection) { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - case C4JRender::VIEWPORT_TYPE_FULLSCREEN: - if (RenderManager.IsHiDef()) { + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP: + case IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM: + case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: + if (PlatformRenderer.IsHiDef()) { maximumChars = 105; } else { maximumChars = 55; @@ -1416,7 +1415,7 @@ void Gui::addMessage(const std::wstring& _string, int iPad, case XC_LANGUAGE_JAPANESE: case XC_LANGUAGE_TCHINESE: case XC_LANGUAGE_KOREAN: - if (RenderManager.IsHiDef()) { + if (PlatformRenderer.IsHiDef()) { maximumChars = 70; } else { maximumChars = 35; diff --git a/targets/minecraft/client/gui/GuiComponent.cpp b/targets/minecraft/client/gui/GuiComponent.cpp index a0d61fc0f..3dc780b4a 100644 --- a/targets/minecraft/client/gui/GuiComponent.cpp +++ b/targets/minecraft/client/gui/GuiComponent.cpp @@ -3,8 +3,7 @@ #include #include -#include "platform/sdl2/Render.h" -#include "platform/stubs.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/Gui.h" diff --git a/targets/minecraft/client/gui/Minimap.cpp b/targets/minecraft/client/gui/Minimap.cpp index 73d939e0e..2111f908f 100644 --- a/targets/minecraft/client/gui/Minimap.cpp +++ b/targets/minecraft/client/gui/Minimap.cpp @@ -7,7 +7,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "Font.h" #include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" @@ -29,7 +29,7 @@ Minimap::Minimap(Font* font, Options* options, Textures* textures, this->font = font; BufferedImage* img = new BufferedImage(w, h, BufferedImage::TYPE_INT_ARGB); mapTexture = - textures->getTexture(img, C4JRender::TEXTURE_FORMAT_RxGyBzAw, + textures->getTexture(img, IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, false); // 4J - make sure we aren't mipmapping as // we never set the data for mipmaps delete img; diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index 0363f767a..8701b10aa 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -101,7 +101,7 @@ void Screen::updateEvents() { // TODO: update for SDL if we ever get around to that #if (defined(ENABLE_JAVA_GUIS)) int fbw, fbh; - RenderManager.GetFramebufferSize(fbw, fbh); + PlatformRenderer.GetFramebufferSize(fbw, fbh); glViewport(0, 0, fbw, fbh); ScreenSizeCalculator ssc(minecraft->options, minecraft->width, minecraft->height); diff --git a/targets/minecraft/client/gui/SlideButton.cpp b/targets/minecraft/client/gui/SlideButton.cpp index 28bda91e6..8e4df5c47 100644 --- a/targets/minecraft/client/gui/SlideButton.cpp +++ b/targets/minecraft/client/gui/SlideButton.cpp @@ -1,6 +1,6 @@ #include "SlideButton.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/gui/Button.h" diff --git a/targets/minecraft/client/gui/TradeSwitchButton.cpp b/targets/minecraft/client/gui/TradeSwitchButton.cpp index 1da728e0a..13271bfe3 100644 --- a/targets/minecraft/client/gui/TradeSwitchButton.cpp +++ b/targets/minecraft/client/gui/TradeSwitchButton.cpp @@ -1,6 +1,7 @@ #include "TradeSwitchButton.h" #include +#include #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" diff --git a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp index fcab78a71..daad90a66 100644 --- a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "java/System.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" @@ -44,7 +44,7 @@ void AchievementPopup::permanent(Achievement* ach) { void AchievementPopup::prepareWindow() { { int fbw, fbh; - RenderManager.GetFramebufferSize(fbw, fbh); + PlatformRenderer.GetFramebufferSize(fbw, fbh); glViewport(0, 0, fbw, fbh); } // just future proofing glMatrixMode(GL_PROJECTION); diff --git a/targets/minecraft/client/gui/achievement/AchievementScreen.cpp b/targets/minecraft/client/gui/achievement/AchievementScreen.cpp index 95f031cd7..cc4fced49 100644 --- a/targets/minecraft/client/gui/achievement/AchievementScreen.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementScreen.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "platform/stubs.h" #include "minecraft/client/KeyMapping.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp b/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp index 48ef6a7aa..8c4079b49 100644 --- a/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp +++ b/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" diff --git a/targets/minecraft/client/gui/inventory/BeaconScreen.cpp b/targets/minecraft/client/gui/inventory/BeaconScreen.cpp index 8ff2f0589..5d9076852 100644 --- a/targets/minecraft/client/gui/inventory/BeaconScreen.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconScreen.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "BeaconCancelButton.h" #include "BeaconConfirmButton.h" #include "BeaconPowerButton.h" diff --git a/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp b/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp index ce758fc4c..ba551bce4 100644 --- a/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp +++ b/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp @@ -1,6 +1,7 @@ #include "BrewingStandScreen.h" #include +#include #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" diff --git a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp index ee0cb7559..4dd812cfe 100644 --- a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp @@ -7,7 +7,7 @@ #include #include "platform/input/input.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "AbstractContainerScreen.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" #include "app/linux/LinuxGame.h" diff --git a/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp b/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp index e6fdec577..9c6b1e7db 100644 --- a/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp +++ b/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "AbstractContainerScreen.h" #include "minecraft/client/Lighting.h" @@ -159,7 +160,7 @@ void EnchantmentScreen::renderBg(float a) { 240 * scaleFactor); glTranslatef(-0.34f, 0.23f, 0.0f); - gluPerspective(90.0f, 1.3333334f, 9.0f, 80.0f); + PlatformRenderer.MatrixPerspective(90.0f, 1.3333334f, 9.0f, 80.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); diff --git a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp index 74e97146a..5f3966d89 100644 --- a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp @@ -2,6 +2,7 @@ #include #include +#include #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/gui/inventory/InventoryScreen.cpp b/targets/minecraft/client/gui/inventory/InventoryScreen.cpp index c9d0b7fd0..c5ef4963e 100644 --- a/targets/minecraft/client/gui/inventory/InventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/InventoryScreen.cpp @@ -4,7 +4,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" diff --git a/targets/minecraft/client/gui/inventory/MerchantScreen.cpp b/targets/minecraft/client/gui/inventory/MerchantScreen.cpp index 494c5ffca..5dfdfef7a 100644 --- a/targets/minecraft/client/gui/inventory/MerchantScreen.cpp +++ b/targets/minecraft/client/gui/inventory/MerchantScreen.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "AbstractContainerScreen.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" diff --git a/targets/minecraft/client/gui/inventory/RepairScreen.cpp b/targets/minecraft/client/gui/inventory/RepairScreen.cpp index 2ee2cd99a..3a96e74a4 100644 --- a/targets/minecraft/client/gui/inventory/RepairScreen.cpp +++ b/targets/minecraft/client/gui/inventory/RepairScreen.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/gui/inventory/TextEditScreen.cpp b/targets/minecraft/client/gui/inventory/TextEditScreen.cpp index 356665fbc..6bf52f199 100644 --- a/targets/minecraft/client/gui/inventory/TextEditScreen.cpp +++ b/targets/minecraft/client/gui/inventory/TextEditScreen.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "platform/stubs.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/model/ChickenModel.cpp b/targets/minecraft/client/model/ChickenModel.cpp index f18595342..6604567ef 100644 --- a/targets/minecraft/client/model/ChickenModel.cpp +++ b/targets/minecraft/client/model/ChickenModel.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" diff --git a/targets/minecraft/client/model/GhastModel.cpp b/targets/minecraft/client/model/GhastModel.cpp index 9325bb3e1..676797e77 100644 --- a/targets/minecraft/client/model/GhastModel.cpp +++ b/targets/minecraft/client/model/GhastModel.cpp @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "java/Random.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" diff --git a/targets/minecraft/client/model/HumanoidModel.cpp b/targets/minecraft/client/model/HumanoidModel.cpp index 630a0eabf..436183517 100644 --- a/targets/minecraft/client/model/HumanoidModel.cpp +++ b/targets/minecraft/client/model/HumanoidModel.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" diff --git a/targets/minecraft/client/model/ModelHorse.cpp b/targets/minecraft/client/model/ModelHorse.cpp index c110229bb..43c598547 100644 --- a/targets/minecraft/client/model/ModelHorse.cpp +++ b/targets/minecraft/client/model/ModelHorse.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/util/Mth.h" diff --git a/targets/minecraft/client/model/OcelotModel.cpp b/targets/minecraft/client/model/OcelotModel.cpp index 30a090c6e..00c7a71de 100644 --- a/targets/minecraft/client/model/OcelotModel.cpp +++ b/targets/minecraft/client/model/OcelotModel.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Ocelot.h" diff --git a/targets/minecraft/client/model/QuadrupedModel.cpp b/targets/minecraft/client/model/QuadrupedModel.cpp index 360210103..1697242df 100644 --- a/targets/minecraft/client/model/QuadrupedModel.cpp +++ b/targets/minecraft/client/model/QuadrupedModel.cpp @@ -5,9 +5,10 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" +#include QuadrupedModel::QuadrupedModel(int legSize, float g) : Model() { yHeadOffs = 8; diff --git a/targets/minecraft/client/model/WolfModel.cpp b/targets/minecraft/client/model/WolfModel.cpp index 75b6d0400..f9b86fee1 100644 --- a/targets/minecraft/client/model/WolfModel.cpp +++ b/targets/minecraft/client/model/WolfModel.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/world/entity/LivingEntity.h" diff --git a/targets/minecraft/client/model/dragon/DragonModel.cpp b/targets/minecraft/client/model/dragon/DragonModel.cpp index 1a764de7e..9a2566353 100644 --- a/targets/minecraft/client/model/dragon/DragonModel.cpp +++ b/targets/minecraft/client/model/dragon/DragonModel.cpp @@ -6,9 +6,9 @@ #include #include #include +#include -#include "platform/sdl2/Render.h" - +#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp b/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp index 5e8e51501..9c119198d 100644 --- a/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp +++ b/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp @@ -2,8 +2,9 @@ #include #include +#include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" EnderCrystalModel::EnderCrystalModel(float g) { diff --git a/targets/minecraft/client/model/geom/ModelPart.cpp b/targets/minecraft/client/model/geom/ModelPart.cpp index c64c567b5..ce13eb6c3 100644 --- a/targets/minecraft/client/model/geom/ModelPart.cpp +++ b/targets/minecraft/client/model/geom/ModelPart.cpp @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "Cube.h" #include "TexOffs.h" #include "minecraft/client/MemoryTracker.h" diff --git a/targets/minecraft/client/particle/FootstepParticle.cpp b/targets/minecraft/client/particle/FootstepParticle.cpp index 1a270c663..dfeffe0e5 100644 --- a/targets/minecraft/client/particle/FootstepParticle.cpp +++ b/targets/minecraft/client/particle/FootstepParticle.cpp @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/Tesselator.h" diff --git a/targets/minecraft/client/particle/HugeExplosionParticle.cpp b/targets/minecraft/client/particle/HugeExplosionParticle.cpp index 8ee5059e0..2cf67ba77 100644 --- a/targets/minecraft/client/particle/HugeExplosionParticle.cpp +++ b/targets/minecraft/client/particle/HugeExplosionParticle.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "java/Random.h" diff --git a/targets/minecraft/client/particle/ParticleEngine.cpp b/targets/minecraft/client/particle/ParticleEngine.cpp index 0ec0743af..4f8908049 100644 --- a/targets/minecraft/client/particle/ParticleEngine.cpp +++ b/targets/minecraft/client/particle/ParticleEngine.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "Particle.h" #include "TerrainParticle.h" #include "util/StringHelpers.h" diff --git a/targets/minecraft/client/particle/TakeAnimationParticle.cpp b/targets/minecraft/client/particle/TakeAnimationParticle.cpp index 9f4e44be7..b214cc02a 100644 --- a/targets/minecraft/client/particle/TakeAnimationParticle.cpp +++ b/targets/minecraft/client/particle/TakeAnimationParticle.cpp @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index 7f5610f03..b0648a94f 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/input.h" #include "platform/profile/profile.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/common/App_structs.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Network/GameNetworkManager.h" @@ -124,7 +124,7 @@ LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user, input = nullptr; m_iPad = -1; m_iScreenSection = - C4JRender::VIEWPORT_TYPE_FULLSCREEN; // assume singleplayer default + IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN; // assume singleplayer default m_bPlayerRespawned = false; ullButtonsPressed = 0LL; ullDpad_last = ullDpad_this = ullDpad_filtered = 0; diff --git a/targets/minecraft/client/renderer/Chunk.cpp b/targets/minecraft/client/renderer/Chunk.cpp index 989476468..5e9cfeec7 100644 --- a/targets/minecraft/client/renderer/Chunk.cpp +++ b/targets/minecraft/client/renderer/Chunk.cpp @@ -9,7 +9,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "LevelRenderer.h" #include "app/linux/Stubs/winapi_stubs.h" #include "util/FrameProfiler.h" @@ -412,7 +412,7 @@ void Chunk::rebuild() { levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY0, currentLayer); - RenderManager.CBuffClear(lists + currentLayer); + PlatformRenderer.CBuffClear(lists + currentLayer); } int globalIdx = levelRenderer->getGlobalIndexForChunk(this->x, this->y, @@ -523,12 +523,12 @@ void Chunk::rebuild() { levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY0, currentLayer); - RenderManager.CBuffClear(lists + currentLayer); + PlatformRenderer.CBuffClear(lists + currentLayer); } if ((currentLayer == 0) && (!renderNextLayer)) { levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY1); - RenderManager.CBuffClear(lists + 1); + PlatformRenderer.CBuffClear(lists + 1); break; } } @@ -744,7 +744,7 @@ void Chunk::reset() { for (int i = 0; i < 2; i++) { // 4J - added - clear any renderer data associated with // this unused list - RenderManager.CBuffClear(lists + i); + PlatformRenderer.CBuffClear(lists + i); } levelRenderer->setGlobalChunkFlags(x, y, z, level, 0); } diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index 461968499..b1ddd5f7d 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -10,7 +10,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/input.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "BossMobGuiInfo.h" #include "Chunk.h" #include "ItemInHandRenderer.h" @@ -610,16 +610,16 @@ void GameRenderer::getFovAndAspect(float& fov, float& aspect, float a, aspect = mc->width / (float)mc->height; fov = getFov(a, applyEffects); - if ((mc->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_TOP) || + if ((mc->player->m_iScreenSection == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP) || (mc->player->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM)) { + IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM)) { aspect *= 2.0f; fov *= 0.7f; // Reduce FOV to make things less fish-eye, at the expense // of reducing vertical FOV from single player mode } else if ((mc->player->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_SPLIT_LEFT) || + IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT) || (mc->player->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT)) { + IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT)) { // Ideally I'd like to make the fov bigger here, but if I do then you an // see that the arm isn't very long... aspect *= 0.5f; @@ -644,7 +644,7 @@ void GameRenderer::setupCamera(float a, int eye) { glTranslatef((float)zoom_x, (float)-zoom_y, 0); glScaled(zoom, zoom, 1); } - gluPerspective(fov, aspect, 0.05f, renderDistance * 2); + PlatformRenderer.MatrixPerspective(fov, aspect, 0.05f, renderDistance * 2); if (mc->gameMode->isCutScene()) { float s = 1 / 1.5f; @@ -740,7 +740,7 @@ void GameRenderer::renderItemInHand(float a, int eye) { glTranslatef((float)zoom_x, (float)-zoom_y, 0); glScaled(zoom, zoom, 1); } - gluPerspective(fov, aspect, 0.05f, renderDistance * 2); + PlatformRenderer.MatrixPerspective(fov, aspect, 0.05f, renderDistance * 2); if (mc->gameMode->isCutScene()) { float s = 1 / 1.5f; @@ -803,8 +803,7 @@ void GameRenderer::turnOffLightLayer(double alpha) { // 4J - TODO #if defined(__linux__) if (SharedConstants::TEXTURE_LIGHTING) { LinuxLogStubLightmapProbe(); - RenderManager.TextureBindVertex(-1); - LinuxGLLogLightmapState("turnOffLightLayer", -1, false); + PlatformRenderer.TextureBindVertex(-1); } #else // 4jcraft: manually handle this in order to ensure that the light layer is @@ -841,12 +840,12 @@ void GameRenderer::turnOnLightLayer( textureId, scaleLight ? 1 : 0); } - RenderManager.TextureBindVertex(textureId, scaleLight); + PlatformRenderer.TextureBindVertex(textureId, scaleLight); LinuxGLLogLightmapState("turnOnLightLayer", textureId, scaleLight); #else // 4jcraft: update light texture // todo: check implementation of getLightTexture. - RenderManager.TextureBindVertex( + PlatformRenderer.TextureBindVertex( getLightTexture(mc->player->GetXboxPad(), mc->level), scaleLight); #endif } @@ -1119,7 +1118,7 @@ int GameRenderer::runUpdate(void* lpParam) { Minecraft* minecraft = Minecraft::GetInstance(); Tesselator::CreateNewThreadStorage(1024 * 1024); Compression::UseDefaultThreadStorage(); - RenderManager.InitialiseContext(); + PlatformRenderer.InitialiseContext(); #if defined(_LARGE_WORLDS) Chunk::CreateNewThreadStorage(); #endif @@ -1159,7 +1158,7 @@ int GameRenderer::runUpdate(void* lpParam) { // while( minecraft->levelRenderer->updateDirtyChunks() ) // ; - RenderManager.CBuffDeferredModeEnd(); + PlatformRenderer.CBuffDeferredModeEnd(); // If any renderable tile entities were flagged in this last block of // chunk(s) that were udpated, then change their flags to say that this @@ -1265,9 +1264,9 @@ void GameRenderer::renderLevel(float a, int64_t until) { if (mc->options->anaglyph3d) { GameRenderer::anaglyphPass = i; if (GameRenderer::anaglyphPass == 0) - RenderManager.StateSetWriteEnable(false, true, true, false); + PlatformRenderer.StateSetWriteEnable(false, true, true, false); else - RenderManager.StateSetWriteEnable(true, false, false, false); + PlatformRenderer.StateSetWriteEnable(true, false, false, false); } glViewport(0, 0, mc->width, mc->height); @@ -1297,7 +1296,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { setupFog(1, a); if (mc->options->ambientOcclusion) { - GL11::glShadeModel(GL11::GL_SMOOTH); + glShadeModel(GL_SMOOTH); } // Culler *frustum = new FrustumCuller(); @@ -1345,7 +1344,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { Lighting::turnOff(); levelRenderer->render(cameraEntity, 0, a, updateChunks); - GL11::glShadeModel(GL11::GL_FLAT); + glShadeModel(GL_FLAT); if (cameraFlip == 0) { Lighting::turnOn(); @@ -1401,8 +1400,8 @@ void GameRenderer::renderLevel(float a, int64_t until) { glDisable(GL_BLEND); glEnable(GL_CULL_FACE); - RenderManager.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - RenderManager.StateSetDepthMask(true); + PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + PlatformRenderer.StateSetDepthMask(true); setupFog(0, a); glEnable(GL_BLEND); glDisable(GL_CULL_FACE); @@ -1416,14 +1415,14 @@ void GameRenderer::renderLevel(float a, int64_t until) { if (true) // (mc->options->fancyGraphics) { if (mc->options->ambientOcclusion) { - GL11::glShadeModel(GL11::GL_SMOOTH); + glShadeModel(GL_SMOOTH); } - RenderManager.StateSetBlendFunc(GL_ZERO, GL_ONE); + PlatformRenderer.StateSetBlendFunc(GL_ZERO, GL_ONE); int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a, updateChunks); - RenderManager.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); if (visibleWaterChunks > 0) { levelRenderer->render( @@ -1433,7 +1432,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { // that anymore } - GL11::glShadeModel(GL11::GL_FLAT); + glShadeModel(GL_FLAT); } else { levelRenderer->render(cameraEntity, 1, a, updateChunks); } @@ -1458,7 +1457,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { turnOffLightLayer(a); // 4J - brought forward from 1.8.2 ////////////////////////// End of 4J added section - RenderManager.StateSetDepthMask(true); + PlatformRenderer.StateSetDepthMask(true); glEnable(GL_CULL_FACE); glDisable(GL_BLEND); @@ -1482,7 +1481,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { */ glEnable(GL_BLEND); - RenderManager.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE); + PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE); { FRAME_PROFILE_SCOPE(WeatherSky); levelRenderer->renderDestroyAnimation( @@ -1516,7 +1515,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { return; } } - RenderManager.StateSetWriteEnable(true, true, true, false); + PlatformRenderer.StateSetWriteEnable(true, true, true, false); } void GameRenderer::prepareAndRenderClouds(LevelRenderer* levelRenderer, @@ -1615,7 +1614,7 @@ void GameRenderer::renderSnowAndRain(float a) { if (rainLevel <= 0) return; // 4J - rain is relatively low poly, but high fill-rate - better to clip it - RenderManager.StateSetEnableViewportClipPlanes(true); + PlatformRenderer.StateSetEnableViewportClipPlanes(true); turnOnLightLayer(a); @@ -1645,7 +1644,7 @@ void GameRenderer::renderSnowAndRain(float a) { glDisable(GL_CULL_FACE); glNormal3f(0, 1, 0); glEnable(GL_BLEND); - RenderManager.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glAlphaFunc(GL_GREATER, 0.01f); mc->textures->bindTexture( @@ -1815,13 +1814,13 @@ void GameRenderer::renderSnowAndRain(float a) { glAlphaFunc(GL_GREATER, 0.1f); turnOffLightLayer(a); - RenderManager.StateSetEnableViewportClipPlanes(false); + PlatformRenderer.StateSetEnableViewportClipPlanes(false); } // 4J - added forceScale parameter void GameRenderer::setupGuiScreen(int forceScale /*=-1*/) { int fbw, fbh; - RenderManager.GetFramebufferSize(fbw, fbh); + PlatformRenderer.GetFramebufferSize(fbw, fbh); // 4jcraft: use actual framebuffer dimensions instead of mc->width/height // to ensure GUI scales correctly after a window resize. @@ -1829,17 +1828,17 @@ void GameRenderer::setupGuiScreen(int forceScale /*=-1*/) { // 4jcraft: Java GUI screens still assume a clean 2D fixed-function style // state. - RenderManager.StateSetFaceCull(false); + PlatformRenderer.StateSetFaceCull(false); glDisable(GL_LIGHTING); glDisable(GL_FOG); glColor4f(1, 1, 1, 1); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.1f); glEnable(GL_DEPTH_TEST); - RenderManager.StateSetDepthFunc(GL_LEQUAL); - RenderManager.StateSetDepthMask(true); + PlatformRenderer.StateSetDepthFunc(GL_LEQUAL); + PlatformRenderer.StateSetDepthMask(true); - RenderManager.TextureBindVertex(-1); + PlatformRenderer.TextureBindVertex(-1); glClientActiveTexture(GL_TEXTURE1); glActiveTexture(GL_TEXTURE1); diff --git a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp index b16b03ed5..7a4446891 100644 --- a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -8,7 +8,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "app/linux/LinuxGame.h" @@ -302,7 +302,7 @@ void ItemInHandRenderer::renderItem(std::shared_ptr mob, LOD = 2; // Force LOD level 2 to achieve texture reads from 256x256 // map } - RenderManager.StateSetForceLOD(LOD); + PlatformRenderer.StateSetForceLOD(LOD); // 4J Original comment // Yes, these are backwards. @@ -364,7 +364,7 @@ void ItemInHandRenderer::renderItem(std::shared_ptr mob, glDepthFunc(GL_LEQUAL); } - RenderManager.StateSetForceLOD(-1); + PlatformRenderer.StateSetForceLOD(-1); glDisable(GL_RESCALE_NORMAL); } @@ -417,15 +417,15 @@ void ItemInHandRenderer::render(float a) { std::dynamic_pointer_cast(player); if (localPlayer) { if (localPlayer->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM || + IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM || localPlayer->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_SPLIT_TOP) { + IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP) { fudgeY = 0.08f; splitHoriz = true; } else if (localPlayer->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_SPLIT_LEFT || + IPlatformRenderer::VIEWPORT_TYPE_SPLIT_LEFT || localPlayer->m_iScreenSection == - C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT) { + IPlatformRenderer::VIEWPORT_TYPE_SPLIT_RIGHT) { fudgeX = -0.18f; } } diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index 20adb191f..abad124c7 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -17,7 +17,7 @@ #include "platform/PlatformTypes.h" #include "platform/input/input.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "Chunk.h" #include "GameRenderer.h" #include "minecraft/GameEnums.h" @@ -27,7 +27,6 @@ #include "app/linux/LinuxGame.h" #include "util/FrameProfiler.h" #include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" -#include "platform/stubs.h" #include "Tesselator.h" #include "util/StringHelpers.h" #include "java/Class.h" @@ -299,7 +298,7 @@ LevelRenderer::LevelRenderer(Minecraft* mc, Textures* textures) { t->color(0xffffff); for (unsigned int i = 0; i <= ARC_SEGMENTS; ++i) { - float DIFF = abs(i - HALF_ARC_SEG); + float DIFF = std::abs(i - HALF_ARC_SEG); if (DIFF < (HALF_ARC_SEG - WIDE_ARC_SEGS)) DIFF = 0; else @@ -436,7 +435,7 @@ void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel* level) { // actually exiting the game, so only when the primary player sets there // level to nullptr if (playerIndex == PlatformInput.GetPrimaryPad()) { - RenderManager.CBuffDeleteAll(); + PlatformRenderer.CBuffDeleteAll(); { std::lock_guard lock(m_csRenderableTileEntities); renderableTileEntities.clear(); @@ -858,16 +857,16 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) { // 4jcraft: replaced glPushMatrix/glTranslatef/glPopMatrix per chunk // no more full MVP upload per chunk, can also be bkwards compat - RenderManager.SetChunkOffset((float)chunk->chunk->x, + PlatformRenderer.SetChunkOffset((float)chunk->chunk->x, (float)chunk->chunk->y, (float)chunk->chunk->z); - if (RenderManager.CBuffCall(list, first)) { + if (PlatformRenderer.CBuffCall(list, first)) { first = false; } count++; } - RenderManager.SetChunkOffset(0.f, 0.f, 0.f); + PlatformRenderer.SetChunkOffset(0.f, 0.f, 0.f); } glPopMatrix(); @@ -1431,7 +1430,7 @@ void LevelRenderer::renderAdvancedClouds(float alpha) { // stencilling to limit the area drawn to. Clouds have a relatively large // fill area compared to the number of vertices that they have, and so // enabling clipping here to try and reduce fill rate cost. - RenderManager.StateSetEnableViewportClipPlanes(true); + PlatformRenderer.StateSetEnableViewportClipPlanes(true); float yOffs = (float)(mc->cameraTargetPlayer->yOld + (mc->cameraTargetPlayer->y - mc->cameraTargetPlayer->yOld) * @@ -1694,7 +1693,7 @@ void LevelRenderer::renderAdvancedClouds(float alpha) { m_freezeticks = iTicks; } } - RenderManager.StateSetEnableViewportClipPlanes(false); + PlatformRenderer.StateSetEnableViewportClipPlanes(false); } bool LevelRenderer::updateDirtyChunks() { @@ -1745,7 +1744,7 @@ bool LevelRenderer::updateDirtyChunks() { { FRAME_PROFILE_SCOPE(ChunkDirtyScan); - unsigned int memAlloc = RenderManager.CBuffSize(-1); + unsigned int memAlloc = PlatformRenderer.CBuffSize(-1); /* static int throttle = 0; if( ( throttle % 100 ) == 0 ) @@ -1960,7 +1959,7 @@ bool LevelRenderer::updateDirtyChunks() { // exactly the same thing would happen further away, but we just // don't care about it so much from terms of visual impact. if (veryNearCount > 0) { - RenderManager.CBuffDeferredModeStart(); + PlatformRenderer.CBuffDeferredModeStart(); } // Build this chunk & return false to continue processing chunk->clearDirty(); @@ -2052,7 +2051,7 @@ bool LevelRenderer::updateDirtyChunks() { // happen further away, but we just don't care about it so much from // terms of visual impact. if (veryNearCount > 0) { - RenderManager.CBuffDeferredModeStart(); + PlatformRenderer.CBuffDeferredModeStart(); } // Build this chunk & return false to continue processing chunk->clearDirty(); @@ -2221,12 +2220,12 @@ void LevelRenderer::renderHitOutline(std::shared_ptr player, // 4J-PB - If Display HUD is false, don't render the hit outline if (gameServices().getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) return; - RenderManager.StateSetLightingEnable(false); + PlatformRenderer.StateSetLightingEnable(false); glDisable(GL_TEXTURE_2D); // draw hit outline - RenderManager.StateSetColour(0.0f, 0.0f, 0.0f, 0.4f); - RenderManager.StateSetLineWidth(1.0f); + PlatformRenderer.StateSetColour(0.0f, 0.0f, 0.0f, 0.4f); + PlatformRenderer.StateSetLineWidth(1.0f); // hack glDepthFunc(GL_LEQUAL); @@ -2251,17 +2250,17 @@ void LevelRenderer::renderHitOutline(std::shared_ptr player, // restore glDisable(GL_POLYGON_OFFSET_LINE); - RenderManager.StateSetColour(1.0f, 1.0f, 1.0f, 1.0f); + PlatformRenderer.StateSetColour(1.0f, 1.0f, 1.0f, 1.0f); glEnable(GL_TEXTURE_2D); - RenderManager.StateSetLightingEnable(true); + PlatformRenderer.StateSetLightingEnable(true); } } void LevelRenderer::render(AABB* b) { Tesselator* t = Tesselator::getInstance(); - RenderManager.StateSetLightingEnable(false); + PlatformRenderer.StateSetLightingEnable(false); glDisable(GL_TEXTURE_2D); - RenderManager.StateSetColour(0.0f, 0.0f, 0.0f, 0.4f); + PlatformRenderer.StateSetColour(0.0f, 0.0f, 0.0f, 0.4f); // prevent zfight glEnable(GL_POLYGON_OFFSET_LINE); @@ -2302,9 +2301,9 @@ void LevelRenderer::render(AABB* b) { t->end(); glDisable(GL_POLYGON_OFFSET_LINE); - RenderManager.StateSetLightingEnable(true); + PlatformRenderer.StateSetLightingEnable(true); glEnable(GL_TEXTURE_2D); - RenderManager.StateSetColour(1.0f, 1.0f, 1.0f, 1.0f); + PlatformRenderer.StateSetColour(1.0f, 1.0f, 1.0f, 1.0f); } void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, @@ -4040,7 +4039,7 @@ void LevelRenderer::staticCtor() { int LevelRenderer::rebuildChunkThreadProc(void* lpParam) { Tesselator::CreateNewThreadStorage(1024 * 1024); - RenderManager.InitialiseContext(); + PlatformRenderer.InitialiseContext(); Chunk::CreateNewThreadStorage(); Tile::CreateNewThreadStorage(); diff --git a/targets/minecraft/client/renderer/MobSkinTextureProcessor.cpp b/targets/minecraft/client/renderer/MobSkinTextureProcessor.cpp index 3c48ed8c8..335256b11 100644 --- a/targets/minecraft/client/renderer/MobSkinTextureProcessor.cpp +++ b/targets/minecraft/client/renderer/MobSkinTextureProcessor.cpp @@ -1,7 +1,6 @@ #include "MobSkinTextureProcessor.h" #include "minecraft/client/BufferedImage.h" -#include "platform/stubs.h" BufferedImage* MobSkinTextureProcessor::process(BufferedImage* in) { if (in == nullptr) return nullptr; diff --git a/targets/minecraft/client/renderer/OffsettedRenderList.cpp b/targets/minecraft/client/renderer/OffsettedRenderList.cpp index ddc0d1eb4..58e57e81f 100644 --- a/targets/minecraft/client/renderer/OffsettedRenderList.cpp +++ b/targets/minecraft/client/renderer/OffsettedRenderList.cpp @@ -1,6 +1,6 @@ #include "OffsettedRenderList.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "java/IntBuffer.h" #include "minecraft/client/MemoryTracker.h" diff --git a/targets/minecraft/client/renderer/Tesselator.cpp b/targets/minecraft/client/renderer/Tesselator.cpp index c243c9499..3fa3fcfe8 100644 --- a/targets/minecraft/client/renderer/Tesselator.cpp +++ b/targets/minecraft/client/renderer/Tesselator.cpp @@ -5,7 +5,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/linux/LinuxGame.h" #include "platform/stubs.h" #include "minecraft/client/MemoryTracker.h" @@ -106,15 +106,15 @@ void Tesselator::end() { } if (mode == GL_QUADS && TRIANGLE_MODE) { // glDrawArrays(GL_TRIANGLES, 0, vertices); // 4J - changed for xbox - RenderManager.DrawVertices( - C4JRender::PRIMITIVE_TYPE_TRIANGLE_LIST, vertices, + PlatformRenderer.DrawVertices( + IPlatformRenderer::PRIMITIVE_TYPE_TRIANGLE_LIST, vertices, _array->data(), useCompactFormat360 - ? C4JRender::VERTEX_TYPE_COMPRESSED - : C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1, + ? IPlatformRenderer::VERTEX_TYPE_COMPRESSED + : IPlatformRenderer::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1, useProjectedTexturePixelShader - ? C4JRender::PIXEL_SHADER_TYPE_PROJECTION - : C4JRender::PIXEL_SHADER_TYPE_STANDARD); + ? IPlatformRenderer::PIXEL_SHADER_TYPE_PROJECTION + : IPlatformRenderer::PIXEL_SHADER_TYPE_STANDARD); } else { // glDrawArrays(mode, 0, vertices); // 4J - changed // for xbox @@ -124,23 +124,23 @@ void Tesselator::end() { // axis aligned UVs (eg flowing lava/water) int vertexCount = vertices; if (useCompactFormat360) { - RenderManager.DrawVertices( - (C4JRender::ePrimitiveType)mode, vertexCount, - _array->data(), C4JRender::VERTEX_TYPE_COMPRESSED, - C4JRender::PIXEL_SHADER_TYPE_STANDARD); + PlatformRenderer.DrawVertices( + (IPlatformRenderer::ePrimitiveType)mode, vertexCount, + _array->data(), IPlatformRenderer::VERTEX_TYPE_COMPRESSED, + IPlatformRenderer::PIXEL_SHADER_TYPE_STANDARD); } else { if (useProjectedTexturePixelShader) { - RenderManager.DrawVertices( - (C4JRender::ePrimitiveType)mode, vertexCount, + PlatformRenderer.DrawVertices( + (IPlatformRenderer::ePrimitiveType)mode, vertexCount, _array->data(), - C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, - C4JRender::PIXEL_SHADER_TYPE_PROJECTION); + IPlatformRenderer::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, + IPlatformRenderer::PIXEL_SHADER_TYPE_PROJECTION); } else { - RenderManager.DrawVertices( - (C4JRender::ePrimitiveType)mode, vertexCount, + PlatformRenderer.DrawVertices( + (IPlatformRenderer::ePrimitiveType)mode, vertexCount, _array->data(), - C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1, - C4JRender::PIXEL_SHADER_TYPE_STANDARD); + IPlatformRenderer::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1, + IPlatformRenderer::PIXEL_SHADER_TYPE_STANDARD); } } } @@ -539,7 +539,7 @@ void Tesselator::vertex(float x, float y, float z) { #endif } else { // -512 each for u/v will mean that the renderer will use global - // settings (set via RenderManager.StateSetVertexTextureUV) rather + // settings (set via PlatformRenderer.StateSetVertexTextureUV) rather // than these local ones *(unsigned int*)(&_array->data()[p + 7]) = 0xfe00fe00; } diff --git a/targets/minecraft/client/renderer/Textures.cpp b/targets/minecraft/client/renderer/Textures.cpp index 29b66723a..939117d92 100644 --- a/targets/minecraft/client/renderer/Textures.cpp +++ b/targets/minecraft/client/renderer/Textures.cpp @@ -7,8 +7,9 @@ #include #include #include +#include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "HttpTexture.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/BufferedImage.h" @@ -39,8 +40,8 @@ // Mesa/Nvidia drivers) and the per-level crispBlend loop is both wasteful and // still causes visible blurring. bool Textures::MIPMAP = false; -C4JRender::eTextureFormat Textures::TEXTURE_FORMAT = - C4JRender::TEXTURE_FORMAT_RxGyBzAw; +IPlatformRenderer::eTextureFormat Textures::TEXTURE_FORMAT = + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw; int Textures::preLoadedIdx[TN_COUNT]; const wchar_t* Textures::preLoaded[TN_COUNT] = { @@ -416,7 +417,7 @@ int Textures::loadTexture(int idx) { void Textures::setTextureFormat(const std::wstring& resourceName) { // 4J Stu - These texture formats are not currently in the render header { - TEXTURE_FORMAT = C4JRender::TEXTURE_FORMAT_RxGyBzAw; + TEXTURE_FORMAT = IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw; } } @@ -525,7 +526,7 @@ void Textures::bindTextureLayers(ResourceLocation* resource) { mergedWidth, mergedHeight, BufferedImage::TYPE_INT_ARGB); memcpy(mergedImage->getData(), mergedPixels.data(), mergedWidth * mergedHeight * sizeof(int)); - id = getTexture(mergedImage, C4JRender::TEXTURE_FORMAT_RxGyBzAw, + id = getTexture(mergedImage, IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, false); } else { id = 0; @@ -534,7 +535,7 @@ void Textures::bindTextureLayers(ResourceLocation* resource) { idMap[cacheKey] = id; } - RenderManager.TextureBind(id); + PlatformRenderer.TextureBind(id); } void Textures::bind(int id) { @@ -639,7 +640,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, idMap[resourceName] = id; MIPMAP = true; // 4J added - TEXTURE_FORMAT = C4JRender::TEXTURE_FORMAT_RxGyBzAw; + TEXTURE_FORMAT = IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw; return id; /* } catch (IOException e) { @@ -653,13 +654,13 @@ return id; */ } -int Textures::getTexture(BufferedImage* img, C4JRender::eTextureFormat format, +int Textures::getTexture(BufferedImage* img, IPlatformRenderer::eTextureFormat format, bool mipmap) { int id = MemoryTracker::genTextures(); TEXTURE_FORMAT = format; MIPMAP = mipmap; loadTexture(img, id); - TEXTURE_FORMAT = C4JRender::TEXTURE_FORMAT_RxGyBzAw; + TEXTURE_FORMAT = IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw; MIPMAP = true; loadedImages[id] = img; return id; @@ -742,11 +743,11 @@ void Textures::loadTexture(BufferedImage* img, int id, bool blur, bool clamp) { while ((8 << iHeightMips) < h) iHeightMips++; iMipLevels = (iWidthMips < iHeightMips) ? iWidthMips : iHeightMips; - // RenderManager.TextureSetTextureLevels(5); // 4J added + // PlatformRenderer.TextureSetTextureLevels(5); // 4J added if (iMipLevels > 5) iMipLevels = 5; - RenderManager.TextureSetTextureLevels(iMipLevels); // 4J added + PlatformRenderer.TextureSetTextureLevels(iMipLevels); // 4J added } - RenderManager.TextureData(w, h, pixels->getBuffer(), 0, TEXTURE_FORMAT); + PlatformRenderer.TextureData(w, h, pixels->getBuffer(), 0, TEXTURE_FORMAT); // glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL12.GL_BGRA, // GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixels); @@ -803,7 +804,7 @@ void Textures::loadTexture(BufferedImage* img, int id, bool blur, bool clamp) { pixels->putInt((x + y * ww) * 4, tempData[x + y * ww]); } delete[] tempData; - RenderManager.TextureData(ww, hh, pixels->getBuffer(), level, + PlatformRenderer.TextureData(ww, hh, pixels->getBuffer(), level, TEXTURE_FORMAT); } } @@ -880,7 +881,7 @@ void Textures::replaceTexture(std::vector& rawPixels, int w, int h, // New // glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL12.GL_BGRA, // GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixels); - RenderManager.TextureDataUpdate(0, 0, w, h, pixels->getBuffer(), 0); + PlatformRenderer.TextureDataUpdate(0, 0, w, h, pixels->getBuffer(), 0); // Old // glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, // pixels); @@ -903,7 +904,7 @@ void Textures::replaceTextureDirect(const std::vector& rawPixels, int w, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - RenderManager.TextureDataUpdate(0, 0, w, h, + PlatformRenderer.TextureDataUpdate(0, 0, w, h, const_cast(rawPixels.data()), 0); } @@ -923,7 +924,7 @@ void Textures::replaceTextureDirect(const std::vector& rawPixels, int w, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - RenderManager.TextureDataUpdate(0, 0, w, h, + PlatformRenderer.TextureDataUpdate(0, 0, w, h, const_cast(rawPixels.data()), 0); } @@ -1020,7 +1021,7 @@ int Textures::loadMemTexture(const std::wstring& url, if (texture->id < 0) { texture->id = getTexture(texture->loadedImage, - C4JRender::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); } else { loadTexture(texture->loadedImage, texture->id); } @@ -1057,7 +1058,7 @@ int Textures::loadMemTexture(const std::wstring& url, int backup) { if (texture->id < 0) { texture->id = getTexture(texture->loadedImage, - C4JRender::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); } else { loadTexture(texture->loadedImage, texture->id); } @@ -1148,10 +1149,10 @@ void Textures::tick( // 4J - added - tell renderer that we're about to do a block of dynamic // texture updates, so we can unlock the resources after they are done // rather than a series of locks/unlocks - // RenderManager.TextureDynamicUpdateStart(); + // PlatformRenderer.TextureDynamicUpdateStart(); terrain->cycleAnimationFrames(); items->cycleAnimationFrames(); - // RenderManager.TextureDynamicUpdateEnd(); // 4J added - see + // PlatformRenderer.TextureDynamicUpdateEnd(); // 4J added - see // comment above } diff --git a/targets/minecraft/client/renderer/Textures.h b/targets/minecraft/client/renderer/Textures.h index e69783834..c026f36bb 100644 --- a/targets/minecraft/client/renderer/Textures.h +++ b/targets/minecraft/client/renderer/Textures.h @@ -5,8 +5,8 @@ #include #include -#include "platform/sdl2/Render.h" -#include "IPlatformRenderer.h" +#include "platform/renderer/renderer.h" +#include "platform/renderer/renderer.h" class Icon; class Entity; diff --git a/targets/minecraft/client/renderer/TileRenderer.cpp b/targets/minecraft/client/renderer/TileRenderer.cpp index 86a878035..6f6634dd8 100644 --- a/targets/minecraft/client/renderer/TileRenderer.cpp +++ b/targets/minecraft/client/renderer/TileRenderer.cpp @@ -9,7 +9,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityTileRenderer.h" #include "GameRenderer.h" #include "minecraft/GameEnums.h" diff --git a/targets/minecraft/client/renderer/culling/Frustum.cpp b/targets/minecraft/client/renderer/culling/Frustum.cpp index e39c9cf6d..0a633fdd0 100644 --- a/targets/minecraft/client/renderer/culling/Frustum.cpp +++ b/targets/minecraft/client/renderer/culling/Frustum.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "java/FloatBuffer.h" #include "minecraft/client/MemoryTracker.h" @@ -58,9 +58,9 @@ void Frustum::calculateFrustum() { // queries. // Camera::prepare() already captures both matrices every frame :) // i spent an ungodly amount of time on this simple fix. - memcpy(proj.data(), RenderManager.MatrixGet(GL_PROJECTION_MATRIX), + memcpy(proj.data(), PlatformRenderer.MatrixGet(GL_PROJECTION_MATRIX), 16 * sizeof(float)); - memcpy(modl.data(), RenderManager.MatrixGet(GL_MODELVIEW_MATRIX), + memcpy(modl.data(), PlatformRenderer.MatrixGet(GL_MODELVIEW_MATRIX), 16 * sizeof(float)); float* p = proj.data(); diff --git a/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp b/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp index 9fab5bf3f..ab6c51937 100644 --- a/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp @@ -4,13 +4,14 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/projectile/Arrow.h" +#include ResourceLocation ArrowRenderer::ARROW_LOCATION = ResourceLocation(TN_ITEM_ARROWS); diff --git a/targets/minecraft/client/renderer/entity/BatRenderer.cpp b/targets/minecraft/client/renderer/entity/BatRenderer.cpp index 72bb017fc..8db0deb42 100644 --- a/targets/minecraft/client/renderer/entity/BatRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/BatRenderer.cpp @@ -2,8 +2,9 @@ #include #include +#include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/BatModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/minecraft/client/renderer/entity/BoatRenderer.cpp b/targets/minecraft/client/renderer/entity/BoatRenderer.cpp index 35cf2b62e..a49cfdc8f 100644 --- a/targets/minecraft/client/renderer/entity/BoatRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/BoatRenderer.cpp @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/BoatModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp b/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp index a85836653..7f1849475 100644 --- a/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/SpiderRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" diff --git a/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp b/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp index 88807dfb9..bc98542cc 100644 --- a/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/CreeperModel.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp b/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp index 7807198ea..2c7555fa1 100644 --- a/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp @@ -1,6 +1,6 @@ #include "DefaultRenderer.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" void DefaultRenderer::render(std::shared_ptr entity, double x, double y, double z, float rot, float a) { diff --git a/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp b/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp index b3e793099..9cf89cbdc 100644 --- a/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/dragon/EnderCrystalModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp b/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp index 775409b6f..24a68f593 100644 --- a/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "SharedConstants.h" #include "java/Random.h" diff --git a/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp b/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp index 84902f09d..7c787d032 100644 --- a/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp @@ -1,8 +1,9 @@ #include "EndermanRenderer.h" #include +#include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/EndermanModel.h" diff --git a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp index 33794e6d8..6f9e4d4bd 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "ArrowRenderer.h" #include "BatRenderer.h" #include "BlazeRenderer.h" diff --git a/targets/minecraft/client/renderer/entity/EntityRenderer.cpp b/targets/minecraft/client/renderer/entity/EntityRenderer.cpp index e23fa047f..e972fc713 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "java/Class.h" diff --git a/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp b/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp index a99c8f097..2f2ce92bb 100644 --- a/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/SharedConstants.h" diff --git a/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp b/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp index 24c6bc8e6..cbe55dd55 100644 --- a/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/TileRenderer.h" diff --git a/targets/minecraft/client/renderer/entity/FireballRenderer.cpp b/targets/minecraft/client/renderer/entity/FireballRenderer.cpp index 8bdbd0d45..dba049c9d 100644 --- a/targets/minecraft/client/renderer/entity/FireballRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FireballRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "java/Class.h" diff --git a/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp b/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp index f2449308b..70513d796 100644 --- a/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp @@ -4,7 +4,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/renderer/entity/GhastRenderer.cpp b/targets/minecraft/client/renderer/entity/GhastRenderer.cpp index b0fa23786..019d904b3 100644 --- a/targets/minecraft/client/renderer/entity/GhastRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/GhastRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/GhastModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" diff --git a/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp b/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp index 6f290e262..b92d2079d 100644 --- a/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" diff --git a/targets/minecraft/client/renderer/entity/HorseRenderer.cpp b/targets/minecraft/client/renderer/entity/HorseRenderer.cpp index 31d225da5..db7ac150f 100644 --- a/targets/minecraft/client/renderer/entity/HorseRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HorseRenderer.cpp @@ -1,8 +1,9 @@ #include "HorseRenderer.h" #include +#include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "MobRenderer.h" #include "minecraft/client/model/geom/Model.h" @@ -58,7 +59,7 @@ void HorseRenderer::renderModel(std::shared_ptr mob, float wp, true); // Ensure that any extra layers of texturing are disabled after // rendering this horse - RenderManager.TextureBind(-1); + PlatformRenderer.TextureBind(-1); } } diff --git a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp index bc89e5ac8..725b5dccf 100644 --- a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp @@ -2,8 +2,9 @@ #include #include +#include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "util/StringHelpers.h" #include "minecraft/Facing.h" diff --git a/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp index fd162027d..a2bde451a 100644 --- a/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp @@ -5,7 +5,7 @@ #include "EntityRenderDispatcher.h" #include "minecraft/client/renderer/TileRenderer.h" // #include "ItemFrame" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "ItemFrameRenderer.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" diff --git a/targets/minecraft/client/renderer/entity/ItemRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemRenderer.cpp index 2375f82eb..a0601a3c9 100644 --- a/targets/minecraft/client/renderer/entity/ItemRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemRenderer.cpp @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "util/StringHelpers.h" @@ -222,7 +222,7 @@ void ItemRenderer::renderItemBillboard(std::shared_ptr entity, LOD = 2; // Force LOD level 2 to achieve texture reads from 256x256 // map } - RenderManager.StateSetForceLOD(LOD); + PlatformRenderer.StateSetForceLOD(LOD); glPushMatrix(); if (m_bItemFrame) { @@ -311,7 +311,7 @@ void ItemRenderer::renderItemBillboard(std::shared_ptr entity, glPopMatrix(); - RenderManager.StateSetForceLOD(-1); + PlatformRenderer.StateSetForceLOD(-1); } else { for (int i = 0; i < count; i++) { glPushMatrix(); diff --git a/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp index 9776e0b3c..aac8da2b3 100644 --- a/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/client/renderer/Tesselator.h" diff --git a/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp b/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp index 7048aa84e..5ddfd6a5e 100644 --- a/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/LavaSlimeModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" diff --git a/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp b/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp index ade46a95a..9f0c38482 100644 --- a/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/LeashKnotModel.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp b/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp index 912b660f1..24c801a08 100644 --- a/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "java/Random.h" #include "minecraft/client/renderer/Tesselator.h" diff --git a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp index 36a56b8f1..cdde47435 100644 --- a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/GameEnums.h" #include "app/linux/LinuxGame.h" @@ -498,7 +498,7 @@ void LivingEntityRenderer::renderNameTag(std::shared_ptr mob, // 4J Stu - If it's beyond readable distance, then just render a coloured // box int readableDist = PLAYER_NAME_READABLE_FULLSCREEN; - if (!RenderManager.IsHiDef()) { + if (!PlatformRenderer.IsHiDef()) { readableDist = PLAYER_NAME_READABLE_DISTANCE_SD; } else if (gameServices().getLocalPlayerCount() > 2) { readableDist = PLAYER_NAME_READABLE_DISTANCE_SPLITSCREEN; diff --git a/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp b/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp index 41f3aa01b..ce0c7a068 100644 --- a/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/MinecartModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/minecraft/client/renderer/entity/MobRenderer.cpp b/targets/minecraft/client/renderer/entity/MobRenderer.cpp index 190bb5373..48fc3df65 100644 --- a/targets/minecraft/client/renderer/entity/MobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MobRenderer.cpp @@ -4,7 +4,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "LivingEntityRenderer.h" #include "minecraft/GameEnums.h" diff --git a/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp b/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp index e1ecad57d..65289c1c9 100644 --- a/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp @@ -1,8 +1,9 @@ #include "MushroomCowRenderer.h" #include +#include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/QuadrupedModel.h" #include "minecraft/client/model/geom/ModelPart.h" diff --git a/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp b/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp index 00b5e7e2c..28787c7a1 100644 --- a/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" diff --git a/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp b/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp index db12d33f1..48485fcaa 100644 --- a/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp @@ -1,8 +1,9 @@ #include "PaintingRenderer.h" #include +#include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "java/Random.h" diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp index f4c1acd51..2e70c72f4 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp @@ -4,8 +4,9 @@ #include #include #include +#include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "HumanoidMobRenderer.h" #include "minecraft/GameEnums.h" diff --git a/targets/minecraft/client/renderer/entity/SheepRenderer.cpp b/targets/minecraft/client/renderer/entity/SheepRenderer.cpp index c939a31e3..a2391e853 100644 --- a/targets/minecraft/client/renderer/entity/SheepRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SheepRenderer.cpp @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp b/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp index b08df7223..1553b9ea1 100644 --- a/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/SkeletonModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/HumanoidMobRenderer.h" diff --git a/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp b/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp index d02b18e86..84a0a7fda 100644 --- a/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" diff --git a/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp b/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp index bd8501956..b5b1dbbc3 100644 --- a/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/client/model/SnowManModel.h" #include "minecraft/client/model/geom/ModelPart.h" diff --git a/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp b/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp index ca7f309bb..9e4c57b12 100644 --- a/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/SpiderModel.h" diff --git a/targets/minecraft/client/renderer/entity/SquidRenderer.cpp b/targets/minecraft/client/renderer/entity/SquidRenderer.cpp index 0c024b328..6a53e1937 100644 --- a/targets/minecraft/client/renderer/entity/SquidRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SquidRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" diff --git a/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp b/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp index 96c26708d..50d4613e0 100644 --- a/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/TileRenderer.h" #include "minecraft/client/renderer/entity/MinecartRenderer.h" diff --git a/targets/minecraft/client/renderer/entity/TntRenderer.cpp b/targets/minecraft/client/renderer/entity/TntRenderer.cpp index eae22f2c0..472c079ed 100644 --- a/targets/minecraft/client/renderer/entity/TntRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/TntRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/renderer/TileRenderer.h" diff --git a/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp b/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp index 3cfd771cb..0accf95db 100644 --- a/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp @@ -4,7 +4,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/VillagerGolemModel.h" diff --git a/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp b/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp index 91af50aa6..816846356 100644 --- a/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/VillagerModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" diff --git a/targets/minecraft/client/renderer/entity/WitchRenderer.cpp b/targets/minecraft/client/renderer/entity/WitchRenderer.cpp index 4286b2b1c..207d129e2 100644 --- a/targets/minecraft/client/renderer/entity/WitchRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitchRenderer.cpp @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/WitchModel.h" diff --git a/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp b/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp index 73eb7617e..847441fe8 100644 --- a/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "MobRenderer.h" #include "SharedConstants.h" diff --git a/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp b/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp index 633cdb6f2..14fcce976 100644 --- a/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/SkeletonHeadModel.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/minecraft/client/renderer/entity/WolfRenderer.cpp b/targets/minecraft/client/renderer/entity/WolfRenderer.cpp index eab36adc9..5150f3449 100644 --- a/targets/minecraft/client/renderer/entity/WolfRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WolfRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/minecraft/client/renderer/texture/Texture.cpp b/targets/minecraft/client/renderer/texture/Texture.cpp index c16c818e1..65a0a757e 100644 --- a/targets/minecraft/client/renderer/texture/Texture.cpp +++ b/targets/minecraft/client/renderer/texture/Texture.cpp @@ -6,7 +6,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/BufferedImage.h" #include "TextureManager.h" @@ -570,37 +570,37 @@ void Texture::updateOnGPU() { //} // else if(height != 1) //{ - // 4J Added check so we can differentiate between which RenderManager + // 4J Added check so we can differentiate between which PlatformRenderer // function to call if (!m_bInitialised) { - RenderManager.TextureSetTextureLevels(m_iMipLevels); // 4J added + PlatformRenderer.TextureSetTextureLevels(m_iMipLevels); // 4J added - RenderManager.TextureData(width, height, data[0]->getBuffer(), 0, - C4JRender::TEXTURE_FORMAT_RxGyBzAw); + PlatformRenderer.TextureData(width, height, data[0]->getBuffer(), 0, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); if (mipmapped) { for (int level = 1; level < m_iMipLevels; level++) { int levelWidth = width >> level; int levelHeight = height >> level; - RenderManager.TextureData(levelWidth, levelHeight, + PlatformRenderer.TextureData(levelWidth, levelHeight, data[level]->getBuffer(), level, - C4JRender::TEXTURE_FORMAT_RxGyBzAw); + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); } } m_bInitialised = true; } else { - RenderManager.TextureDataUpdate(0, 0, width, height, + PlatformRenderer.TextureDataUpdate(0, 0, width, height, data[0]->getBuffer(), 0); if (mipmapped) { - if (RenderManager.TextureGetTextureLevels() > 1) { + if (PlatformRenderer.TextureGetTextureLevels() > 1) { for (int level = 1; level < m_iMipLevels; level++) { int levelWidth = width >> level; int levelHeight = height >> level; - RenderManager.TextureDataUpdate( + PlatformRenderer.TextureDataUpdate( 0, 0, levelWidth, levelHeight, data[level]->getBuffer(), level); } diff --git a/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp b/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp index 37ae02ed3..2ac5a27ba 100644 --- a/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp @@ -4,7 +4,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp b/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp index 603ae8902..7f4e18013 100644 --- a/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/ChestModel.h" #include "minecraft/client/model/LargeChestModel.h" diff --git a/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp b/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp index bcc00e45a..80777935b 100644 --- a/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp @@ -4,7 +4,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/BookModel.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp b/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp index a902fe534..6ecc05db4 100644 --- a/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp @@ -3,7 +3,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/model/ChestModel.h" #include "minecraft/client/model/geom/ModelPart.h" diff --git a/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp b/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp index 3fc8f0467..1c68944ea 100644 --- a/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp @@ -1,6 +1,6 @@ #include "MobSpawnerRenderer.h" -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/BaseMobSpawner.h" diff --git a/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp b/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp index 82f77a691..59bb167bb 100644 --- a/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/renderer/Tesselator.h" diff --git a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp index 239ce3f30..f590f0479 100644 --- a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp @@ -5,7 +5,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "app/linux/LinuxGame.h" diff --git a/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp index 2604cfb61..de773b5e6 100644 --- a/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "minecraft/Facing.h" #include "minecraft/client/model/SkeletonHeadModel.h" diff --git a/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp b/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp index 34432f1b5..3fc26a24d 100644 --- a/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "TileEntityRenderDispatcher.h" #include "java/FloatBuffer.h" diff --git a/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp index e52ec019b..bf8eda75b 100644 --- a/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp @@ -2,7 +2,7 @@ #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "BeaconRenderer.h" #include "ChestRenderer.h" #include "EnchantTableRenderer.h" diff --git a/targets/minecraft/client/title/TitleScreen.cpp b/targets/minecraft/client/title/TitleScreen.cpp index 6f39edeaf..f50ab5792 100644 --- a/targets/minecraft/client/title/TitleScreen.cpp +++ b/targets/minecraft/client/title/TitleScreen.cpp @@ -7,7 +7,7 @@ #include #include -#include "platform/sdl2/Render.h" +#include "platform/renderer/renderer.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" @@ -169,7 +169,7 @@ void TitleScreen::buttonClicked(Button* button) { if (button->id == 4) { Log::info( "TitleScreen::buttonClicked() Exit Game if (button->id == 4)\n"); - RenderManager.Close(); // minecraft->stop(); + PlatformRenderer.Close(); // minecraft->stop(); } } diff --git a/targets/platform/Platform.h b/targets/platform/Platform.h index 07daad766..e9b3d7765 100644 --- a/targets/platform/Platform.h +++ b/targets/platform/Platform.h @@ -5,7 +5,7 @@ #include "IPlatformLeaderboard.h" #include "IPlatformNetwork.h" #include "IPlatformProfile.h" -#include "IPlatformRenderer.h" +#include "platform/renderer/renderer.h" #include "IPlatformSound.h" #include "IPlatformStorage.h" #include "IPlatformUIController.h" diff --git a/targets/platform/PlatformServices.cpp b/targets/platform/PlatformServices.cpp index 0a1ccf85a..a5414736e 100644 --- a/targets/platform/PlatformServices.cpp +++ b/targets/platform/PlatformServices.cpp @@ -1,9 +1,6 @@ #include "PlatformServices.h" #include "StdFileIO.h" -#include "sdl2/Render.h" - static StdFileIO s_stdFileIO; -IPlatformFileIO& PlatformFileIO = s_stdFileIO; -IPlatformRenderer& PlatformRender = RenderManager; +IPlatformFileIO& PlatformFileIO = s_stdFileIO; \ No newline at end of file diff --git a/targets/platform/PlatformServices.h b/targets/platform/PlatformServices.h index 915771d3c..6d041f645 100644 --- a/targets/platform/PlatformServices.h +++ b/targets/platform/PlatformServices.h @@ -3,11 +3,9 @@ #include "IPlatformFileIO.h" #include "IPlatformLeaderboard.h" #include "IPlatformNetwork.h" -#include "IPlatformRenderer.h" // Interface references to platform services. Game code uses these // instead of concrete globals directly. Bindings are established // by the app layer at startup. extern IPlatformFileIO& PlatformFileIO; -extern IPlatformRenderer& PlatformRender; diff --git a/targets/platform/input/sdl2/SDL2Input.cpp b/targets/platform/input/sdl2/SDL2Input.cpp index 54d1b1ba4..58c44ed67 100644 --- a/targets/platform/input/sdl2/SDL2Input.cpp +++ b/targets/platform/input/sdl2/SDL2Input.cpp @@ -18,7 +18,7 @@ #include #include "../InputConstants.h" -#include "../PlatformTypes.h" +#include "../../PlatformTypes.h" SDL2Input sdl2_input_instance; IPlatformInput& PlatformInput = sdl2_input_instance; diff --git a/targets/platform/meson.build b/targets/platform/meson.build index b41600830..4fab96098 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -28,14 +28,14 @@ sdl2_sources = files( 'input/sdl2/SDL2Input.cpp', 'profile/stub/StubProfile.cpp', 'storage/stub/StubStorage.cpp', - 'sdl2/Render.cpp', - 'sdl2/render_stubs.cpp', + 'renderer/gl/GLRenderer.cpp', + 'renderer/gl/render_stubs.cpp', ) lib_platform_sdl2 = static_library('platform_sdl2', sdl2_sources, - include_directories: [platform_inc, include_directories('sdl2')], - dependencies: [_sdl2, _gl, _threads, glm_dep, stb_dep], + include_directories: [platform_inc], + dependencies: [_sdl2, _gl, _threads, glm_dep, stb_dep, java_dep], cpp_args: _defs + global_cpp_args + global_cpp_defs, ) @@ -43,7 +43,7 @@ lib_platform_sdl2 = static_library('platform_sdl2', # Replaces the old render_dep, input_dep, profile_dep, storage_dep render_dep = declare_dependency( link_with: lib_platform_sdl2, - include_directories: [platform_inc, include_directories('sdl2')], + include_directories: [platform_inc], dependencies: [_sdl2, _gl, _threads, glm_dep], ) input_dep = render_dep diff --git a/targets/platform/profile/stub/StubProfile.h b/targets/platform/profile/stub/StubProfile.h index 43601b0fb..5d7f65d68 100644 --- a/targets/platform/profile/stub/StubProfile.h +++ b/targets/platform/profile/stub/StubProfile.h @@ -4,9 +4,9 @@ #include #include -#include "../PlatformTypes.h" +#include "PlatformTypes.h" + #include "../IPlatformProfile.h" -#include "../PlatformTypes.h" class StubProfile : public IPlatformProfile { public: diff --git a/targets/platform/IPlatformRenderer.h b/targets/platform/renderer/IPlatformRenderer.h similarity index 99% rename from targets/platform/IPlatformRenderer.h rename to targets/platform/renderer/IPlatformRenderer.h index 5570e87a2..b613786f7 100644 --- a/targets/platform/IPlatformRenderer.h +++ b/targets/platform/renderer/IPlatformRenderer.h @@ -95,6 +95,7 @@ public: virtual void CBuffLockStaticCreations() = 0; [[nodiscard]] virtual int CBuffCreate(int count) = 0; virtual void CBuffDelete(int first, int count) = 0; + virtual void CBuffDeleteAll() = 0; virtual void CBuffStart(int index, bool full = false) = 0; virtual void CBuffClear(int index) = 0; [[nodiscard]] virtual int CBuffSize(int index) = 0; diff --git a/targets/platform/sdl2/Render.cpp b/targets/platform/renderer/gl/GLRenderer.cpp similarity index 79% rename from targets/platform/sdl2/Render.cpp rename to targets/platform/renderer/gl/GLRenderer.cpp index 0e570dc1d..6943130be 100644 --- a/targets/platform/sdl2/Render.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -1,12 +1,15 @@ -#include "Render.h" +#include "GLRenderer.h" -#include "../PlatformTypes.h" +#include "PlatformTypes.h" #include "SDL.h" #include "SDL_error.h" #include "SDL_events.h" #include "SDL_stdinc.h" #include "SDL_video.h" -#include "gl3_loader.h" + +#include "java/ByteBuffer.h" +#include "java/FloatBuffer.h" +#include "java/IntBuffer.h" // undefine macros from header to avoid argument mismatch #undef glGenTextures @@ -51,7 +54,8 @@ #include #include -C4JRender RenderManager; +GLRenderer gl_renderer_instance; +IPlatformRenderer& PlatformRenderer = gl_renderer_instance; // MARK: Shaders @@ -59,20 +63,20 @@ C4JRender RenderManager; #ifdef GLES static const char* VERT_SRC = -#include "sdl2/shaders/vertex_es.vert" +#include "./shaders/vertex_es.vert" ; static const char* FRAG_SRC = -#include "sdl2/shaders/fragment_es.frag" +#include "./shaders/fragment_es.frag" ; #else static const char* VERT_SRC = -#include "sdl2/shaders/vertex.vert" +#include "./shaders/vertex.vert" ; static const char* FRAG_SRC = -#include "sdl2/shaders/fragment.frag" +#include "./shaders/fragment.frag" ; #endif @@ -593,7 +597,7 @@ static thread_local std::vector s_recDraws; // Primitive helpers static bool isQuadPrim(int pt) { return (pt == 0x0007 /*GL_QUADS*/ || - pt == (int)C4JRender::PRIMITIVE_TYPE_QUAD_LIST); + pt == (int)GLRenderer::PRIMITIVE_TYPE_QUAD_LIST); } static GLenum mapPrim(int pt) { @@ -621,7 +625,7 @@ static GLenum mapPrim(int pt) { // MARK: Renderer impl // Initialises the renderer -void C4JRender::Initialise() { +void GLRenderer::Initialise() { if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "[4J_Render] SDL_Init: %s\n", SDL_GetError()); return; @@ -712,7 +716,7 @@ void C4JRender::Initialise() { #endif } -void C4JRender::InitialiseContext() { +void GLRenderer::InitialiseContext() { if (!s_window) return; pthread_once(&s_glCtxKeyOnce, makeGLCtxKey); if (s_mainThreadSet && pthread_equal(pthread_self(), s_mainThread)) { @@ -742,7 +746,7 @@ void C4JRender::InitialiseContext() { pthread_setspecific(s_glCtxKey, (void*)shared); } -void C4JRender::StartFrame() { +void GLRenderer::StartFrame() { Set_matrixDirty(); int w, h; SDL_GetWindowSize(s_window, &w, &h); @@ -751,7 +755,7 @@ void C4JRender::StartFrame() { glViewport(0, 0, s_windowWidth, s_windowHeight); } -void C4JRender::Present() { +void GLRenderer::Present() { if (!s_window) return; SDL_Event ev; while (SDL_PollEvent(&ev)) { @@ -768,23 +772,23 @@ void C4JRender::Present() { SDL_GL_SwapWindow(s_window); } -void C4JRender::SetWindowSize(int w, int h) { +void GLRenderer::SetWindowSize(int w, int h) { s_reqWidth = w; s_reqHeight = h; } -void C4JRender::SetFullscreen(bool fs) { s_fullscreen = fs; } +void GLRenderer::SetFullscreen(bool fs) { s_fullscreen = fs; } -bool C4JRender::ShouldClose() { return !s_window || s_shouldClose; } +bool GLRenderer::ShouldClose() { return !s_window || s_shouldClose; } -void C4JRender::GetFramebufferSize(int& w, int& h) { +void GLRenderer::GetFramebufferSize(int& w, int& h) { w = s_windowWidth; h = s_windowHeight; } -void C4JRender::Close() { s_window = nullptr; } +void GLRenderer::Close() { s_window = nullptr; } -void C4JRender::Shutdown() { +void GLRenderer::Shutdown() { pthread_mutex_lock(&s_glCallMtx); for (auto& kv : s_chunkPool) kv.second.destroy(); s_chunkPool.clear(); @@ -807,7 +811,7 @@ void C4JRender::Shutdown() { SDL_Quit(); } -void C4JRender::DrawVertices(ePrimitiveType ptype, int count, void* dataIn, +void GLRenderer::DrawVertices(ePrimitiveType ptype, int count, void* dataIn, eVertexType vType, ePixelShaderType) { if (count <= 0 || !dataIn) return; @@ -915,14 +919,14 @@ void C4JRender::DrawVertices(ePrimitiveType ptype, int count, void* dataIn, pthread_mutex_unlock(&s_glCallMtx); } -void C4JRender::ReadPixels(int x, int y, int w, int h, void* buf) { +void GLRenderer::ReadPixels(int x, int y, int w, int h, void* buf) { if (!buf) return; pthread_mutex_lock(&s_glCallMtx); glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buf); pthread_mutex_unlock(&s_glCallMtx); } -int C4JRender::CBuffCreate(int count) { +int GLRenderer::CBuffCreate(int count) { pthread_mutex_lock(&s_glCallMtx); int b = s_nextListBase; s_nextListBase += count; @@ -930,7 +934,7 @@ int C4JRender::CBuffCreate(int count) { return b; } -void C4JRender::CBuffDelete(int first, int count) { +void GLRenderer::CBuffDelete(int first, int count) { pthread_mutex_lock(&s_glCallMtx); for (int i = first; i < first + count; i++) { auto it = s_chunkPool.find(i); @@ -942,7 +946,7 @@ void C4JRender::CBuffDelete(int first, int count) { pthread_mutex_unlock(&s_glCallMtx); } -void C4JRender::CBuffDeleteAll() { +void GLRenderer::CBuffDeleteAll() { pthread_mutex_lock(&s_glCallMtx); for (auto& kv : s_chunkPool) { kv.second.destroy(); @@ -952,13 +956,13 @@ void C4JRender::CBuffDeleteAll() { pthread_mutex_unlock(&s_glCallMtx); } -void C4JRender::CBuffStart(int index, bool) { +void GLRenderer::CBuffStart(int index, bool) { s_recListId = index; s_recVerts.clear(); s_recDraws.clear(); } -void C4JRender::CBuffEnd() { +void GLRenderer::CBuffEnd() { if (s_recListId < 0) return; pthread_mutex_lock(&s_glCallMtx); ChunkBuffer& cb = s_chunkPool[s_recListId]; @@ -977,7 +981,7 @@ void C4JRender::CBuffEnd() { s_recListId = -1; } -void C4JRender::CBuffClear(int index) { +void GLRenderer::CBuffClear(int index) { pthread_mutex_lock(&s_glCallMtx); auto it = s_chunkPool.find(index); if (it != s_chunkPool.end()) { @@ -987,7 +991,7 @@ void C4JRender::CBuffClear(int index) { pthread_mutex_unlock(&s_glCallMtx); } -bool C4JRender::CBuffCall(int index, bool) { +bool GLRenderer::CBuffCall(int index, bool) { pthread_mutex_lock(&s_glCallMtx); auto it = s_chunkPool.find(index); if (it == s_chunkPool.end() || !it->second.valid) { @@ -1026,7 +1030,7 @@ bool C4JRender::CBuffCall(int index, bool) { return true; } -void C4JRender::MatrixMode(int t) { +void GLRenderer::MatrixMode(int t) { if (t == GL_PROJECTION) s_matMode = 1; else if (t == GL_TEXTURE) @@ -1035,53 +1039,53 @@ void C4JRender::MatrixMode(int t) { s_matMode = 0; } -void C4JRender::MatrixSetIdentity() { +void GLRenderer::MatrixSetIdentity() { activeStack().load(glm::mat4(1.f)); markMatrixDirty(); if (s_matMode == 0) markNormalDirty(); } -void C4JRender::MatrixPush() { +void GLRenderer::MatrixPush() { activeStack().push(); // push doesn't change cur() so no dirty needed but mark anyway to be safe // ;w; markMatrixDirty(); if (s_matMode == 0) markNormalDirty(); } -void C4JRender::MatrixPop() { +void GLRenderer::MatrixPop() { activeStack().pop(); markMatrixDirty(); if (s_matMode == 0) markNormalDirty(); } -void C4JRender::MatrixTranslate(float x, float y, float z) { +void GLRenderer::MatrixTranslate(float x, float y, float z) { activeStack().mul(glm::translate(glm::mat4(1.f), {x, y, z})); markMatrixDirty(); if (s_matMode == 0) markNormalDirty(); } -void C4JRender::MatrixRotate(float a, float x, float y, float z) { +void GLRenderer::MatrixRotate(float a, float x, float y, float z) { activeStack().mul(glm::rotate(glm::mat4(1.f), a, {x, y, z})); markMatrixDirty(); if (s_matMode == 0) markNormalDirty(); } -void C4JRender::MatrixScale(float x, float y, float z) { +void GLRenderer::MatrixScale(float x, float y, float z) { activeStack().mul(glm::scale(glm::mat4(1.f), {x, y, z})); markMatrixDirty(); if (s_matMode == 0) markNormalDirty(); } -void C4JRender::MatrixPerspective(float fovy, float asp, float zn, float zf) { +void GLRenderer::MatrixPerspective(float fovy, float asp, float zn, float zf) { s_proj.cur() = glm::perspective(glm::radians(fovy), asp, zn, zf); markMatrixDirty(); } -void C4JRender::MatrixOrthogonal(float l, float r, float b, float t, float zn, +void GLRenderer::MatrixOrthogonal(float l, float r, float b, float t, float zn, float zf) { s_proj.cur() = glm::ortho(l, r, b, t, zn, zf); markMatrixDirty(); } -void C4JRender::MatrixMult(float* m) { +void GLRenderer::MatrixMult(float* m) { activeStack().mul(glm::make_mat4(m)); markMatrixDirty(); if (s_matMode == 0) markNormalDirty(); } -const float* C4JRender::MatrixGet(int t) { +const float* GLRenderer::MatrixGet(int t) { static float buf[16]; glm::mat4* m = (t == GL_MODELVIEW_MATRIX) ? &s_mv.cur() : (t == GL_PROJECTION_MATRIX) ? &s_proj.cur() @@ -1090,7 +1094,7 @@ const float* C4JRender::MatrixGet(int t) { return buf; } -void C4JRender::Set_matrixDirty() { +void GLRenderer::Set_matrixDirty() { // iggy wipes opengl state s_boundProgram = 0; s_rs_dirty_mask = 0xFFFFFFFF; @@ -1104,20 +1108,20 @@ void C4JRender::Set_matrixDirty() { } } -void C4JRender::Clear(int f) { glClear(f); } -void C4JRender::SetClearColour(const float c[4]) { +void GLRenderer::Clear(int f) { glClear(f); } +void GLRenderer::SetClearColour(const float c[4]) { glClearColor(c[0], c[1], c[2], c[3]); } -bool C4JRender::IsWidescreen() { return true; } -bool C4JRender::IsHiDef() { return true; } -void C4JRender::StateSetColour(float r, float g, float b, float a) { +bool GLRenderer::IsWidescreen() { return true; } +bool GLRenderer::IsHiDef() { return true; } +void GLRenderer::StateSetColour(float r, float g, float b, float a) { glm::vec4 v = {r, g, b, a}; if (s_rs.baseColor != v) { s_rs.baseColor = v; markDirty(DIRTY_BASECOLOR); } } -void C4JRender::SetChunkOffset(float x, float y, float z) { +void GLRenderer::SetChunkOffset(float x, float y, float z) { if (s_shader.uChunkOffset < 0) return; glm::vec3 v = {x, y, z}; if (!s_chunkOffsetValid || s_chunkOffset != v) { @@ -1128,111 +1132,111 @@ void C4JRender::SetChunkOffset(float x, float y, float z) { glUniform3f(s_shader.uChunkOffset, x, y, z); } } -void C4JRender::StateSetDepthMask(bool e) { +void GLRenderer::StateSetDepthMask(bool e) { glShadowSetDepthMask(e ? GL_TRUE : GL_FALSE); } -void C4JRender::StateSetBlendEnable(bool e) { glShadowSetBlend(e); } -void C4JRender::StateSetBlendFunc(int s, int d) { +void GLRenderer::StateSetBlendEnable(bool e) { glShadowSetBlend(e); } +void GLRenderer::StateSetBlendFunc(int s, int d) { glShadowSetBlendFunc(s, d); } -void C4JRender::StateSetDepthFunc(int f) { ::glDepthFunc(f); } -void C4JRender::StateSetFaceCull(bool e) { glShadowSetCull(e); } -void C4JRender::StateSetFaceCullCW(bool e) { +void GLRenderer::StateSetDepthFunc(int f) { ::glDepthFunc(f); } +void GLRenderer::StateSetFaceCull(bool e) { glShadowSetCull(e); } +void GLRenderer::StateSetFaceCullCW(bool e) { glShadowSetFrontFace(e ? GL_CW : GL_CCW); } -void C4JRender::StateSetLineWidth(float w) { +void GLRenderer::StateSetLineWidth(float w) { #ifndef GLES glShadowSetLineWidth(w); #else (void)w; #endif } -void C4JRender::StateSetWriteEnable(bool r, bool g, bool b, bool a) { +void GLRenderer::StateSetWriteEnable(bool r, bool g, bool b, bool a) { glShadowSetColorMask(r, g, b, a); } -void C4JRender::StateSetDepthTestEnable(bool e) { glShadowSetDepthTest(e); } -void C4JRender::StateSetAlphaTestEnable(bool e) { +void GLRenderer::StateSetDepthTestEnable(bool e) { glShadowSetDepthTest(e); } +void GLRenderer::StateSetAlphaTestEnable(bool e) { float v = e ? 0.1f : 0.f; if (s_rs.alphaRef != v) { s_rs.alphaRef = v; markDirty(DIRTY_ALPHA); } } -void C4JRender::StateSetAlphaFunc(int, float p) { +void GLRenderer::StateSetAlphaFunc(int, float p) { if (s_rs.alphaRef != p) { s_rs.alphaRef = p; markDirty(DIRTY_ALPHA); } } -void C4JRender::StateSetDepthSlopeAndBias(float s, float b) { +void GLRenderer::StateSetDepthSlopeAndBias(float s, float b) { glShadowSetPolygonOffset(s, b); } -void C4JRender::StateSetBlendFactor(unsigned int col) { +void GLRenderer::StateSetBlendFactor(unsigned int col) { float a = ((col >> 24) & 0xFF) / 255.f; float r = ((col >> 16) & 0xFF) / 255.f; float g = ((col >> 8) & 0xFF) / 255.f; float b = (col & 0xFF) / 255.f; glBlendColor(r, g, b, a); } -void C4JRender::StateSetFogEnable(bool e) { +void GLRenderer::StateSetFogEnable(bool e) { if (s_rs.fogEnable != e) { s_rs.fogEnable = e; markDirty(DIRTY_FOG); } } -void C4JRender::StateSetFogMode(int mode) { +void GLRenderer::StateSetFogMode(int mode) { int v = (mode == GL_LINEAR) ? 1 : (mode == GL_EXP) ? 2 : (mode == 0x0801) ? 3 : 0; if (s_rs.fogMode != v) { s_rs.fogMode = v; markDirty(DIRTY_FOG); } } -void C4JRender::StateSetFogNearDistance(float d) { +void GLRenderer::StateSetFogNearDistance(float d) { if (s_rs.fogStart != d) { s_rs.fogStart = d; markDirty(DIRTY_FOG); } } -void C4JRender::StateSetFogFarDistance(float d) { +void GLRenderer::StateSetFogFarDistance(float d) { if (s_rs.fogEnd != d) { s_rs.fogEnd = d; markDirty(DIRTY_FOG); } } -void C4JRender::StateSetFogDensity(float d) { +void GLRenderer::StateSetFogDensity(float d) { if (s_rs.fogDensity != d) { s_rs.fogDensity = d; markDirty(DIRTY_FOG); } } -void C4JRender::StateSetFogColour(float r, float g, float b) { +void GLRenderer::StateSetFogColour(float r, float g, float b) { glm::vec4 v = {r, g, b, 1}; if (s_rs.fogColor != v) { s_rs.fogColor = v; markDirty(DIRTY_FOG); } } -void C4JRender::StateSetLightingEnable(bool e) { +void GLRenderer::StateSetLightingEnable(bool e) { if (s_rs.lighting != e) { s_rs.lighting = e; markDirty(DIRTY_LIGHTING); } } -void C4JRender::StateSetLightColour(int, float r, float g, float b) { +void GLRenderer::StateSetLightColour(int, float r, float g, float b) { glm::vec3 v = {r, g, b}; if (s_rs.ldiff != v) { s_rs.ldiff = v; markDirty(DIRTY_LIGHTING); } } -void C4JRender::StateSetLightAmbientColour(float r, float g, float b) { +void GLRenderer::StateSetLightAmbientColour(float r, float g, float b) { glm::vec3 v = {r, g, b}; if (s_rs.lamb != v) { s_rs.lamb = v; markDirty(DIRTY_LIGHTING); } } -void C4JRender::StateSetLightDirection(int light, float x, float y, float z) { +void GLRenderer::StateSetLightDirection(int light, float x, float y, float z) { glm::vec3 d = glm::normalize(glm::mat3(s_mv.cur()) * glm::vec3(x, y, z)); if (light == 0) { if (s_rs.l0 != d) { @@ -1246,44 +1250,44 @@ void C4JRender::StateSetLightDirection(int light, float x, float y, float z) { } } } -void C4JRender::StateSetViewport(eViewportType) { +void GLRenderer::StateSetViewport(eViewportType) { glViewport(0, 0, s_windowWidth, s_windowHeight); } -void C4JRender::StateSetVertexTextureUV(float u, float v) { +void GLRenderer::StateSetVertexTextureUV(float u, float v) { glm::vec2 val = {u, v}; if (s_rs.globalLM != val) { s_rs.globalLM = val; markDirty(DIRTY_GLOBAL_LM); } } -void C4JRender::StateSetStencil(int fn, uint8_t ref, uint8_t fmask, +void GLRenderer::StateSetStencil(int fn, uint8_t ref, uint8_t fmask, uint8_t wmask) { glShadowSetStencil(fn, ref, fmask, wmask); } -void C4JRender::StateSetTextureEnable(bool e) { +void GLRenderer::StateSetTextureEnable(bool e) { if (s_rs.activeTexture == 0 && s_rs.useTexture != e) { s_rs.useTexture = e; markDirty(DIRTY_TEXTURE); } } -void C4JRender::StateSetActiveTexture(int tex) { +void GLRenderer::StateSetActiveTexture(int tex) { s_rs.activeTexture = (tex == 0x84C1 /*GL_TEXTURE1*/) ? 1 : 0; } -int C4JRender::TextureCreate() { +int GLRenderer::TextureCreate() { GLuint id; glGenTextures(1, &id); return (int)id; } -void C4JRender::TextureFree(int i) { +void GLRenderer::TextureFree(int i) { GLuint id = (GLuint)i; glDeleteTextures(1, &id); } -void C4JRender::TextureBind(int idx) { +void GLRenderer::TextureBind(int idx) { glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, idx < 0 ? 0 : (GLuint)idx); } -void C4JRender::TextureBindVertex(int idx, bool scaleLight) { +void GLRenderer::TextureBindVertex(int idx, bool scaleLight) { if (idx < 0) { if (s_rs.useLightmap) { s_rs.useLightmap = false; @@ -1311,7 +1315,7 @@ void C4JRender::TextureBindVertex(int idx, bool scaleLight) { markDirty(DIRTY_LMT); } } -void C4JRender::TextureSetTextureLevels(int l) { +void GLRenderer::TextureSetTextureLevels(int l) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, l > 0 ? l - 1 : 0); if (l > 1) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, @@ -1319,8 +1323,8 @@ void C4JRender::TextureSetTextureLevels(int l) { else glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } -int C4JRender::TextureGetTextureLevels() { return 1; } -void C4JRender::TextureData(int w, int h, void* d, int lvl, eTextureFormat) { +int GLRenderer::TextureGetTextureLevels() { return 1; } +void GLRenderer::TextureData(int w, int h, void* d, int lvl, eTextureFormat) { glTexImage2D(GL_TEXTURE_2D, lvl, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, d); if (lvl == 0) { @@ -1331,12 +1335,12 @@ void C4JRender::TextureData(int w, int h, void* d, int lvl, eTextureFormat) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } } -void C4JRender::TextureDataUpdate(int xo, int yo, int w, int h, void* d, +void GLRenderer::TextureDataUpdate(int xo, int yo, int w, int h, void* d, int lvl) { glTexSubImage2D(GL_TEXTURE_2D, lvl, xo, yo, w, h, GL_RGBA, GL_UNSIGNED_BYTE, d); } -void C4JRender::TextureSetParam(int p, int v) { +void GLRenderer::TextureSetParam(int p, int v) { glTexParameteri(GL_TEXTURE_2D, p, v); } @@ -1355,7 +1359,7 @@ static int stbLoad(unsigned char* data, int w, int h, D3DXIMAGE_INFO* info, *out = px; return 0; // Success } -int C4JRender::LoadTextureData(const char* fn, D3DXIMAGE_INFO* i, int** o) { +int GLRenderer::LoadTextureData(const char* fn, D3DXIMAGE_INFO* i, int** o) { int w, h, c; unsigned char* d = stbi_load(fn, &w, &h, &c, 4); if (!d) return -1; // Failure @@ -1363,7 +1367,7 @@ int C4JRender::LoadTextureData(const char* fn, D3DXIMAGE_INFO* i, int** o) { stbi_image_free(d); return hr; } -int C4JRender::LoadTextureData(uint8_t* pb, uint32_t nb, D3DXIMAGE_INFO* i, +int GLRenderer::LoadTextureData(uint8_t* pb, uint32_t nb, D3DXIMAGE_INFO* i, int** o) { int w, h, c; unsigned char* d = stbi_load_from_memory(pb, (int)nb, &w, &h, &c, 4); @@ -1374,7 +1378,7 @@ int C4JRender::LoadTextureData(uint8_t* pb, uint32_t nb, D3DXIMAGE_INFO* i, } // TODO: TO REMOVE SOON. -void C4JRender::UpdateGamma(unsigned short usGamma) { +void GLRenderer::UpdateGamma(unsigned short usGamma) { constexpr unsigned short GAMMA_MAX = 32768; s_rs.gamma = 0.5f + ((float)(usGamma) * (1.0f / GAMMA_MAX)); } @@ -1449,25 +1453,184 @@ void glGetQueryObjectu_4J_Helper(unsigned int id, unsigned int pname, extern "C" { void glFogfv(GLenum pname, const GLfloat* params) { if (pname == 0x0B66) - RenderManager.StateSetFogColour(params[0], params[1], params[2]); + PlatformRenderer.StateSetFogColour(params[0], params[1], params[2]); } void glLightfv(GLenum light, GLenum pname, const GLfloat* params) { if (pname == 0x1203) - RenderManager.StateSetLightDirection(light == 0x4000 ? 0 : 1, params[0], + PlatformRenderer.StateSetLightDirection(light == 0x4000 ? 0 : 1, params[0], params[1], params[2]); else if (pname == 0x1200) - RenderManager.StateSetLightAmbientColour(params[0], params[1], + PlatformRenderer.StateSetLightAmbientColour(params[0], params[1], params[2]); else if (pname == 0x1201) - RenderManager.StateSetLightColour(light == 0x4000 ? 0 : 1, params[0], + PlatformRenderer.StateSetLightColour(light == 0x4000 ? 0 : 1, params[0], params[1], params[2]); } void glLightModelfv(GLenum pname, const GLfloat* params) { if (pname == 0x0B53) - RenderManager.StateSetLightAmbientColour(params[0], params[1], + PlatformRenderer.StateSetLightAmbientColour(params[0], params[1], params[2]); } void glShadeModel(GLenum) {} void glColorMaterial(GLenum, GLenum) {} void glNormal3f(GLfloat, GLfloat, GLfloat) {} } + +// MARK: LinuxStubs + +#ifdef GLES +extern "C" { +extern void glClearDepthf(float depth); +void glClearDepth(double depth) { glClearDepthf((float)depth); } +void glTexGeni(unsigned int, unsigned int, int) {} +void glTexGenfv(unsigned int, unsigned int, const float*) {} +void glTexCoordPointer(int, unsigned int, int, const void*) {} +void glNormalPointer(unsigned int, int, const void*) {} +void glColorPointer(int, unsigned int, int, const void*) {} +void glVertexPointer(int, unsigned int, int, const void*) {} +void glEndList(void) {} +void glCallLists(int, unsigned int, const void*) {} +} +#endif + +inline int* getIntPtr(IntBuffer* buf) { + return buf ? (int*)buf->getBuffer() + buf->position() : nullptr; +} +inline void* getBytePtr(ByteBuffer* buf) { + return buf ? (char*)buf->getBuffer() + buf->position() : nullptr; +} + +void glGenTextures_4J(IntBuffer* buf) { + if (!buf) return; + int n = buf->limit() - buf->position(); + int* dst = getIntPtr(buf); + for (int i = 0; i < n; i++) dst[i] = PlatformRenderer.TextureCreate(); +} + +void glDeleteTextures_4J(IntBuffer* buf) { + if (!buf) return; + int n = buf->limit() - buf->position(); + int* src = getIntPtr(buf); + for (int i = 0; i < n; i++) PlatformRenderer.TextureFree(src[i]); +} + +void glTexImage2D_4J(int target, int level, int internalformat, int width, + int height, int border, int format, int type, + ByteBuffer* pixels) { + (void)target; + (void)internalformat; + (void)border; + (void)format; + (void)type; + PlatformRenderer.TextureData(width, height, getBytePtr(pixels), level, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); +} + +void glLight_4J(int light, int pname, FloatBuffer* params) { + const float* p = params->_getDataPointer(); + int idx = (light == 0x4001) ? 1 : 0; + if (pname == 0x1203) + PlatformRenderer.StateSetLightDirection(idx, p[0], p[1], p[2]); + else if (pname == 0x1201) + PlatformRenderer.StateSetLightColour(idx, p[0], p[1], p[2]); + else if (pname == 0x1200) + PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); +} + +void glLightModel_4J(int pname, FloatBuffer* params) { + if (pname == 0x0B53) { + const float* p = params->_getDataPointer(); + PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); + } +} + +void glFog_4J(int pname, FloatBuffer* params) { + const float* p = params->_getDataPointer(); + if (pname == 0x0B66) PlatformRenderer.StateSetFogColour(p[0], p[1], p[2]); +} + +void glGetFloat_4J(int pname, FloatBuffer* params) { + const float* m = PlatformRenderer.MatrixGet(pname); + if (m) memcpy(params->_getDataPointer(), m, 16 * sizeof(float)); +} + +void glCallLists_4J(IntBuffer* lists) { + if (!lists) return; + int count = lists->limit() - lists->position(); + int* ids = getIntPtr(lists); + for (int i = 0; i < count; i++) PlatformRenderer.CBuffCall(ids[i], false); +} + +void glReadPixels_4J(int x, int y, int w, int h, int f, int t, ByteBuffer* p) { + (void)f; + (void)t; + PlatformRenderer.ReadPixels(x, y, w, h, getBytePtr(p)); +} + +// dead stubs +void glTexCoordPointer_4J(int, int, FloatBuffer*) {} +void glNormalPointer_4J(int, ByteBuffer*) {} +void glColorPointer_4J(int, bool, int, ByteBuffer*) {} +void glVertexPointer_4J(int, int, FloatBuffer*) {} +void glEndList_4J(int) {} +void glTexGen_4J(int, int, FloatBuffer*) {} + +#include +#include +#include + +static PFNGLGENQUERIESARBPROC _glGenQueriesARB = nullptr; +static PFNGLBEGINQUERYARBPROC _glBeginQueryARB = nullptr; +static PFNGLENDQUERYARBPROC _glEndQueryARB = nullptr; +static PFNGLGETQUERYOBJECTUIVARBPROC _glGetQueryObjectuivARB = nullptr; +static bool _queriesInitialized = false; + +static void initQueryFuncs() { + if (_queriesInitialized) return; + _queriesInitialized = true; + _glGenQueriesARB = + (PFNGLGENQUERIESARBPROC)dlsym(RTLD_DEFAULT, "glGenQueriesARB"); + _glBeginQueryARB = + (PFNGLBEGINQUERYARBPROC)dlsym(RTLD_DEFAULT, "glBeginQueryARB"); + _glEndQueryARB = (PFNGLENDQUERYARBPROC)dlsym(RTLD_DEFAULT, "glEndQueryARB"); + _glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)dlsym( + RTLD_DEFAULT, "glGetQueryObjectuivARB"); +} + +void glGenQueriesARB_4J(IntBuffer* buf) { + initQueryFuncs(); + if (_glGenQueriesARB && buf) { + int n = buf->limit() - buf->position(); + if (n > 0) _glGenQueriesARB(n, (GLuint*)getIntPtr(buf)); + } +} + +void glBeginQueryARB_4J(int target, int id) { + initQueryFuncs(); + if (_glBeginQueryARB) _glBeginQueryARB((GLenum)target, (GLuint)id); +} + +void glEndQueryARB_4J(int target) { + initQueryFuncs(); + if (_glEndQueryARB) _glEndQueryARB((GLenum)target); +} + +void glGetQueryObjectuARB_4J(int id, int pname, IntBuffer* params) { + initQueryFuncs(); + if (_glGetQueryObjectuivARB && params) + // LWJGL does not change limits/positions during these calls, it + // reads/writes exactly at pointer!! + _glGetQueryObjectuivARB((GLuint)id, (GLenum)pname, + (GLuint*)getIntPtr(params)); +} +void glGetFloat(int pname, FloatBuffer* params) { + glGetFloat_4J(pname, params); +} +void LinuxGLLogLightmapState(const char* stage, int textureId, + bool scaleLight) { + static int logCount = 0; + if (logCount >= 16) return; + ++logCount; + fprintf(stderr, "[linux-lightmap] %s tex=%d scale=%d\n", stage, textureId, + scaleLight ? 1 : 0); +} \ No newline at end of file diff --git a/targets/platform/sdl2/Render.h b/targets/platform/renderer/gl/GLRenderer.h similarity index 86% rename from targets/platform/sdl2/Render.h rename to targets/platform/renderer/gl/GLRenderer.h index aeb67c263..d1ac862a4 100644 --- a/targets/platform/sdl2/Render.h +++ b/targets/platform/renderer/gl/GLRenderer.h @@ -8,9 +8,11 @@ #include #include -#include "../IPlatformRenderer.h" +#include "renderer/IPlatformRenderer.h" -class C4JRender : public IPlatformRenderer { +extern IPlatformRenderer& PlatformRenderer; + +class GLRenderer : public IPlatformRenderer { public: void Tick(); void UpdateGamma(unsigned short usGamma); @@ -151,8 +153,6 @@ public: void Shutdown(); }; -extern C4JRender RenderManager; - // OpenGL Interception Macros #ifndef GL_MODELVIEW_MATRIX #define GL_MODELVIEW_MATRIX 0x0BA6 @@ -388,17 +388,17 @@ extern C4JRender RenderManager; // glCallList / display list macros #undef glNewList -#define glNewList(_list, _mode) RenderManager.CBuffStart(_list) +#define glNewList(_list, _mode) PlatformRenderer.CBuffStart(_list) #undef glEndList -#define glEndList() RenderManager.CBuffEnd() +#define glEndList() PlatformRenderer.CBuffEnd() #undef glCallList -#define glCallList(_list) RenderManager.CBuffCall(_list) +#define glCallList(_list) PlatformRenderer.CBuffCall(_list) // glGenLists / glDeleteLists, lists are not supported in core!!!!! #undef glGenLists -#define glGenLists(range) RenderManager.CBuffCreate(range) +#define glGenLists(range) PlatformRenderer.CBuffCreate(range) #undef glDeleteLists -#define glDeleteLists(list, range) RenderManager.CBuffDelete(list, range) +#define glDeleteLists(list, range) PlatformRenderer.CBuffDelete(list, range) #ifndef GL_SHADEMODEL_IS_FUNCTION #undef glShadeModel @@ -410,97 +410,97 @@ extern C4JRender RenderManager; #undef glTranslatef #define glTranslatef(x, y, z) \ do { \ - RenderManager.MatrixTranslate(x, y, z); \ + PlatformRenderer.MatrixTranslate(x, y, z); \ } while (0) #undef glRotatef #define glRotatef(a, x, y, z) \ do { \ - RenderManager.MatrixRotate((a) * (3.14159265358979f / 180.f), x, y, \ + PlatformRenderer.MatrixRotate((a) * (3.14159265358979f / 180.f), x, y, \ z); \ } while (0) #undef glScalef #define glScalef(x, y, z) \ do { \ - RenderManager.MatrixScale(x, y, z); \ + PlatformRenderer.MatrixScale(x, y, z); \ } while (0) #undef glScaled #define glScaled(x, y, z) \ do { \ - RenderManager.MatrixScale((float)(x), (float)(y), (float)(z)); \ + PlatformRenderer.MatrixScale((float)(x), (float)(y), (float)(z)); \ } while (0) #undef glPushMatrix #define glPushMatrix() \ do { \ - RenderManager.MatrixPush(); \ + PlatformRenderer.MatrixPush(); \ } while (0) #undef glPopMatrix #define glPopMatrix() \ do { \ - RenderManager.MatrixPop(); \ + PlatformRenderer.MatrixPop(); \ } while (0) #undef glLoadIdentity #define glLoadIdentity() \ do { \ - RenderManager.MatrixSetIdentity(); \ + PlatformRenderer.MatrixSetIdentity(); \ } while (0) #undef glMatrixMode #define glMatrixMode(mode) \ do { \ - RenderManager.MatrixMode(mode); \ + PlatformRenderer.MatrixMode(mode); \ } while (0) #undef glMultMatrixf #define glMultMatrixf(m) \ do { \ - RenderManager.MatrixMult(m); \ + PlatformRenderer.MatrixMult(m); \ } while (0) #undef glColor4f #define glColor4f(r, g, b, a) \ do { \ - RenderManager.StateSetColour(r, g, b, a); \ + PlatformRenderer.StateSetColour(r, g, b, a); \ } while (0) #undef glColor3f #define glColor3f(r, g, b) \ do { \ - RenderManager.StateSetColour(r, g, b, 1.0f); \ + PlatformRenderer.StateSetColour(r, g, b, 1.0f); \ } while (0) #undef glAlphaFunc #define glAlphaFunc(func, ref) \ do { \ - RenderManager.StateSetAlphaFunc(func, ref); \ + PlatformRenderer.StateSetAlphaFunc(func, ref); \ } while (0) #undef glEnable #define glEnable(cap) \ do { \ if ((cap) == 0x0B60 /*GL_FOG*/) \ - RenderManager.StateSetFogEnable(true); \ + PlatformRenderer.StateSetFogEnable(true); \ else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ - RenderManager.StateSetLightingEnable(true); \ + PlatformRenderer.StateSetLightingEnable(true); \ else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ - RenderManager.StateSetAlphaTestEnable(true); \ + PlatformRenderer.StateSetAlphaTestEnable(true); \ else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ - RenderManager.StateSetTextureEnable(true); \ + PlatformRenderer.StateSetTextureEnable(true); \ else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ - RenderManager.StateSetBlendEnable(true); \ + PlatformRenderer.StateSetBlendEnable(true); \ else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ - RenderManager.StateSetFaceCull(true); \ + PlatformRenderer.StateSetFaceCull(true); \ else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ - RenderManager.StateSetDepthTestEnable(true); \ + PlatformRenderer.StateSetDepthTestEnable(true); \ else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ - RenderManager.StateSetLightEnable(0, true); \ + PlatformRenderer.StateSetLightEnable(0, true); \ else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ - RenderManager.StateSetLightEnable(1, true); \ + PlatformRenderer.StateSetLightEnable(1, true); \ else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ @@ -516,23 +516,23 @@ extern C4JRender RenderManager; #define glDisable(cap) \ do { \ if ((cap) == 0x0B60 /*GL_FOG*/) \ - RenderManager.StateSetFogEnable(false); \ + PlatformRenderer.StateSetFogEnable(false); \ else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ - RenderManager.StateSetLightingEnable(false); \ + PlatformRenderer.StateSetLightingEnable(false); \ else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ - RenderManager.StateSetAlphaTestEnable(false); \ + PlatformRenderer.StateSetAlphaTestEnable(false); \ else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ - RenderManager.StateSetTextureEnable(false); \ + PlatformRenderer.StateSetTextureEnable(false); \ else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ - RenderManager.StateSetBlendEnable(false); \ + PlatformRenderer.StateSetBlendEnable(false); \ else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ - RenderManager.StateSetFaceCull(false); \ + PlatformRenderer.StateSetFaceCull(false); \ else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ - RenderManager.StateSetDepthTestEnable(false); \ + PlatformRenderer.StateSetDepthTestEnable(false); \ else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ - RenderManager.StateSetLightEnable(0, false); \ + PlatformRenderer.StateSetLightEnable(0, false); \ else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ - RenderManager.StateSetLightEnable(1, false); \ + PlatformRenderer.StateSetLightEnable(1, false); \ else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ @@ -548,50 +548,44 @@ extern C4JRender RenderManager; #define glFogi(pname, param) \ do { \ if ((pname) == 0x0B65 /*GL_FOG_MODE*/) \ - RenderManager.StateSetFogMode(param); \ + PlatformRenderer.StateSetFogMode(param); \ } while (0) #undef glFogf #define glFogf(pname, param) \ do { \ if ((pname) == 0x0B63 /*GL_FOG_START*/) \ - RenderManager.StateSetFogNearDistance(param); \ + PlatformRenderer.StateSetFogNearDistance(param); \ else if ((pname) == 0x0B64 /*GL_FOG_END*/) \ - RenderManager.StateSetFogFarDistance(param); \ + PlatformRenderer.StateSetFogFarDistance(param); \ else if ((pname) == 0x0B62 /*GL_FOG_DENSITY*/) \ - RenderManager.StateSetFogDensity(param); \ + PlatformRenderer.StateSetFogDensity(param); \ } while (0) #undef glOrtho #define glOrtho(left, right, bottom, top, zNear, zFar) \ do { \ - RenderManager.MatrixOrthogonal(left, right, bottom, top, zNear, zFar); \ - } while (0) - -#undef gluPerspective -#define gluPerspective(fovy, aspect, zNear, zFar) \ - do { \ - RenderManager.MatrixPerspective(fovy, aspect, zNear, zFar); \ + PlatformRenderer.MatrixOrthogonal(left, right, bottom, top, zNear, zFar); \ } while (0) #undef glMultiTexCoord2f #define glMultiTexCoord2f(tex, u, v) \ do { \ if ((tex) == 0x84C1 /*GL_TEXTURE1*/) \ - RenderManager.StateSetVertexTextureUV(u, v); \ + PlatformRenderer.StateSetVertexTextureUV(u, v); \ } while (0) #undef glActiveTexture #define glActiveTexture(tex) \ do { \ - RenderManager.StateSetActiveTexture(tex); \ + PlatformRenderer.StateSetActiveTexture(tex); \ ::glActiveTexture(tex); \ } while (0) #undef glClientActiveTexture #define glClientActiveTexture(tex) \ do { \ - RenderManager.StateSetActiveTexture(tex); \ + PlatformRenderer.StateSetActiveTexture(tex); \ } while (0) // declarations @@ -644,7 +638,7 @@ inline void glCallLists_4J(T* lists) { int base = lists->position(); int count = lists->limit() - base; for (int i = 0; i < count; i++) { - RenderManager.CBuffCall(lists->get(base + i)); + PlatformRenderer.CBuffCall(lists->get(base + i)); } } template @@ -665,25 +659,25 @@ template inline void glFog_4J(int pname, T* params) { float* p = params->_getDataPointer(); if (pname == 0x0B66 /* GL_FOG_COLOR */) - RenderManager.StateSetFogColour(p[0], p[1], p[2]); + PlatformRenderer.StateSetFogColour(p[0], p[1], p[2]); } template inline void glLight_4J(int light, int pname, T* params) { float* p = params->_getDataPointer(); if (pname == 0x1203 /* GL_POSITION */) - RenderManager.StateSetLightDirection(light == 0x4000 ? 0 : 1, p[0], + PlatformRenderer.StateSetLightDirection(light == 0x4000 ? 0 : 1, p[0], p[1], p[2]); else if (pname == 0x1200 /* GL_AMBIENT */) - RenderManager.StateSetLightAmbientColour(p[0], p[1], p[2]); + PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); else if (pname == 0x1201 /* GL_DIFFUSE */) - RenderManager.StateSetLightColour(light == 0x4000 ? 0 : 1, p[0], p[1], + PlatformRenderer.StateSetLightColour(light == 0x4000 ? 0 : 1, p[0], p[1], p[2]); } template inline void glLightModel_4J(int pname, T* params) { float* p = params->_getDataPointer(); if (pname == 0x0B53 /* GL_LIGHT_MODEL_AMBIENT */) - RenderManager.StateSetLightAmbientColour(p[0], p[1], p[2]); + PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); } template inline void glTexGen_4J(int coord, int pname, T* params) {} @@ -709,6 +703,7 @@ void glEndQuery_4J_Helper(unsigned int target); void glGenQueries_4J_Helper(unsigned int* id); void glGetQueryObjectu_4J_Helper(unsigned int id, unsigned int pname, unsigned int* val); + // redirect the functions to my own implementation, no more 2.1 funcs #define glGenTextures(...) glGenTextures_4J(__VA_ARGS__) #define glDeleteTextures(...) glDeleteTextures_4J(__VA_ARGS__) diff --git a/targets/platform/sdl2/gl3_loader.h b/targets/platform/renderer/gl/gl3_loader.h similarity index 100% rename from targets/platform/sdl2/gl3_loader.h rename to targets/platform/renderer/gl/gl3_loader.h diff --git a/targets/platform/renderer/gl/render_stubs.cpp b/targets/platform/renderer/gl/render_stubs.cpp new file mode 100644 index 000000000..29d8c3d4f --- /dev/null +++ b/targets/platform/renderer/gl/render_stubs.cpp @@ -0,0 +1,44 @@ +#include "GLRenderer.h" + +// Command Buffers +void GLRenderer::CBuffLockStaticCreations() {} +int GLRenderer::CBuffSize(int) { return 0; } +void GLRenderer::CBuffTick() {} +void GLRenderer::CBuffDeferredModeStart() {} +void GLRenderer::CBuffDeferredModeEnd() {} + +// Render States +void GLRenderer::StateSetLightEnable(int, bool) {} +void GLRenderer::StateSetEnableViewportClipPlanes(bool) {} +void GLRenderer::StateSetForceLOD(int) {} +void GLRenderer::StateSetTexGenCol(int, float, float, float, float, bool) {} + +// Textures +void GLRenderer::TextureDynamicUpdateStart() {} +void GLRenderer::TextureDynamicUpdateEnd() {} +void GLRenderer::TextureGetStats() {} +void* GLRenderer::TextureGetTexture(int) { return nullptr; } + +int GLRenderer::SaveTextureData(const char*, D3DXIMAGE_INFO*, int*) { return 0; } +int GLRenderer::SaveTextureDataToMemory(void*, int, int*, int, int, int*) { + return 0; +} + +// Screen/Image Capturing +void GLRenderer::DoScreenGrabOnNextPresent() {} +void GLRenderer::CaptureThumbnail(ImageFileBuffer*) {} +void GLRenderer::CaptureScreen(ImageFileBuffer*, XSOCIAL_PREVIEWIMAGE*) {} + +// Conditional Rendering & Events +void GLRenderer::BeginConditionalSurvey(int) {} +void GLRenderer::EndConditionalSurvey() {} +void GLRenderer::BeginConditionalRendering(int) {} +void GLRenderer::EndConditionalRendering() {} +void GLRenderer::BeginEvent(const wchar_t*) {} +void GLRenderer::EndEvent() {} +void GLRenderer::Tick() {} + +// Lifecycle +void GLRenderer::Suspend() {} +bool GLRenderer::Suspended() { return false; } +void GLRenderer::Resume() {} \ No newline at end of file diff --git a/targets/platform/sdl2/shaders/fragment.frag b/targets/platform/renderer/gl/shaders/fragment.frag similarity index 100% rename from targets/platform/sdl2/shaders/fragment.frag rename to targets/platform/renderer/gl/shaders/fragment.frag diff --git a/targets/platform/sdl2/shaders/fragment_es.frag b/targets/platform/renderer/gl/shaders/fragment_es.frag similarity index 100% rename from targets/platform/sdl2/shaders/fragment_es.frag rename to targets/platform/renderer/gl/shaders/fragment_es.frag diff --git a/targets/platform/sdl2/shaders/vertex.vert b/targets/platform/renderer/gl/shaders/vertex.vert similarity index 100% rename from targets/platform/sdl2/shaders/vertex.vert rename to targets/platform/renderer/gl/shaders/vertex.vert diff --git a/targets/platform/sdl2/shaders/vertex_es.vert b/targets/platform/renderer/gl/shaders/vertex_es.vert similarity index 100% rename from targets/platform/sdl2/shaders/vertex_es.vert rename to targets/platform/renderer/gl/shaders/vertex_es.vert diff --git a/targets/platform/renderer/renderer.h b/targets/platform/renderer/renderer.h new file mode 100644 index 000000000..881bd56bd --- /dev/null +++ b/targets/platform/renderer/renderer.h @@ -0,0 +1,4 @@ +#include "IPlatformRenderer.h" +#include "./gl/GLRenderer.h" + +extern IPlatformRenderer& PlatformRenderer; diff --git a/targets/platform/sdl2/render_stubs.cpp b/targets/platform/sdl2/render_stubs.cpp deleted file mode 100644 index 4f5619017..000000000 --- a/targets/platform/sdl2/render_stubs.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "Render.h" - -// Command Buffers -void C4JRender::CBuffLockStaticCreations() {} -int C4JRender::CBuffSize(int) { return 0; } -void C4JRender::CBuffTick() {} -void C4JRender::CBuffDeferredModeStart() {} -void C4JRender::CBuffDeferredModeEnd() {} - -// Render States -void C4JRender::StateSetLightEnable(int, bool) {} -void C4JRender::StateSetEnableViewportClipPlanes(bool) {} -void C4JRender::StateSetForceLOD(int) {} -void C4JRender::StateSetTexGenCol(int, float, float, float, float, bool) {} - -// Textures -void C4JRender::TextureDynamicUpdateStart() {} -void C4JRender::TextureDynamicUpdateEnd() {} -void C4JRender::TextureGetStats() {} -void* C4JRender::TextureGetTexture(int) { return nullptr; } - -int C4JRender::SaveTextureData(const char*, D3DXIMAGE_INFO*, int*) { return 0; } -int C4JRender::SaveTextureDataToMemory(void*, int, int*, int, int, int*) { - return 0; -} - -// Screen/Image Capturing -void C4JRender::DoScreenGrabOnNextPresent() {} -void C4JRender::CaptureThumbnail(ImageFileBuffer*) {} -void C4JRender::CaptureScreen(ImageFileBuffer*, XSOCIAL_PREVIEWIMAGE*) {} - -// Conditional Rendering & Events -void C4JRender::BeginConditionalSurvey(int) {} -void C4JRender::EndConditionalSurvey() {} -void C4JRender::BeginConditionalRendering(int) {} -void C4JRender::EndConditionalRendering() {} -void C4JRender::BeginEvent(const wchar_t*) {} -void C4JRender::EndEvent() {} -void C4JRender::Tick() {} - -// Lifecycle -void C4JRender::Suspend() {} -bool C4JRender::Suspended() { return false; } -void C4JRender::Resume() {} \ No newline at end of file diff --git a/targets/platform/storage/stub/StubStorage.h b/targets/platform/storage/stub/StubStorage.h index e654c377c..f2c3c2797 100644 --- a/targets/platform/storage/stub/StubStorage.h +++ b/targets/platform/storage/stub/StubStorage.h @@ -7,7 +7,7 @@ #include // #include -#include "../PlatformTypes.h" +#include "PlatformTypes.h" #include "../IPlatformStorage.h" class C4JStringTable; From 32aaafeb7ee777a2bb0afc83e77caf86c9cecc9c Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:29:27 -0500 Subject: [PATCH 06/15] remove GL/gl.h includes --- targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp | 2 +- targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp | 2 +- targets/app/linux/Linux_UIController.cpp | 2 +- targets/minecraft/client/Camera.cpp | 2 +- targets/minecraft/client/Lighting.cpp | 2 +- targets/minecraft/client/MemoryTracker.cpp | 2 +- targets/minecraft/client/gui/Font.cpp | 2 +- targets/minecraft/client/gui/GuiComponent.cpp | 2 +- targets/minecraft/client/gui/Minimap.cpp | 2 +- targets/minecraft/client/gui/TradeSwitchButton.cpp | 2 +- targets/minecraft/client/gui/achievement/AchievementPopup.cpp | 2 +- targets/minecraft/client/gui/achievement/AchievementScreen.cpp | 2 +- targets/minecraft/client/gui/inventory/BeaconScreen.cpp | 2 +- targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp | 2 +- .../minecraft/client/gui/inventory/CreativeInventoryScreen.cpp | 2 +- targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp | 2 +- targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp | 2 +- targets/minecraft/client/gui/inventory/MerchantScreen.cpp | 2 +- targets/minecraft/client/gui/inventory/RepairScreen.cpp | 2 +- targets/minecraft/client/model/ChestModel.cpp | 2 +- targets/minecraft/client/model/QuadrupedModel.cpp | 2 +- targets/minecraft/client/model/dragon/DragonModel.cpp | 2 +- targets/minecraft/client/model/dragon/EnderCrystalModel.cpp | 2 +- targets/minecraft/client/model/geom/ModelPart.cpp | 2 +- targets/minecraft/client/particle/FootstepParticle.cpp | 2 +- targets/minecraft/client/particle/HugeExplosionParticle.cpp | 2 +- targets/minecraft/client/particle/ParticleEngine.cpp | 2 +- targets/minecraft/client/particle/TakeAnimationParticle.cpp | 2 +- targets/minecraft/client/renderer/Chunk.cpp | 2 +- targets/minecraft/client/renderer/ItemInHandRenderer.cpp | 2 +- targets/minecraft/client/renderer/LevelRenderer.cpp | 2 +- targets/minecraft/client/renderer/Tesselator.cpp | 2 +- targets/minecraft/client/renderer/Textures.cpp | 2 +- targets/minecraft/client/renderer/TileRenderer.cpp | 2 +- targets/minecraft/client/renderer/culling/Frustum.cpp | 2 +- targets/minecraft/client/renderer/entity/ArrowRenderer.cpp | 2 +- targets/minecraft/client/renderer/entity/BatRenderer.cpp | 2 +- targets/minecraft/client/renderer/entity/EndermanRenderer.cpp | 2 +- targets/minecraft/client/renderer/entity/HorseRenderer.cpp | 2 +- .../minecraft/client/renderer/entity/HumanoidMobRenderer.cpp | 2 +- targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp | 2 +- .../minecraft/client/renderer/entity/MushroomCowRenderer.cpp | 2 +- targets/minecraft/client/renderer/entity/PaintingRenderer.cpp | 2 +- targets/minecraft/client/renderer/entity/PlayerRenderer.cpp | 2 +- targets/minecraft/client/renderer/texture/Texture.h | 2 +- targets/minecraft/client/skins/AbstractTexturePack.cpp | 2 +- 46 files changed, 46 insertions(+), 46 deletions(-) diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp index 679f84572..252e1e9f3 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp @@ -1,6 +1,6 @@ #include "app/common/UI/Controls/UIControl_MinecraftHorse.h" -#include + #include #include diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp index 2f9ccf5cc..ed5fee485 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp @@ -1,6 +1,6 @@ #include "UIControl_MinecraftPlayer.h" -#include + #include #include diff --git a/targets/app/linux/Linux_UIController.cpp b/targets/app/linux/Linux_UIController.cpp index 7e17456b2..642b672be 100644 --- a/targets/app/linux/Linux_UIController.cpp +++ b/targets/app/linux/Linux_UIController.cpp @@ -1,4 +1,4 @@ -#include + // GDraw GL backend for Linux #include "platform/renderer/renderer.h" diff --git a/targets/minecraft/client/Camera.cpp b/targets/minecraft/client/Camera.cpp index 29c5062cb..b5b31e63f 100644 --- a/targets/minecraft/client/Camera.cpp +++ b/targets/minecraft/client/Camera.cpp @@ -1,6 +1,6 @@ #include "Camera.h" -#include + #include #include #include diff --git a/targets/minecraft/client/Lighting.cpp b/targets/minecraft/client/Lighting.cpp index 132da9140..e2a03d56f 100644 --- a/targets/minecraft/client/Lighting.cpp +++ b/targets/minecraft/client/Lighting.cpp @@ -1,6 +1,6 @@ #include "Lighting.h" -#include + #include "platform/renderer/renderer.h" #include "java/FloatBuffer.h" diff --git a/targets/minecraft/client/MemoryTracker.cpp b/targets/minecraft/client/MemoryTracker.cpp index 215d5cc34..f8830d3c3 100644 --- a/targets/minecraft/client/MemoryTracker.cpp +++ b/targets/minecraft/client/MemoryTracker.cpp @@ -2,7 +2,7 @@ #include #include -#include + #include "platform/renderer/renderer.h" #include "java/ByteBuffer.h" diff --git a/targets/minecraft/client/gui/Font.cpp b/targets/minecraft/client/gui/Font.cpp index a9ac0fce5..9caa216b9 100644 --- a/targets/minecraft/client/gui/Font.cpp +++ b/targets/minecraft/client/gui/Font.cpp @@ -4,7 +4,7 @@ #include #include -#include + #include "platform/renderer/renderer.h" #include "minecraft/client/BufferedImage.h" diff --git a/targets/minecraft/client/gui/GuiComponent.cpp b/targets/minecraft/client/gui/GuiComponent.cpp index 3dc780b4a..b89ee5e95 100644 --- a/targets/minecraft/client/gui/GuiComponent.cpp +++ b/targets/minecraft/client/gui/GuiComponent.cpp @@ -1,6 +1,6 @@ #include "GuiComponent.h" -#include + #include #include "platform/renderer/renderer.h" diff --git a/targets/minecraft/client/gui/Minimap.cpp b/targets/minecraft/client/gui/Minimap.cpp index 2111f908f..5f863df84 100644 --- a/targets/minecraft/client/gui/Minimap.cpp +++ b/targets/minecraft/client/gui/Minimap.cpp @@ -1,6 +1,6 @@ #include "Minimap.h" -#include + #include #include #include diff --git a/targets/minecraft/client/gui/TradeSwitchButton.cpp b/targets/minecraft/client/gui/TradeSwitchButton.cpp index 13271bfe3..28b514cee 100644 --- a/targets/minecraft/client/gui/TradeSwitchButton.cpp +++ b/targets/minecraft/client/gui/TradeSwitchButton.cpp @@ -1,7 +1,7 @@ #include "TradeSwitchButton.h" #include -#include + #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" diff --git a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp index daad90a66..159dfca74 100644 --- a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp @@ -1,6 +1,6 @@ #include "AchievementPopup.h" -#include + #include "platform/renderer/renderer.h" #include "java/System.h" diff --git a/targets/minecraft/client/gui/achievement/AchievementScreen.cpp b/targets/minecraft/client/gui/achievement/AchievementScreen.cpp index cc4fced49..fa1000c76 100644 --- a/targets/minecraft/client/gui/achievement/AchievementScreen.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementScreen.cpp @@ -1,6 +1,6 @@ #include "AchievementScreen.h" -#include + #include #include diff --git a/targets/minecraft/client/gui/inventory/BeaconScreen.cpp b/targets/minecraft/client/gui/inventory/BeaconScreen.cpp index 5d9076852..219014eb4 100644 --- a/targets/minecraft/client/gui/inventory/BeaconScreen.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconScreen.cpp @@ -1,6 +1,6 @@ #include "BeaconScreen.h" -#include + #include #include diff --git a/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp b/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp index ba551bce4..49f4b940b 100644 --- a/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp +++ b/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp @@ -1,7 +1,7 @@ #include "BrewingStandScreen.h" #include -#include + #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" diff --git a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp index 4dd812cfe..f5d9ec587 100644 --- a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp @@ -1,7 +1,7 @@ #include "minecraft/IGameServices.h" #include "CreativeInventoryScreen.h" -#include + #include #include diff --git a/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp b/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp index 9c6b1e7db..fd739c9d8 100644 --- a/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp +++ b/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp @@ -6,7 +6,7 @@ #include #include #include -#include + #include "AbstractContainerScreen.h" #include "minecraft/client/Lighting.h" diff --git a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp index 5f3966d89..0ff98dac2 100644 --- a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp @@ -2,7 +2,7 @@ #include #include -#include + #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/gui/inventory/MerchantScreen.cpp b/targets/minecraft/client/gui/inventory/MerchantScreen.cpp index 5dfdfef7a..d7e7a540d 100644 --- a/targets/minecraft/client/gui/inventory/MerchantScreen.cpp +++ b/targets/minecraft/client/gui/inventory/MerchantScreen.cpp @@ -3,7 +3,7 @@ #include #include #include -#include + #include "AbstractContainerScreen.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" diff --git a/targets/minecraft/client/gui/inventory/RepairScreen.cpp b/targets/minecraft/client/gui/inventory/RepairScreen.cpp index 3a96e74a4..f3ce5c284 100644 --- a/targets/minecraft/client/gui/inventory/RepairScreen.cpp +++ b/targets/minecraft/client/gui/inventory/RepairScreen.cpp @@ -1,6 +1,6 @@ #include "RepairScreen.h" -#include + #include #include diff --git a/targets/minecraft/client/model/ChestModel.cpp b/targets/minecraft/client/model/ChestModel.cpp index 1c4200673..3169b41bb 100644 --- a/targets/minecraft/client/model/ChestModel.cpp +++ b/targets/minecraft/client/model/ChestModel.cpp @@ -1,6 +1,6 @@ #include "ChestModel.h" -#include + #include "minecraft/client/model/geom/ModelPart.h" diff --git a/targets/minecraft/client/model/QuadrupedModel.cpp b/targets/minecraft/client/model/QuadrupedModel.cpp index 1697242df..5fc29c030 100644 --- a/targets/minecraft/client/model/QuadrupedModel.cpp +++ b/targets/minecraft/client/model/QuadrupedModel.cpp @@ -8,7 +8,7 @@ #include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" -#include + QuadrupedModel::QuadrupedModel(int legSize, float g) : Model() { yHeadOffs = 8; diff --git a/targets/minecraft/client/model/dragon/DragonModel.cpp b/targets/minecraft/client/model/dragon/DragonModel.cpp index 9a2566353..0298f3426 100644 --- a/targets/minecraft/client/model/dragon/DragonModel.cpp +++ b/targets/minecraft/client/model/dragon/DragonModel.cpp @@ -6,7 +6,7 @@ #include #include #include -#include + #include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" diff --git a/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp b/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp index 9c119198d..a02cf3832 100644 --- a/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp +++ b/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp @@ -2,7 +2,7 @@ #include #include -#include + #include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" diff --git a/targets/minecraft/client/model/geom/ModelPart.cpp b/targets/minecraft/client/model/geom/ModelPart.cpp index ce13eb6c3..9665d0688 100644 --- a/targets/minecraft/client/model/geom/ModelPart.cpp +++ b/targets/minecraft/client/model/geom/ModelPart.cpp @@ -1,6 +1,6 @@ #include "ModelPart.h" -#include + #include diff --git a/targets/minecraft/client/particle/FootstepParticle.cpp b/targets/minecraft/client/particle/FootstepParticle.cpp index dfeffe0e5..fb35d73a9 100644 --- a/targets/minecraft/client/particle/FootstepParticle.cpp +++ b/targets/minecraft/client/particle/FootstepParticle.cpp @@ -1,6 +1,6 @@ #include "FootstepParticle.h" -#include + #include diff --git a/targets/minecraft/client/particle/HugeExplosionParticle.cpp b/targets/minecraft/client/particle/HugeExplosionParticle.cpp index 2cf67ba77..b29c58a9b 100644 --- a/targets/minecraft/client/particle/HugeExplosionParticle.cpp +++ b/targets/minecraft/client/particle/HugeExplosionParticle.cpp @@ -1,6 +1,6 @@ #include "HugeExplosionParticle.h" -#include + #include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" diff --git a/targets/minecraft/client/particle/ParticleEngine.cpp b/targets/minecraft/client/particle/ParticleEngine.cpp index 4f8908049..31efb4f2f 100644 --- a/targets/minecraft/client/particle/ParticleEngine.cpp +++ b/targets/minecraft/client/particle/ParticleEngine.cpp @@ -1,6 +1,6 @@ #include "ParticleEngine.h" -#include + #include #include diff --git a/targets/minecraft/client/particle/TakeAnimationParticle.cpp b/targets/minecraft/client/particle/TakeAnimationParticle.cpp index b214cc02a..c71e150e4 100644 --- a/targets/minecraft/client/particle/TakeAnimationParticle.cpp +++ b/targets/minecraft/client/particle/TakeAnimationParticle.cpp @@ -1,6 +1,6 @@ #include "TakeAnimationParticle.h" -#include + #include diff --git a/targets/minecraft/client/renderer/Chunk.cpp b/targets/minecraft/client/renderer/Chunk.cpp index 5e9cfeec7..75de01de2 100644 --- a/targets/minecraft/client/renderer/Chunk.cpp +++ b/targets/minecraft/client/renderer/Chunk.cpp @@ -1,6 +1,6 @@ #include "Chunk.h" -#include + #include #include diff --git a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp index 7a4446891..b0d025a97 100644 --- a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -2,7 +2,7 @@ #include "minecraft/util/Log.h" #include "ItemInHandRenderer.h" -#include + #include #include diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index abad124c7..21fbaf554 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -2,7 +2,7 @@ #include "minecraft/util/Log.h" #include "LevelRenderer.h" -#include + #include #include #include diff --git a/targets/minecraft/client/renderer/Tesselator.cpp b/targets/minecraft/client/renderer/Tesselator.cpp index 3fa3fcfe8..9bdc09508 100644 --- a/targets/minecraft/client/renderer/Tesselator.cpp +++ b/targets/minecraft/client/renderer/Tesselator.cpp @@ -1,7 +1,7 @@ #include "minecraft/util/Log.h" #include "Tesselator.h" -#include + #include diff --git a/targets/minecraft/client/renderer/Textures.cpp b/targets/minecraft/client/renderer/Textures.cpp index 939117d92..0b5d2ed3f 100644 --- a/targets/minecraft/client/renderer/Textures.cpp +++ b/targets/minecraft/client/renderer/Textures.cpp @@ -7,7 +7,7 @@ #include #include #include -#include + #include "platform/renderer/renderer.h" #include "HttpTexture.h" diff --git a/targets/minecraft/client/renderer/TileRenderer.cpp b/targets/minecraft/client/renderer/TileRenderer.cpp index 6f6634dd8..aea9f3f63 100644 --- a/targets/minecraft/client/renderer/TileRenderer.cpp +++ b/targets/minecraft/client/renderer/TileRenderer.cpp @@ -1,6 +1,6 @@ #include "TileRenderer.h" -#include + #include #include #include diff --git a/targets/minecraft/client/renderer/culling/Frustum.cpp b/targets/minecraft/client/renderer/culling/Frustum.cpp index 0a633fdd0..203d20404 100644 --- a/targets/minecraft/client/renderer/culling/Frustum.cpp +++ b/targets/minecraft/client/renderer/culling/Frustum.cpp @@ -1,6 +1,6 @@ #include "Frustum.h" -#include + #include #include diff --git a/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp b/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp index ab6c51937..216fbb231 100644 --- a/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp @@ -11,7 +11,7 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/projectile/Arrow.h" -#include + ResourceLocation ArrowRenderer::ARROW_LOCATION = ResourceLocation(TN_ITEM_ARROWS); diff --git a/targets/minecraft/client/renderer/entity/BatRenderer.cpp b/targets/minecraft/client/renderer/entity/BatRenderer.cpp index 8db0deb42..9e24748ae 100644 --- a/targets/minecraft/client/renderer/entity/BatRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/BatRenderer.cpp @@ -2,7 +2,7 @@ #include #include -#include + #include "platform/renderer/renderer.h" #include "minecraft/client/model/BatModel.h" diff --git a/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp b/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp index 7c787d032..50ba53c66 100644 --- a/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp @@ -1,7 +1,7 @@ #include "EndermanRenderer.h" #include -#include + #include "platform/renderer/renderer.h" diff --git a/targets/minecraft/client/renderer/entity/HorseRenderer.cpp b/targets/minecraft/client/renderer/entity/HorseRenderer.cpp index db7ac150f..566a17fdd 100644 --- a/targets/minecraft/client/renderer/entity/HorseRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HorseRenderer.cpp @@ -1,7 +1,7 @@ #include "HorseRenderer.h" #include -#include + #include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" diff --git a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp index 725b5dccf..dc9d98380 100644 --- a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp @@ -2,7 +2,7 @@ #include #include -#include + #include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" diff --git a/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp index a2bde451a..eb52cec58 100644 --- a/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp @@ -1,4 +1,4 @@ -#include + #include diff --git a/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp b/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp index 65289c1c9..cfcf9f9ff 100644 --- a/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp @@ -1,7 +1,7 @@ #include "MushroomCowRenderer.h" #include -#include + #include "platform/renderer/renderer.h" diff --git a/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp b/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp index 48485fcaa..f86aeda37 100644 --- a/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp @@ -1,7 +1,7 @@ #include "PaintingRenderer.h" #include -#include + #include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp index 2e70c72f4..6a92015a3 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp @@ -4,7 +4,7 @@ #include #include #include -#include + #include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" diff --git a/targets/minecraft/client/renderer/texture/Texture.h b/targets/minecraft/client/renderer/texture/Texture.h index d1699f23f..d83638819 100644 --- a/targets/minecraft/client/renderer/texture/Texture.h +++ b/targets/minecraft/client/renderer/texture/Texture.h @@ -1,6 +1,6 @@ #pragma once -#include +#include "platform/renderer/renderer.h" #include #include diff --git a/targets/minecraft/client/skins/AbstractTexturePack.cpp b/targets/minecraft/client/skins/AbstractTexturePack.cpp index b8917360b..c8dc44f83 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.cpp +++ b/targets/minecraft/client/skins/AbstractTexturePack.cpp @@ -1,7 +1,7 @@ #include "minecraft/util/Log.h" #include "AbstractTexturePack.h" -#include + #include #include From 2f1a6f265f68afcb8e2449382c56fd7feed97945 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 17:32:19 -0500 Subject: [PATCH 07/15] reorganize file i/o --- targets/app/common/ArchiveManager.cpp | 4 +- targets/app/common/Audio/SoundEngine.cpp | 18 ++-- targets/app/common/DLC/DLCManager.cpp | 8 +- .../LevelGenerationOptions.cpp | 12 +-- .../app/common/Network/GameNetworkManager.cpp | 8 +- .../common/UI/All Platforms/ArchiveFile.cpp | 6 +- targets/app/common/UI/UITTFFont.cpp | 8 +- targets/java/src/File.cpp | 8 +- targets/minecraft/client/BufferedImage.cpp | 6 +- .../minecraft/client/skins/DLCTexturePack.cpp | 6 +- .../level/levelgen/CustomLevelSource.cpp | 16 ++-- .../newbiome/layer/BiomeOverrideLayer.cpp | 10 +- .../ConsoleSaveFileOriginal.cpp | 6 +- .../ConsoleSaveFileSplit.cpp | 4 +- targets/platform/Platform.h | 2 +- targets/platform/PlatformServices.cpp | 7 +- targets/platform/PlatformServices.h | 7 -- targets/platform/StdFileIO.h | 92 ------------------- .../IPlatformFilesystem.h} | 4 +- targets/platform/fs/fs.h | 3 + targets/platform/fs/std/StdFilesystem.cpp | 92 +++++++++++++++++++ targets/platform/fs/std/StdFilesystem.h | 32 +++++++ targets/platform/meson.build | 1 + targets/platform/renderer/renderer.h | 2 +- 24 files changed, 193 insertions(+), 169 deletions(-) delete mode 100644 targets/platform/StdFileIO.h rename targets/platform/{IPlatformFileIO.h => fs/IPlatformFilesystem.h} (95%) create mode 100644 targets/platform/fs/fs.h create mode 100644 targets/platform/fs/std/StdFilesystem.cpp create mode 100644 targets/platform/fs/std/StdFilesystem.h diff --git a/targets/app/common/ArchiveManager.cpp b/targets/app/common/ArchiveManager.cpp index 82f271460..9ca8bf20a 100644 --- a/targets/app/common/ArchiveManager.cpp +++ b/targets/app/common/ArchiveManager.cpp @@ -9,7 +9,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" #include "platform/PlatformTypes.h" ArchiveManager::ArchiveManager() @@ -26,7 +26,7 @@ void ArchiveManager::loadMediaArchive() { if (!mediapath.empty()) { #if defined(__linux__) - std::wstring exeDirW = PlatformFileIO.getBasePath().wstring(); + std::wstring exeDirW = PlatformFilesystem.getBasePath().wstring(); std::wstring candidate = exeDirW + File::pathSeparator + mediapath; if (File(candidate).exists()) { m_mediaArchive = new ArchiveFile(File(candidate)); diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index 3eee15e86..08bb3ebb2 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -16,7 +16,7 @@ #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "platform/C4JThread.h" -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -183,7 +183,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, for (int i = 0; szId[i]; i++) if (szId[i] == '.') szId[i] = '/'; - std::string base = PlatformFileIO.getBasePath().string() + "/"; + std::string base = PlatformFilesystem.getBasePath().string() + "/"; const char* roots[] = { "Sound/Minecraft/", "app/common/Sound/Minecraft/", "app/common/res/TitleUpdate/res/Sound/Minecraft/"}; @@ -197,7 +197,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, for (int i = 1; i <= 16; i++) { char tryP[512]; snprintf(tryP, 512, "%s%s%d%s", fullRoot.c_str(), szId, i, ext); - if (PlatformFileIO.exists(tryP)) + if (PlatformFilesystem.exists(tryP)) count = i; else break; @@ -210,7 +210,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, } char tryP[512]; snprintf(tryP, 512, "%s%s%s", fullRoot.c_str(), szId, ext); - if (PlatformFileIO.exists(tryP)) { + if (PlatformFilesystem.exists(tryP)) { strncpy(finalPath, tryP, 511); found = true; break; @@ -250,7 +250,7 @@ void SoundEngine::playUI(int iSound, float volume, float pitch) { wcstombs(szIdentifier, wchUISoundNames[iSound], 255); for (int i = 0; szIdentifier[i]; i++) if (szIdentifier[i] == '.') szIdentifier[i] = '/'; - std::string base = PlatformFileIO.getBasePath().string() + "/"; + std::string base = PlatformFilesystem.getBasePath().string() + "/"; const char* roots[] = { "Sound/Minecraft/UI/", "Sound/Minecraft/", @@ -265,7 +265,7 @@ void SoundEngine::playUI(int iSound, float volume, float pitch) { char tryP[512]; snprintf(tryP, 512, "%s%s%s%s", base.c_str(), root, szIdentifier, ext); - if (PlatformFileIO.exists(tryP)) { + if (PlatformFilesystem.exists(tryP)) { strncpy(finalPath, tryP, 511); found = true; break; @@ -452,7 +452,7 @@ void SoundEngine::playMusicTick() { return; } if (m_musicID != -1) { - std::string base = PlatformFileIO.getBasePath().string() + "/"; + std::string base = PlatformFilesystem.getBasePath().string() + "/"; bool isCD = (m_musicID >= m_iStream_CD_1); const char* folder = isCD ? "cds/" : "music/"; const char* track = m_szStreamFileA[m_musicID]; @@ -467,13 +467,13 @@ void SoundEngine::playMusicTick() { // try with folder prefix (music/ or cds/) snprintf(m_szStreamName, sizeof(m_szStreamName), "%s%s%s%s%s", base.c_str(), r, folder, track, e); - if (PlatformFileIO.exists(m_szStreamName)) { + if (PlatformFilesystem.exists(m_szStreamName)) { found = true; break; } // try without folder prefix snprintf(m_szStreamName, sizeof(m_szStreamName), "%s%s%s%s", base.c_str(), r, track, e); - if (PlatformFileIO.exists(m_szStreamName)) { + if (PlatformFilesystem.exists(m_szStreamName)) { found = true; break; } diff --git a/targets/app/common/DLC/DLCManager.cpp b/targets/app/common/DLC/DLCManager.cpp index c40c7c7dd..6fdbe3048 100644 --- a/targets/app/common/DLC/DLCManager.cpp +++ b/targets/app/common/DLC/DLCManager.cpp @@ -20,7 +20,7 @@ #include "app/common/GameRules/GameRuleManager.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" #include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePackRepository.h" @@ -105,14 +105,14 @@ bool readOwnedDlcFile(const std::string& path, std::uint8_t** ppData, *pBytesRead = 0; const std::wstring readPath = getMountedDlcReadPath(path); - const std::size_t fSize = PlatformFileIO.fileSize(readPath); + const std::size_t fSize = PlatformFilesystem.fileSize(readPath); if (fSize == 0 || fSize > std::numeric_limits::max()) { return false; } std::uint8_t* data = new std::uint8_t[fSize]; - auto result = PlatformFileIO.readFile(readPath, data, fSize); - if (result.status != IPlatformFileIO::ReadStatus::Ok) { + auto result = PlatformFilesystem.readFile(readPath, data, fSize); + if (result.status != IPlatformFilesystem::ReadStatus::Ok) { delete[] data; return false; } diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index 90eaef659..47e122d64 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -30,7 +30,7 @@ #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h" #include "minecraft/world/phys/AABB.h" -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" #include "strings.h" @@ -599,10 +599,10 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr, uint32_t dwFileSize = grf.length(); if (dwFileSize > 0) { uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize]; - auto readResult = PlatformFileIO.readFile( + auto readResult = PlatformFilesystem.readFile( grf.getPath(), pbData, dwFileSize); if (readResult.status != - IPlatformFileIO::ReadStatus::Ok) { + IPlatformFilesystem::ReadStatus::Ok) { app.FatalLoadError(); } @@ -623,12 +623,12 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr, lgo->getBaseSavePath(), true, L"WPACK:")); if (save.exists()) { std::size_t dwFileSize = - PlatformFileIO.fileSize(save.getPath()); + PlatformFilesystem.fileSize(save.getPath()); if (dwFileSize > 0) { uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize]; - auto readResult = PlatformFileIO.readFile( + auto readResult = PlatformFilesystem.readFile( save.getPath(), pbData, dwFileSize); - if (readResult.status != IPlatformFileIO::ReadStatus::Ok) { + if (readResult.status != IPlatformFilesystem::ReadStatus::Ok) { app.FatalLoadError(); } diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 996129d3d..5374abdb8 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -28,7 +28,7 @@ #include "Socket.h" #include "platform/XboxStubs.h" #include "util/StringHelpers.h" -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "minecraft/client/Minecraft.h" @@ -160,14 +160,14 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, File grf(fileRoot); if (grf.exists()) { std::size_t dwFileSize = - PlatformFileIO.fileSize(grf.getPath()); + PlatformFilesystem.fileSize(grf.getPath()); if (dwFileSize > 0) { uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize]; - auto readResult = PlatformFileIO.readFile( + auto readResult = PlatformFilesystem.readFile( grf.getPath(), pbData, dwFileSize); if (readResult.status != - IPlatformFileIO::ReadStatus::Ok) { + IPlatformFilesystem::ReadStatus::Ok) { app.FatalLoadError(); } diff --git a/targets/app/common/UI/All Platforms/ArchiveFile.cpp b/targets/app/common/UI/All Platforms/ArchiveFile.cpp index 79db751e2..c64ecfb64 100644 --- a/targets/app/common/UI/All Platforms/ArchiveFile.cpp +++ b/targets/app/common/UI/All Platforms/ArchiveFile.cpp @@ -7,7 +7,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" @@ -117,11 +117,11 @@ std::vector ArchiveFile::getFile(const std::wstring& filename) { std::uint8_t* pbData = new std::uint8_t[fileSize == 0 ? 1 : fileSize]; out = std::vector(pbData, pbData + fileSize); auto readResult = - PlatformFileIO.readFileSegment( + PlatformFilesystem.readFileSegment( m_sourcefile.getPath(), static_cast(data->ptr), out.data(), static_cast(data->filesize)); - if (readResult.status != IPlatformFileIO::ReadStatus::Ok) { + if (readResult.status != IPlatformFilesystem::ReadStatus::Ok) { app.DebugPrintf("Failed to read archive file segment\n"); app.FatalLoadError(); } diff --git a/targets/app/common/UI/UITTFFont.cpp b/targets/app/common/UI/UITTFFont.cpp index 53e9036f6..fe5065a90 100644 --- a/targets/app/common/UI/UITTFFont.cpp +++ b/targets/app/common/UI/UITTFFont.cpp @@ -9,7 +9,7 @@ #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" UITTFFont::UITTFFont(const std::string& name, const std::string& path, S32 fallbackCharacter) @@ -17,11 +17,11 @@ UITTFFont::UITTFFont(const std::string& name, const std::string& path, app.DebugPrintf("UITTFFont opening %s\n", path.c_str()); pbData = nullptr; - const std::size_t fileSize = PlatformFileIO.fileSize(path); + const std::size_t fileSize = PlatformFilesystem.fileSize(path); if (fileSize != 0) { pbData = new std::uint8_t[fileSize]; - auto result = PlatformFileIO.readFile(path, pbData, fileSize); - if (result.status != IPlatformFileIO::ReadStatus::Ok) { + auto result = PlatformFilesystem.readFile(path, pbData, fileSize); + if (result.status != IPlatformFilesystem::ReadStatus::Ok) { app.DebugPrintf("Failed to open TTF file\n"); delete[] pbData; pbData = nullptr; diff --git a/targets/java/src/File.cpp b/targets/java/src/File.cpp index dcc73d5b9..fbef763fb 100644 --- a/targets/java/src/File.cpp +++ b/targets/java/src/File.cpp @@ -9,7 +9,7 @@ #include #include "util/StringHelpers.h" // 4jcraft TODO -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" #include "java/FileFilter.h" const wchar_t File::pathSeparator = L'/'; @@ -68,7 +68,7 @@ File::File(const std::wstring& pathname) { while (!request.empty() && request[0] == '/') request.erase(0, 1); if (request.find("res/") == 0) request.erase(0, 4); - std::string exeDir = PlatformFileIO.getBasePath().string(); + std::string exeDir = PlatformFilesystem.getBasePath().string(); std::string fileName = request; size_t lastSlash = fileName.find_last_of('/'); if (lastSlash != std::string::npos) @@ -84,11 +84,11 @@ File::File(const std::wstring& pathname) { for (const char* base : bases) { std::string tryFull = exeDir + base + request; std::string tryFile = exeDir + base + fileName; - if (PlatformFileIO.exists(tryFull)) { + if (PlatformFilesystem.exists(tryFull)) { m_abstractPathName = convStringToWstring(tryFull); return; } - if (PlatformFileIO.exists(tryFile)) { + if (PlatformFilesystem.exists(tryFile)) { m_abstractPathName = convStringToWstring(tryFile); return; } diff --git a/targets/minecraft/client/BufferedImage.cpp b/targets/minecraft/client/BufferedImage.cpp index 4752a427b..232b4edf8 100644 --- a/targets/minecraft/client/BufferedImage.cpp +++ b/targets/minecraft/client/BufferedImage.cpp @@ -14,7 +14,7 @@ #include "app/linux/Stubs/winapi_stubs.h" #include "PlatformTypes.h" #include "util/StringHelpers.h" -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" BufferedImage::BufferedImage(int width, int height, int type) { data[0] = new int[width * height]; @@ -61,7 +61,7 @@ BufferedImage::BufferedImage(const std::wstring& File, baseName = baseName.substr(1); if (baseName.find(L"res/") == 0) baseName = baseName.substr(4); - std::wstring exeDir = PlatformFileIO.getBasePath().wstring(); + std::wstring exeDir = PlatformFilesystem.getBasePath().wstring(); for (int l = 0; l < 10; l++) { std::wstring mipSuffix = @@ -82,7 +82,7 @@ BufferedImage::BufferedImage(const std::wstring& File, size_t p; while ((p = attempt.find(L"//")) != std::wstring::npos) attempt.replace(p, 2, L"/"); - if (PlatformFileIO.exists(attempt)) { + if (PlatformFilesystem.exists(attempt)) { finalPath = attempt; foundOnDisk = true; break; diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 65aa87701..4e8d803c1 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -29,7 +29,7 @@ #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" #include "java/File.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/AbstractTexturePack.h" @@ -55,8 +55,8 @@ bool ReadPortableBinaryFile(File& file, std::uint8_t*& data, const std::size_t capacity = static_cast(fileLength); std::uint8_t* buffer = new std::uint8_t[capacity == 0 ? 1 : capacity]; auto readResult = - PlatformFileIO.readFile(file.getPath(), buffer, capacity); - if (readResult.status != IPlatformFileIO::ReadStatus::Ok || + PlatformFilesystem.readFile(file.getPath(), buffer, capacity); + if (readResult.status != IPlatformFilesystem::ReadStatus::Ok || readResult.fileSize > std::numeric_limits::max()) { delete[] buffer; data = nullptr; diff --git a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp index 2a0fa0170..21fc21605 100644 --- a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -8,7 +8,7 @@ #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/LinuxGame.h" -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" #if defined(__linux__) @@ -47,12 +47,12 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed, { const char* path = "GameRules/heightmap.bin"; - auto result = PlatformFileIO.readFile( + auto result = PlatformFilesystem.readFile( path, m_heightmapOverride.data(), m_heightmapOverride.size()); - if (result.status == IPlatformFileIO::ReadStatus::TooLarge) { + if (result.status == IPlatformFilesystem::ReadStatus::TooLarge) { Log::info("Heightmap binary is too large!!\n"); __debugbreak(); - } else if (result.status != IPlatformFileIO::ReadStatus::Ok) { + } else if (result.status != IPlatformFilesystem::ReadStatus::Ok) { gameServices().fatalLoadError(); assert(false); } @@ -63,16 +63,16 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed, { const char* waterHeightPath = "GameRules/waterheight.bin"; - auto result = PlatformFileIO.readFile( + auto result = PlatformFilesystem.readFile( waterHeightPath, m_waterheightOverride.data(), m_waterheightOverride.size()); - if (result.status == IPlatformFileIO::ReadStatus::NotFound) { + if (result.status == IPlatformFilesystem::ReadStatus::NotFound) { memset(m_waterheightOverride.data(), level->seaLevel, m_waterheightOverride.size()); - } else if (result.status == IPlatformFileIO::ReadStatus::TooLarge) { + } else if (result.status == IPlatformFilesystem::ReadStatus::TooLarge) { Log::info("waterheight binary is too large!!\n"); __debugbreak(); - } else if (result.status != IPlatformFileIO::ReadStatus::Ok) { + } else if (result.status != IPlatformFilesystem::ReadStatus::Ok) { gameServices().fatalLoadError(); } } diff --git a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp index 1026245ad..d390191f4 100644 --- a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp @@ -4,7 +4,7 @@ #include #include "minecraft/IGameServices.h" -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #if defined(__linux__) #include "app/linux/Stubs/winapi_stubs.h" @@ -16,16 +16,16 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) { { const char* path = "GameRules/biomemap.bin"; - auto result = PlatformFileIO.readFile( + auto result = PlatformFilesystem.readFile( path, m_biomeOverride.data(), m_biomeOverride.size()); - if (result.status == IPlatformFileIO::ReadStatus::NotFound) { + if (result.status == IPlatformFilesystem::ReadStatus::NotFound) { Log::info("Biome override not found, using plains as default\n"); memset(m_biomeOverride.data(), Biome::plains->id, m_biomeOverride.size()); - } else if (result.status == IPlatformFileIO::ReadStatus::TooLarge) { + } else if (result.status == IPlatformFilesystem::ReadStatus::TooLarge) { Log::info("Biomemap binary is too large!!\n"); __debugbreak(); - } else if (result.status != IPlatformFileIO::ReadStatus::Ok) { + } else if (result.status != IPlatformFilesystem::ReadStatus::Ok) { gameServices().fatalLoadError(); } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index a9374fa06..a7f4da1b4 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -34,7 +34,7 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" #include "minecraft/world/level/storage/LevelData.h" #include "platform/storage/storage.h" -#include "platform/PlatformServices.h" +#include "platform/fs/fs.h" #define RESERVE_ALLOCATION MEM_RESERVE #define COMMIT_ALLOCATION MEM_COMMIT @@ -745,13 +745,13 @@ void ConsoleSaveFileOriginal::DebugFlushToFile( bool writeSucceeded = false; if (compressedData != nullptr && compressedDataSize > 0) { - writeSucceeded = PlatformFileIO.writeFile( + writeSucceeded = PlatformFilesystem.writeFile( outputPath, compressedData, compressedDataSize); numberOfBytesWritten = writeSucceeded ? compressedDataSize : 0; assert(numberOfBytesWritten == compressedDataSize); } else { writeSucceeded = - PlatformFileIO.writeFile(outputPath, pvSaveMem, fileSize); + PlatformFilesystem.writeFile(outputPath, pvSaveMem, fileSize); numberOfBytesWritten = writeSucceeded ? fileSize : 0; assert(numberOfBytesWritten == fileSize); } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index b4fc4b149..ec3600168 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -1464,13 +1464,13 @@ void ConsoleSaveFileSplit::DebugFlushToFile( bool writeSucceeded = false; if (compressedData != nullptr && compressedDataSize > 0) { - writeSucceeded = PlatformFileIO.writeFile( + writeSucceeded = PlatformFilesystem.writeFile( outputPath, compressedData, compressedDataSize); numberOfBytesWritten = writeSucceeded ? compressedDataSize : 0; assert(numberOfBytesWritten == compressedDataSize); } else { writeSucceeded = - PlatformFileIO.writeFile(outputPath, pvSaveMem, fileSize); + PlatformFilesystem.writeFile(outputPath, pvSaveMem, fileSize); numberOfBytesWritten = writeSucceeded ? fileSize : 0; assert(numberOfBytesWritten == fileSize); } diff --git a/targets/platform/Platform.h b/targets/platform/Platform.h index e9b3d7765..d5e66025a 100644 --- a/targets/platform/Platform.h +++ b/targets/platform/Platform.h @@ -1,6 +1,6 @@ #pragma once -#include "IPlatformFileIO.h" +#include "IPlatformFilesystem.h" #include "platform/input/input.h" #include "IPlatformLeaderboard.h" #include "IPlatformNetwork.h" diff --git a/targets/platform/PlatformServices.cpp b/targets/platform/PlatformServices.cpp index a5414736e..d898f56b5 100644 --- a/targets/platform/PlatformServices.cpp +++ b/targets/platform/PlatformServices.cpp @@ -1,6 +1 @@ -#include "PlatformServices.h" -#include "StdFileIO.h" - -static StdFileIO s_stdFileIO; - -IPlatformFileIO& PlatformFileIO = s_stdFileIO; \ No newline at end of file +#include "PlatformServices.h" \ No newline at end of file diff --git a/targets/platform/PlatformServices.h b/targets/platform/PlatformServices.h index 6d041f645..d8b52c721 100644 --- a/targets/platform/PlatformServices.h +++ b/targets/platform/PlatformServices.h @@ -1,11 +1,4 @@ #pragma once -#include "IPlatformFileIO.h" #include "IPlatformLeaderboard.h" #include "IPlatformNetwork.h" - -// Interface references to platform services. Game code uses these -// instead of concrete globals directly. Bindings are established -// by the app layer at startup. - -extern IPlatformFileIO& PlatformFileIO; diff --git a/targets/platform/StdFileIO.h b/targets/platform/StdFileIO.h deleted file mode 100644 index d5bf0c5fa..000000000 --- a/targets/platform/StdFileIO.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include "IPlatformFileIO.h" - -#include -#include -#include - -#if defined(__linux__) -#include -#endif - -// Standard filesystem implementation for desktop platforms. -class StdFileIO : public IPlatformFileIO { -public: - ReadResult readFile(const std::filesystem::path& path, void* buffer, - std::size_t capacity) override { - std::error_code ec; - auto size = std::filesystem::file_size(path, ec); - if (ec) return {ReadStatus::NotFound, 0, 0}; - if (size > capacity) return {ReadStatus::TooLarge, 0, static_cast(size)}; - - std::ifstream f(path, std::ios::binary); - if (!f) return {ReadStatus::NotFound, 0, 0}; - f.read(static_cast(buffer), static_cast(size)); - auto read = static_cast(f.gcount()); - return {f ? ReadStatus::Ok : ReadStatus::ReadError, read, static_cast(size)}; - } - - ReadResult readFileSegment(const std::filesystem::path& path, - std::size_t offset, void* buffer, - std::size_t bytesToRead) override { - std::error_code ec; - auto size = std::filesystem::file_size(path, ec); - if (ec) return {ReadStatus::NotFound, 0, 0}; - if (offset + bytesToRead > size) return {ReadStatus::TooLarge, 0, static_cast(size)}; - - std::ifstream f(path, std::ios::binary); - if (!f) return {ReadStatus::NotFound, 0, 0}; - f.seekg(static_cast(offset)); - f.read(static_cast(buffer), static_cast(bytesToRead)); - auto read = static_cast(f.gcount()); - return {f ? ReadStatus::Ok : ReadStatus::ReadError, read, static_cast(size)}; - } - - std::vector readFileToVec( - const std::filesystem::path& path) override { - std::error_code ec; - auto size = std::filesystem::file_size(path, ec); - if (ec) return {}; - - std::vector data(static_cast(size)); - std::ifstream f(path, std::ios::binary); - if (!f) return {}; - f.read(reinterpret_cast(data.data()), static_cast(size)); - return data; - } - - bool writeFile(const std::filesystem::path& path, const void* buffer, - std::size_t bytesToWrite) override { - std::ofstream f(path, std::ios::binary); - if (!f) return false; - f.write(static_cast(buffer), static_cast(bytesToWrite)); - return f.good(); - } - - bool exists(const std::filesystem::path& path) override { - return std::filesystem::exists(path); - } - - std::size_t fileSize(const std::filesystem::path& path) override { - std::error_code ec; - auto size = std::filesystem::file_size(path, ec); - return ec ? 0 : static_cast(size); - } - - std::filesystem::path getBasePath() override { -#if defined(__linux__) - char buf[4096]; - ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1); - if (len > 0) { - buf[len] = '\0'; - return std::filesystem::path(buf).parent_path(); - } -#endif - return std::filesystem::current_path(); - } - - std::filesystem::path getUserDataPath() override { - return getBasePath(); - } -}; diff --git a/targets/platform/IPlatformFileIO.h b/targets/platform/fs/IPlatformFilesystem.h similarity index 95% rename from targets/platform/IPlatformFileIO.h rename to targets/platform/fs/IPlatformFilesystem.h index 531ed7a7e..0e0ca3b7d 100644 --- a/targets/platform/IPlatformFileIO.h +++ b/targets/platform/fs/IPlatformFilesystem.h @@ -6,7 +6,7 @@ #include // Platform-agnostic file I/O interface. -class IPlatformFileIO { +class IPlatformFilesystem { public: enum class ReadStatus { Ok, @@ -21,7 +21,7 @@ public: std::size_t fileSize; }; - virtual ~IPlatformFileIO() = default; + virtual ~IPlatformFilesystem() = default; // Read an entire file into a caller-provided buffer. [[nodiscard]] virtual ReadResult readFile( diff --git a/targets/platform/fs/fs.h b/targets/platform/fs/fs.h new file mode 100644 index 000000000..4b17768b9 --- /dev/null +++ b/targets/platform/fs/fs.h @@ -0,0 +1,3 @@ +#include "IPlatformFilesystem.h" + +extern IPlatformFilesystem& PlatformFilesystem; \ No newline at end of file diff --git a/targets/platform/fs/std/StdFilesystem.cpp b/targets/platform/fs/std/StdFilesystem.cpp new file mode 100644 index 000000000..3f605392c --- /dev/null +++ b/targets/platform/fs/std/StdFilesystem.cpp @@ -0,0 +1,92 @@ +#include "StdFilesystem.h" + +#include + +#if defined(__linux__) +#include +#endif + +StdFilesystem std_filesystem_instance; +IPlatformFilesystem& PlatformFilesystem = std_filesystem_instance; + +IPlatformFilesystem::ReadResult StdFilesystem::readFile(const std::filesystem::path& path, + void* buffer, std::size_t capacity) { + std::error_code ec; + auto size = std::filesystem::file_size(path, ec); + if (ec) return {ReadStatus::NotFound, 0, 0}; + if (size > capacity) + return {ReadStatus::TooLarge, 0, static_cast(size)}; + + std::ifstream f(path, std::ios::binary); + if (!f) return {ReadStatus::NotFound, 0, 0}; + f.read(static_cast(buffer), static_cast(size)); + auto read = static_cast(f.gcount()); + return {f ? ReadStatus::Ok : ReadStatus::ReadError, read, + static_cast(size)}; +} + +IPlatformFilesystem::ReadResult StdFilesystem::readFileSegment(const std::filesystem::path& path, + std::size_t offset, void* buffer, + std::size_t bytesToRead) { + std::error_code ec; + auto size = std::filesystem::file_size(path, ec); + if (ec) return {ReadStatus::NotFound, 0, 0}; + if (offset + bytesToRead > size) + return {ReadStatus::TooLarge, 0, static_cast(size)}; + + std::ifstream f(path, std::ios::binary); + if (!f) return {ReadStatus::NotFound, 0, 0}; + f.seekg(static_cast(offset)); + f.read(static_cast(buffer), + static_cast(bytesToRead)); + auto read = static_cast(f.gcount()); + return {f ? ReadStatus::Ok : ReadStatus::ReadError, read, + static_cast(size)}; +} + +std::vector StdFilesystem::readFileToVec( + const std::filesystem::path& path) { + std::error_code ec; + auto size = std::filesystem::file_size(path, ec); + if (ec) return {}; + + std::vector data(static_cast(size)); + std::ifstream f(path, std::ios::binary); + if (!f) return {}; + f.read(reinterpret_cast(data.data()), + static_cast(size)); + return data; +} + +bool StdFilesystem::writeFile(const std::filesystem::path& path, + const void* buffer, std::size_t bytesToWrite) { + std::ofstream f(path, std::ios::binary); + if (!f) return false; + f.write(static_cast(buffer), + static_cast(bytesToWrite)); + return f.good(); +} + +bool StdFilesystem::exists(const std::filesystem::path& path) { + return std::filesystem::exists(path); +} + +std::size_t StdFilesystem::fileSize(const std::filesystem::path& path) { + std::error_code ec; + auto size = std::filesystem::file_size(path, ec); + return ec ? 0 : static_cast(size); +} + +std::filesystem::path StdFilesystem::getBasePath() { +#if defined(__linux__) + char buf[4096]; + ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1); + if (len > 0) { + buf[len] = '\0'; + return std::filesystem::path(buf).parent_path(); + } +#endif + return std::filesystem::current_path(); +} + +std::filesystem::path StdFilesystem::getUserDataPath() { return getBasePath(); } \ No newline at end of file diff --git a/targets/platform/fs/std/StdFilesystem.h b/targets/platform/fs/std/StdFilesystem.h new file mode 100644 index 000000000..6e494e5e1 --- /dev/null +++ b/targets/platform/fs/std/StdFilesystem.h @@ -0,0 +1,32 @@ +#pragma once + +#include "../IPlatformFilesystem.h" + +#include +#include +#include + +// Standard filesystem implementation for desktop platforms. +class StdFilesystem : public IPlatformFilesystem { +public: + ReadResult readFile(const std::filesystem::path& path, void* buffer, + std::size_t capacity) override; + + ReadResult readFileSegment(const std::filesystem::path& path, + std::size_t offset, void* buffer, + std::size_t bytesToRead) override; + + std::vector readFileToVec( + const std::filesystem::path& path) override; + + bool writeFile(const std::filesystem::path& path, const void* buffer, + std::size_t bytesToWrite) override; + + bool exists(const std::filesystem::path& path) override; + + std::size_t fileSize(const std::filesystem::path& path) override; + + std::filesystem::path getBasePath() override; + + std::filesystem::path getUserDataPath() override; +}; \ No newline at end of file diff --git a/targets/platform/meson.build b/targets/platform/meson.build index 4fab96098..7aed1816f 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -30,6 +30,7 @@ sdl2_sources = files( 'storage/stub/StubStorage.cpp', 'renderer/gl/GLRenderer.cpp', 'renderer/gl/render_stubs.cpp', + 'fs/std/StdFilesystem.cpp', ) lib_platform_sdl2 = static_library('platform_sdl2', diff --git a/targets/platform/renderer/renderer.h b/targets/platform/renderer/renderer.h index 881bd56bd..873b2a352 100644 --- a/targets/platform/renderer/renderer.h +++ b/targets/platform/renderer/renderer.h @@ -1,4 +1,4 @@ #include "IPlatformRenderer.h" -#include "./gl/GLRenderer.h" +#include "./gl/GLRenderer.h" // 4jcraft TODO: find a way to handle OpenGL stubs through a facade extern IPlatformRenderer& PlatformRenderer; From c6285c903d19c6f214495116e3b23a1517d5023e Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 17:38:21 -0500 Subject: [PATCH 08/15] nuke PlatformServices --- targets/app/common/Game.cpp | 1 - targets/app/meson.build | 3 +-- targets/minecraft/world/entity/animal/Ocelot.cpp | 1 - targets/minecraft/world/level/Level.cpp | 1 - targets/minecraft/world/level/biome/BiomeSource.cpp | 1 - .../world/level/chunk/storage/McRegionChunkStorage.cpp | 1 - .../minecraft/world/level/chunk/storage/OldChunkStorage.cpp | 1 - targets/minecraft/world/level/dimension/Dimension.cpp | 1 - targets/minecraft/world/level/dimension/HellDimension.cpp | 1 - targets/minecraft/world/level/newbiome/layer/Layer.cpp | 1 - .../level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp | 1 - .../minecraft/world/level/storage/DirectoryLevelStorage.cpp | 1 - targets/platform/PlatformServices.cpp | 1 - targets/platform/PlatformServices.h | 4 ---- 14 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 targets/platform/PlatformServices.cpp delete mode 100644 targets/platform/PlatformServices.h diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index a13bd8c95..752016d29 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -24,7 +24,6 @@ #include "platform/NetTypes.h" #include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" -#include "platform/PlatformServices.h" #include "java/Class.h" #include "java/File.h" #include "java/Random.h" diff --git a/targets/app/meson.build b/targets/app/meson.build index bdaec6d56..4fb3c2340 100644 --- a/targets/app/meson.build +++ b/targets/app/meson.build @@ -51,11 +51,10 @@ if get_option('ui_backend') == 'shiggy' client_dependencies += shiggy_dep endif -platform_services_src = files('../platform/PlatformServices.cpp') client = executable( 'Minecraft.Client', - platform_sources + platform_services_src + localisation[1], + platform_sources + localisation[1], include_directories: include_directories('..'), dependencies: client_dependencies, cpp_args: global_cpp_args diff --git a/targets/minecraft/world/entity/animal/Ocelot.cpp b/targets/minecraft/world/entity/animal/Ocelot.cpp index 59b7d990e..fbc292b91 100644 --- a/targets/minecraft/world/entity/animal/Ocelot.cpp +++ b/targets/minecraft/world/entity/animal/Ocelot.cpp @@ -50,7 +50,6 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" #include "nbt/CompoundTag.h" -#include "platform/PlatformServices.h" const double Ocelot::SNEAK_SPEED_MOD = 0.6; const double Ocelot::WALK_SPEED_MOD = 0.8; diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index f81c53971..d7cd0b255 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -73,7 +73,6 @@ #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" #include "minecraft/world/scores/Scoreboard.h" -#include "platform/PlatformServices.h" class CompoundTag; class ItemInstance; diff --git a/targets/minecraft/world/level/biome/BiomeSource.cpp b/targets/minecraft/world/level/biome/BiomeSource.cpp index d4dfd30ac..21eb3d0aa 100644 --- a/targets/minecraft/world/level/biome/BiomeSource.cpp +++ b/targets/minecraft/world/level/biome/BiomeSource.cpp @@ -20,7 +20,6 @@ #include "minecraft/world/level/biome/BiomeCache.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #include "minecraft/world/level/storage/LevelData.h" -#include "platform/PlatformServices.h" #include "strings.h" // 4J - removal of separate temperature & downfall layers brought forward diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index 30178cbb6..d6952cf88 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -32,7 +32,6 @@ #include "minecraft/world/level/storage/LevelData.h" #include "nbt/CompoundTag.h" #include "nbt/NbtIo.h" -#include "platform/PlatformServices.h" class DataInput; diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index eeb876ec7..c4c5d5651 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -33,7 +33,6 @@ #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" #include "nbt/NbtIo.h" -#include "platform/PlatformServices.h" thread_local OldChunkStorage::ThreadStorage* OldChunkStorage::m_tlsStorage = nullptr; diff --git a/targets/minecraft/world/level/dimension/Dimension.cpp b/targets/minecraft/world/level/dimension/Dimension.cpp index 8073dd8dc..ea1e22252 100644 --- a/targets/minecraft/world/level/dimension/Dimension.cpp +++ b/targets/minecraft/world/level/dimension/Dimension.cpp @@ -27,7 +27,6 @@ #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/Vec3.h" -#include "platform/PlatformServices.h" class Pos; diff --git a/targets/minecraft/world/level/dimension/HellDimension.cpp b/targets/minecraft/world/level/dimension/HellDimension.cpp index 48a8da1d8..27e5f97e5 100644 --- a/targets/minecraft/world/level/dimension/HellDimension.cpp +++ b/targets/minecraft/world/level/dimension/HellDimension.cpp @@ -17,7 +17,6 @@ #include "minecraft/world/level/levelgen/HellRandomLevelSource.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/phys/Vec3.h" -#include "platform/PlatformServices.h" void HellDimension::init() { biomeSource = new FixedBiomeSource(Biome::hell, 1, 0); diff --git a/targets/minecraft/world/level/newbiome/layer/Layer.cpp b/targets/minecraft/world/level/newbiome/layer/Layer.cpp index 53bfde0c9..c2605e23a 100644 --- a/targets/minecraft/world/level/newbiome/layer/Layer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/Layer.cpp @@ -27,7 +27,6 @@ #include "minecraft/world/level/newbiome/layer/SwampRiversLayer.h" #include "minecraft/world/level/newbiome/layer/VoronoiZoom.h" #include "minecraft/world/level/newbiome/layer/ZoomLayer.h" -#include "platform/PlatformServices.h" std::vector> Layer::getDefaultLayers( int64_t seed, LevelType* levelType) { diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index ec3600168..299deac45 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -38,7 +38,6 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" #include "minecraft/world/level/storage/LevelData.h" #include "platform/storage/storage.h" -#include "platform/PlatformServices.h" class ProgressListener; diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index edf927cda..360b99f02 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -43,7 +43,6 @@ #include "nbt/ListTag.h" #include "nbt/NbtIo.h" #include "platform/storage/storage.h" -#include "platform/PlatformServices.h" const std::wstring DirectoryLevelStorage::sc_szPlayerDir(L"players/"); diff --git a/targets/platform/PlatformServices.cpp b/targets/platform/PlatformServices.cpp deleted file mode 100644 index d898f56b5..000000000 --- a/targets/platform/PlatformServices.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "PlatformServices.h" \ No newline at end of file diff --git a/targets/platform/PlatformServices.h b/targets/platform/PlatformServices.h deleted file mode 100644 index d8b52c721..000000000 --- a/targets/platform/PlatformServices.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -#include "IPlatformLeaderboard.h" -#include "IPlatformNetwork.h" From 489ca2675dac32b43d429247592b6a04313d7cd2 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 17:42:07 -0500 Subject: [PATCH 09/15] nuke in-tree base64 --- targets/app/common/Leaderboards/base64.cpp | 293 --------------------- targets/app/common/Leaderboards/base64.h | 37 --- 2 files changed, 330 deletions(-) delete mode 100644 targets/app/common/Leaderboards/base64.cpp delete mode 100644 targets/app/common/Leaderboards/base64.h diff --git a/targets/app/common/Leaderboards/base64.cpp b/targets/app/common/Leaderboards/base64.cpp deleted file mode 100644 index cd4504603..000000000 --- a/targets/app/common/Leaderboards/base64.cpp +++ /dev/null @@ -1,293 +0,0 @@ - -/* - base64.cpp and base64.h - - base64 encoding and decoding with C++. - More information at - https://renenyffenegger.ch/notes/development/Base64/Encoding-and-decoding-base-64-with-cpp - - Version: 2.rc.09 (release candidate) - - Copyright (C) 2004-2017, 2020-2022 René Nyffenegger - - This source code is provided 'as-is', without any express or implied - warranty. In no event will the author be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this source code must not be misrepresented; you must not - claim that you wrote the original source code. If you use this source code - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original source code. - - 3. This notice may not be removed or altered from any source distribution. - - René Nyffenegger rene.nyffenegger@adp-gmbh.ch - -*/ - -#include "base64.h" - -#include -#include - -// -// Depending on the url parameter in base64_chars, one of -// two sets of base64 characters needs to be chosen. -// They differ in their last two characters. -// -static const char* base64_chars[2] = { - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789" - "+/", - - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789" - "-_"}; - -static unsigned int pos_of_char(const unsigned char chr) { - // - // Return the position of chr within base64_encode() - // - - if (chr >= 'A' && chr <= 'Z') - return chr - 'A'; - else if (chr >= 'a' && chr <= 'z') - return chr - 'a' + ('Z' - 'A') + 1; - else if (chr >= '0' && chr <= '9') - return chr - '0' + ('Z' - 'A') + ('z' - 'a') + 2; - else if (chr == '+' || chr == '-') - return 62; // Be liberal with input and accept both url ('-') and - // non-url ('+') base 64 characters ( - else if (chr == '/' || chr == '_') - return 63; // Ditto for '/' and '_' - else - // - // 2020-10-23: Throw std::exception rather than const char* - //(Pablo Martin-Gomez, https://github.com/Bouska) - // - throw std::runtime_error("Input is not valid base64-encoded data."); -} - -static std::string insert_linebreaks(std::string str, size_t distance) { - // - // Provided by https://github.com/JomaCorpFX, adapted by me. - // - if (!str.length()) { - return ""; - } - - size_t pos = distance; - - while (pos < str.size()) { - str.insert(pos, "\n"); - pos += distance + 1; - } - - return str; -} - -template -static std::string encode_with_line_breaks(String s) { - return insert_linebreaks(base64_encode(s, false), line_length); -} - -template -static std::string encode_pem(String s) { - return encode_with_line_breaks(s); -} - -template -static std::string encode_mime(String s) { - return encode_with_line_breaks(s); -} - -template -static std::string encode(String s, bool url) { - return base64_encode(reinterpret_cast(s.data()), - s.length(), url); -} - -std::string base64_encode(unsigned char const* bytes_to_encode, size_t in_len, - bool url) { - size_t len_encoded = (in_len + 2) / 3 * 4; - - unsigned char trailing_char = url ? '.' : '='; - - // - // Choose set of base64 characters. They differ - // for the last two positions, depending on the url - // parameter. - // A bool (as is the parameter url) is guaranteed - // to evaluate to either 0 or 1 in C++ therefore, - // the correct character set is chosen by subscripting - // base64_chars with url. - // - const char* base64_chars_ = base64_chars[url]; - - std::string ret; - ret.reserve(len_encoded); - - unsigned int pos = 0; - - while (pos < in_len) { - ret.push_back(base64_chars_[(bytes_to_encode[pos + 0] & 0xfc) >> 2]); - - if (pos + 1 < in_len) { - ret.push_back( - base64_chars_[((bytes_to_encode[pos + 0] & 0x03) << 4) + - ((bytes_to_encode[pos + 1] & 0xf0) >> 4)]); - - if (pos + 2 < in_len) { - ret.push_back( - base64_chars_[((bytes_to_encode[pos + 1] & 0x0f) << 2) + - ((bytes_to_encode[pos + 2] & 0xc0) >> 6)]); - ret.push_back(base64_chars_[bytes_to_encode[pos + 2] & 0x3f]); - } else { - ret.push_back( - base64_chars_[(bytes_to_encode[pos + 1] & 0x0f) << 2]); - ret.push_back(trailing_char); - } - } else { - ret.push_back( - base64_chars_[(bytes_to_encode[pos + 0] & 0x03) << 4]); - ret.push_back(trailing_char); - ret.push_back(trailing_char); - } - - pos += 3; - } - - return ret; -} - -template -static std::string decode(String const& encoded_string, - bool remove_linebreaks) { - // - // decode(…) is templated so that it can be used with String = const - // std::string& or std::string_view (requires at least C++17) - // - - if (encoded_string.empty()) return std::string(); - - if (remove_linebreaks) { - std::string copy(encoded_string); - - copy.erase(std::remove(copy.begin(), copy.end(), '\n'), copy.end()); - - return base64_decode(copy, false); - } - - size_t length_of_string = encoded_string.length(); - size_t pos = 0; - - // - // The approximate length (bytes) of the decoded string might be one or - // two bytes smaller, depending on the amount of trailing equal signs - // in the encoded string. This approximation is needed to reserve - // enough space in the string to be returned. - // - size_t approx_length_of_decoded_string = length_of_string / 4 * 3; - std::string ret; - ret.reserve(approx_length_of_decoded_string); - - while (pos < length_of_string) { - // - // Iterate over encoded input string in chunks. The size of all - // chunks except the last one is 4 bytes. - // - // The last chunk might be padded with equal signs or dots - // in order to make it 4 bytes in size as well, but this - // is not required as per RFC 2045. - // - // All chunks except the last one produce three output bytes. - // - // The last chunk produces at least one and up to three bytes. - // - - size_t pos_of_char_1 = pos_of_char(encoded_string.at(pos + 1)); - - // - // Emit the first output byte that is produced in each chunk: - // - ret.push_back(static_cast( - ((pos_of_char(encoded_string.at(pos + 0))) << 2) + - ((pos_of_char_1 & 0x30) >> 4))); - - if ((pos + 2 < - length_of_string) && // Check for data that is not padded with - // equal signs (which is allowed by RFC 2045) - encoded_string.at(pos + 2) != '=' && - encoded_string.at(pos + 2) != - '.' // accept URL-safe base 64 strings, too, so check for '.' - // also. - ) { - // - // Emit a chunk's second byte (which might not be produced in the - // last chunk). - // - unsigned int pos_of_char_2 = - pos_of_char(encoded_string.at(pos + 2)); - ret.push_back(static_cast( - ((pos_of_char_1 & 0x0f) << 4) + ((pos_of_char_2 & 0x3c) >> 2))); - - if ((pos + 3 < length_of_string) && - encoded_string.at(pos + 3) != '=' && - encoded_string.at(pos + 3) != '.') { - // - // Emit a chunk's third byte (which might not be produced in the - // last chunk). - // - ret.push_back(static_cast( - ((pos_of_char_2 & 0x03) << 6) + - pos_of_char(encoded_string.at(pos + 3)))); - } - } - - pos += 4; - } - - return ret; -} - -std::string base64_decode(std::string const& s, bool remove_linebreaks) { - return decode(s, remove_linebreaks); -} - -std::string base64_encode(std::string const& s, bool url) { - return encode(s, url); -} - -std::string base64_encode_pem(std::string const& s) { return encode_pem(s); } - -std::string base64_encode_mime(std::string const& s) { return encode_mime(s); } - -#if __cplusplus >= 201703L -// -// Interface with std::string_view rather than const std::string& -// Requires C++17 -// Provided by Yannic Bonenberger (https://github.com/Yannic) -// - -std::string base64_encode(std::string_view s, bool url) { - return encode(s, url); -} - -std::string base64_encode_pem(std::string_view s) { return encode_pem(s); } - -std::string base64_encode_mime(std::string_view s) { return encode_mime(s); } - -std::string base64_decode(std::string_view s, bool remove_linebreaks) { - return decode(s, remove_linebreaks); -} - -#endif // __cplusplus >= 201703L diff --git a/targets/app/common/Leaderboards/base64.h b/targets/app/common/Leaderboards/base64.h deleted file mode 100644 index f09a92e66..000000000 --- a/targets/app/common/Leaderboards/base64.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// base64 encoding and decoding with C++. -// Version: 2.rc.09 (release candidate) -// - -#ifndef BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A -#define BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A - -#include - -#include - -#if __cplusplus >= 201703L -#include -#endif // __cplusplus >= 201703L - -std::string base64_encode(std::string const& s, bool url = false); -std::string base64_encode_pem(std::string const& s); -std::string base64_encode_mime(std::string const& s); - -std::string base64_decode(std::string const& s, bool remove_linebreaks = false); -std::string base64_encode(unsigned char const*, size_t len, bool url = false); - -#if __cplusplus >= 201703L -// -// Interface with std::string_view rather than const std::string& -// Requires C++17 -// Provided by Yannic Bonenberger (https://github.com/Yannic) -// -std::string base64_encode(std::string_view s, bool url = false); -std::string base64_encode_pem(std::string_view s); -std::string base64_encode_mime(std::string_view s); - -std::string base64_decode(std::string_view s, bool remove_linebreaks = false); -#endif // __cplusplus >= 201703L - -#endif /* BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A */ \ No newline at end of file From d9f2cb03c73b62b04de795a1cd9105d91f0f0b5c Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 18:00:30 -0500 Subject: [PATCH 10/15] nuke more unused stubs --- targets/app/common/stubs.cpp | 68 ------------------- targets/app/linux/linux_game_stubs.cpp | 8 --- .../client/renderer/GameRenderer.cpp | 3 - targets/platform/renderer/gl/GLRenderer.cpp | 8 --- targets/platform/stubs.h | 5 +- 5 files changed, 2 insertions(+), 90 deletions(-) delete mode 100644 targets/app/common/stubs.cpp delete mode 100644 targets/app/linux/linux_game_stubs.cpp diff --git a/targets/app/common/stubs.cpp b/targets/app/common/stubs.cpp deleted file mode 100644 index 85132ba4d..000000000 --- a/targets/app/common/stubs.cpp +++ /dev/null @@ -1,68 +0,0 @@ - -#include "platform/stubs.h" - -#include "app/linux/LinuxGame.h" -#if defined(__linux__) - -void LinuxLogStubLightmapProbe() { - static bool logged = false; - if (logged) return; - - logged = true; - app.DebugPrintf( - "[linux-lightmap] stubs.cpp: Linux excludes the no-op multitexture " - "stubs in this file; the runtime uses libGL/4jlibs symbols.\n"); -} - -#else - -void glReadPixels(int, int, int, int, int, int, ByteBuffer*) {} - -void glClearDepth(double) {} - -void glVertexPointer(int, int, int, int) {} - -void glVertexPointer(int, int, FloatBuffer*) {} - -void glTexCoordPointer(int, int, int, int) {} - -void glTexCoordPointer(int, int, FloatBuffer*) {} - -void glNormalPointer(int, int, int) {} - -void glNormalPointer(int, ByteBuffer*) {} - -void glEnableClientState(int) {} - -void glDisableClientState(int) {} - -void glColorPointer(int, int, int, int) {} - -void glColorPointer(int, bool, int, ByteBuffer*) {} - -void glDrawArrays(int, int, int) {} - -void glNormal3f(float, float, float) {} - -void glGenQueriesARB(IntBuffer*) {} - -void glBeginQueryARB(int, int) {} - -void glEndQueryARB(int) {} - -void glGetQueryObjectuARB(int, int, IntBuffer*) {} - -void glShadeModel(int) {} - -void glColorMaterial(int, int) {} - -// 1.8.2 -void glClientActiveTexture(int) {} - -void glActiveTexture(int) {} - -void glFlush() {} - -void glTexGeni(int, int, int) {} - -#endif diff --git a/targets/app/linux/linux_game_stubs.cpp b/targets/app/linux/linux_game_stubs.cpp deleted file mode 100644 index 6bd332517..000000000 --- a/targets/app/linux/linux_game_stubs.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifdef __linux__ - -#include "app/common/Game.h" -#include "platform/stubs.h" - -void Display::update() {} - -#endif diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index b1ddd5f7d..7bbbc69a2 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -802,7 +802,6 @@ void GameRenderer::turnOffLightLayer(double alpha) { // 4J - TODO FRAME_PROFILE_SCOPE(Lightmap); #if defined(__linux__) if (SharedConstants::TEXTURE_LIGHTING) { - LinuxLogStubLightmapProbe(); PlatformRenderer.TextureBindVertex(-1); } #else @@ -830,7 +829,6 @@ void GameRenderer::turnOnLightLayer( #if defined(__linux__) if (!SharedConstants::TEXTURE_LIGHTING) return; - LinuxLogStubLightmapProbe(); const int textureId = getLightTexture(mc->player->GetXboxPad(), mc->level); static int logCount = 0; @@ -841,7 +839,6 @@ void GameRenderer::turnOnLightLayer( } PlatformRenderer.TextureBindVertex(textureId, scaleLight); - LinuxGLLogLightmapState("turnOnLightLayer", textureId, scaleLight); #else // 4jcraft: update light texture // todo: check implementation of getLightTexture. diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index 6943130be..a8e87049d 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -1626,11 +1626,3 @@ void glGetQueryObjectuARB_4J(int id, int pname, IntBuffer* params) { void glGetFloat(int pname, FloatBuffer* params) { glGetFloat_4J(pname, params); } -void LinuxGLLogLightmapState(const char* stage, int textureId, - bool scaleLight) { - static int logCount = 0; - if (logCount >= 16) return; - ++logCount; - fprintf(stderr, "[linux-lightmap] %s tex=%d scale=%d\n", stage, textureId, - scaleLight ? 1 : 0); -} \ No newline at end of file diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index 68788082c..c9ba7f71b 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -1,6 +1,7 @@ #pragma once #include + #ifdef __linux__ #include #include @@ -39,8 +40,6 @@ void glEndQueryARB(int); void glGetQueryObjectuARB(int, int, IntBuffer*); void glReadPixels(int, int, int, int, int, int, ByteBuffer*); -void LinuxGLLogLightmapState(const char* stage, int textureId, bool scaleLight); -void LinuxLogStubLightmapProbe(); #else const int GL_BYTE = 0; @@ -289,7 +288,7 @@ public: class Display { public: static bool isActive() { return true; } - static void update(); + static void update() {} static void swapBuffers(); static void destroy() {} }; From 559b207ee258ac67fa27531d054d213e989cd57b Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 18:05:45 -0500 Subject: [PATCH 11/15] nuke d3d11_stubs --- targets/app/common/DLCController.cpp | 1 + targets/app/common/UI/UIController.h | 14 +++- targets/app/linux/Stubs/LinuxStubs.h | 1 - targets/app/linux/Stubs/d3d11_stubs.h | 112 +++++++++++++------------- 4 files changed, 69 insertions(+), 59 deletions(-) diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index 7965ef4c9..093186e82 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -6,6 +6,7 @@ #include "app/common/DLC/DLCSkinFile.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index 877369a99..ad2ff44a3 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -11,11 +11,12 @@ #include "util/Timer.h" #ifdef __linux__ + #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/Stubs/d3d11_stubs.h" + #elif defined(_WINDOWS64) #include "app/windows/Iggy/include/iggy.h" #endif @@ -41,6 +42,15 @@ class C4JThread; class Tutorial; class UIScene; +// 4jcraft, used to be D3D11_RECT. +// This was the only class that used it, so it's here now. +struct RECT { + long left; + long top; + long right; + long bottom; +}; + // Base class for all shared functions between UIControllers class UIController : public IUIController { public: @@ -187,7 +197,7 @@ private: int m_accumulatedTicks; uint64_t m_lastUiSfx; // Tracks time (ms) of last UI sound effect - D3D11_RECT m_customRenderingClearRect; + RECT m_customRenderingClearRect; std::unordered_map m_registeredCallbackScenes; // A collection of scenes and unique id's diff --git a/targets/app/linux/Stubs/LinuxStubs.h b/targets/app/linux/Stubs/LinuxStubs.h index 26c563bdb..7ed4032d3 100644 --- a/targets/app/linux/Stubs/LinuxStubs.h +++ b/targets/app/linux/Stubs/LinuxStubs.h @@ -2,7 +2,6 @@ #define STUBS_H #pragma once -#include "d3d11_stubs.h" #include "winapi_stubs.h" #ifndef _ENABLEIGGY #include "iggy_stubs.h" diff --git a/targets/app/linux/Stubs/d3d11_stubs.h b/targets/app/linux/Stubs/d3d11_stubs.h index a2f38881d..938e223b4 100644 --- a/targets/app/linux/Stubs/d3d11_stubs.h +++ b/targets/app/linux/Stubs/d3d11_stubs.h @@ -1,64 +1,64 @@ -#ifndef D3D11STUBS_H -#define D3D11STUBS_H +// #ifndef D3D11STUBS_H +// #define D3D11STUBS_H -#pragma once +// #pragma once -#include "winapi_stubs.h" +// #include "winapi_stubs.h" -typedef struct _RECT { - LONG left; - LONG top; - LONG right; - LONG bottom; -} RECT, *PRECT; +// typedef struct _RECT { +// LONG left; +// LONG top; +// LONG right; +// LONG bottom; +// } RECT, *PRECT; -// stole- i mean borrowed from OrbisStubs.h -typedef void ID3D11Device; -typedef void ID3D11DeviceContext; -typedef void IDXGISwapChain; -typedef RECT D3D11_RECT; -typedef void ID3D11RenderTargetView; -typedef void ID3D11DepthStencilView; -typedef void ID3D11Buffer; -// typedef DWORD (*PTHREAD_START_ROUTINE)( void* lpThreadParameter); -// typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; +// // stole- i mean borrowed from OrbisStubs.h +// typedef void ID3D11Device; +// typedef void ID3D11DeviceContext; +// typedef void IDXGISwapChain; +// typedef RECT D3D11_RECT; +// typedef void ID3D11RenderTargetView; +// typedef void ID3D11DepthStencilView; +// typedef void ID3D11Buffer; +// // typedef DWORD (*PTHREAD_START_ROUTINE)( void* lpThreadParameter); +// // typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; -// Used only by windows/durango gdraw and UIController. Will be unnecessary once -// we have our own UIController stubs. -typedef void ID3D11ShaderResourceView; -typedef void ID3D11Resource; -typedef void ID3D11Texture2D; -typedef void D3D11_TEXTURE2D_DESC; +// // Used only by windows/durango gdraw and UIController. Will be unnecessary once +// // we have our own UIController stubs. +// typedef void ID3D11ShaderResourceView; +// typedef void ID3D11Resource; +// typedef void ID3D11Texture2D; +// typedef void D3D11_TEXTURE2D_DESC; -enum D3D11_BLEND { - D3D11_BLEND_ZERO = 1, - D3D11_BLEND_ONE = 2, - D3D11_BLEND_SRC_COLOR = 3, - D3D11_BLEND_INV_SRC_COLOR = 4, - D3D11_BLEND_SRC_ALPHA = 5, - D3D11_BLEND_INV_SRC_ALPHA = 6, - D3D11_BLEND_DEST_ALPHA = 7, - D3D11_BLEND_INV_DEST_ALPHA = 8, - D3D11_BLEND_DEST_COLOR = 9, - D3D11_BLEND_INV_DEST_COLOR = 10, - D3D11_BLEND_SRC_ALPHA_SAT = 11, - D3D11_BLEND_BLEND_FACTOR = 14, - D3D11_BLEND_INV_BLEND_FACTOR = 15, - D3D11_BLEND_SRC1_COLOR = 16, - D3D11_BLEND_INV_SRC1_COLOR = 17, - D3D11_BLEND_SRC1_ALPHA = 18, - D3D11_BLEND_INV_SRC1_ALPHA = 19 -}; +// enum D3D11_BLEND { +// D3D11_BLEND_ZERO = 1, +// D3D11_BLEND_ONE = 2, +// D3D11_BLEND_SRC_COLOR = 3, +// D3D11_BLEND_INV_SRC_COLOR = 4, +// D3D11_BLEND_SRC_ALPHA = 5, +// D3D11_BLEND_INV_SRC_ALPHA = 6, +// D3D11_BLEND_DEST_ALPHA = 7, +// D3D11_BLEND_INV_DEST_ALPHA = 8, +// D3D11_BLEND_DEST_COLOR = 9, +// D3D11_BLEND_INV_DEST_COLOR = 10, +// D3D11_BLEND_SRC_ALPHA_SAT = 11, +// D3D11_BLEND_BLEND_FACTOR = 14, +// D3D11_BLEND_INV_BLEND_FACTOR = 15, +// D3D11_BLEND_SRC1_COLOR = 16, +// D3D11_BLEND_INV_SRC1_COLOR = 17, +// D3D11_BLEND_SRC1_ALPHA = 18, +// D3D11_BLEND_INV_SRC1_ALPHA = 19 +// }; -enum D3D11_COMPARISON_FUNC { - D3D11_COMPARISON_NEVER = 1, - D3D11_COMPARISON_LESS = 2, - D3D11_COMPARISON_EQUAL = 3, - D3D11_COMPARISON_LESS_EQUAL = 4, - D3D11_COMPARISON_GREATER = 5, - D3D11_COMPARISON_NOT_EQUAL = 6, - D3D11_COMPARISON_GREATER_EQUAL = 7, - D3D11_COMPARISON_ALWAYS = 8 -}; +// enum D3D11_COMPARISON_FUNC { +// D3D11_COMPARISON_NEVER = 1, +// D3D11_COMPARISON_LESS = 2, +// D3D11_COMPARISON_EQUAL = 3, +// D3D11_COMPARISON_LESS_EQUAL = 4, +// D3D11_COMPARISON_GREATER = 5, +// D3D11_COMPARISON_NOT_EQUAL = 6, +// D3D11_COMPARISON_GREATER_EQUAL = 7, +// D3D11_COMPARISON_ALWAYS = 8 +// }; -#endif // D3D11STUBS_H +// #endif // D3D11STUBS_H From 0e6a6cc537ebbbe06d410b5c7583de122b9697b0 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 18:18:46 -0500 Subject: [PATCH 12/15] nuke a ton of winapi stubs --- targets/app/linux/Stubs/d3d11_stubs.h | 64 ---- targets/app/linux/Stubs/winapi_stubs.h | 462 +------------------------ 2 files changed, 1 insertion(+), 525 deletions(-) delete mode 100644 targets/app/linux/Stubs/d3d11_stubs.h diff --git a/targets/app/linux/Stubs/d3d11_stubs.h b/targets/app/linux/Stubs/d3d11_stubs.h deleted file mode 100644 index 938e223b4..000000000 --- a/targets/app/linux/Stubs/d3d11_stubs.h +++ /dev/null @@ -1,64 +0,0 @@ -// #ifndef D3D11STUBS_H -// #define D3D11STUBS_H - -// #pragma once - -// #include "winapi_stubs.h" - -// typedef struct _RECT { -// LONG left; -// LONG top; -// LONG right; -// LONG bottom; -// } RECT, *PRECT; - -// // stole- i mean borrowed from OrbisStubs.h -// typedef void ID3D11Device; -// typedef void ID3D11DeviceContext; -// typedef void IDXGISwapChain; -// typedef RECT D3D11_RECT; -// typedef void ID3D11RenderTargetView; -// typedef void ID3D11DepthStencilView; -// typedef void ID3D11Buffer; -// // typedef DWORD (*PTHREAD_START_ROUTINE)( void* lpThreadParameter); -// // typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; - -// // Used only by windows/durango gdraw and UIController. Will be unnecessary once -// // we have our own UIController stubs. -// typedef void ID3D11ShaderResourceView; -// typedef void ID3D11Resource; -// typedef void ID3D11Texture2D; -// typedef void D3D11_TEXTURE2D_DESC; - -// enum D3D11_BLEND { -// D3D11_BLEND_ZERO = 1, -// D3D11_BLEND_ONE = 2, -// D3D11_BLEND_SRC_COLOR = 3, -// D3D11_BLEND_INV_SRC_COLOR = 4, -// D3D11_BLEND_SRC_ALPHA = 5, -// D3D11_BLEND_INV_SRC_ALPHA = 6, -// D3D11_BLEND_DEST_ALPHA = 7, -// D3D11_BLEND_INV_DEST_ALPHA = 8, -// D3D11_BLEND_DEST_COLOR = 9, -// D3D11_BLEND_INV_DEST_COLOR = 10, -// D3D11_BLEND_SRC_ALPHA_SAT = 11, -// D3D11_BLEND_BLEND_FACTOR = 14, -// D3D11_BLEND_INV_BLEND_FACTOR = 15, -// D3D11_BLEND_SRC1_COLOR = 16, -// D3D11_BLEND_INV_SRC1_COLOR = 17, -// D3D11_BLEND_SRC1_ALPHA = 18, -// D3D11_BLEND_INV_SRC1_ALPHA = 19 -// }; - -// enum D3D11_COMPARISON_FUNC { -// D3D11_COMPARISON_NEVER = 1, -// D3D11_COMPARISON_LESS = 2, -// D3D11_COMPARISON_EQUAL = 3, -// D3D11_COMPARISON_LESS_EQUAL = 4, -// D3D11_COMPARISON_GREATER = 5, -// D3D11_COMPARISON_NOT_EQUAL = 6, -// D3D11_COMPARISON_GREATER_EQUAL = 7, -// D3D11_COMPARISON_ALWAYS = 8 -// }; - -// #endif // D3D11STUBS_H diff --git a/targets/app/linux/Stubs/winapi_stubs.h b/targets/app/linux/Stubs/winapi_stubs.h index 94bffbd05..49d8e34c9 100644 --- a/targets/app/linux/Stubs/winapi_stubs.h +++ b/targets/app/linux/Stubs/winapi_stubs.h @@ -62,102 +62,10 @@ typedef float FLOAT; #define ERROR_IO_PENDING 997L // dderror #define ERROR_CANCELLED 1223L -#define INFINITE 0xFFFFFFFF // Infinite timeout - -#define PAGE_READWRITE 0x04 -#define MEM_LARGE_PAGES 0x20000000 -#define MAXULONG_PTR ((ULONG_PTR)~0UL) -#define MAX_PATH 260 - -#define GENERIC_READ 0x80000000UL -#define GENERIC_WRITE 0x40000000UL -#define GENERIC_EXECUTE 0x20000000UL -#define GENERIC_ALL 0x10000000UL - -#define FILE_SHARE_READ 0x00000001 -#define FILE_SHARE_WRITE 0x00000002 -#define FILE_SHARE_DELETE 0x00000004 - -#define CREATE_NEW 1 -#define CREATE_ALWAYS 2 -#define OPEN_EXISTING 3 -#define OPEN_ALWAYS 4 -#define TRUNCATE_EXISTING 5 -#define WAIT_TIMEOUT 258 - -#define FILE_FLAG_WRITE_THROUGH 0x80000000 -#define FILE_FLAG_OVERLAPPED 0x40000000 -#define FILE_FLAG_NO_BUFFERING 0x20000000 -#define FILE_FLAG_RANDOM_ACCESS 0x10000000 -#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000 -#define FILE_FLAG_DELETE_ON_CLOSE 0x04000000 -#define FILE_FLAG_BACKUP_SEMANTICS 0x02000000 - -#define FILE_ATTRIBUTE_READONLY 0x00000001 -#define FILE_ATTRIBUTE_HIDDEN 0x00000002 -#define FILE_ATTRIBUTE_SYSTEM 0x00000004 -#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 -#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 -#define FILE_ATTRIBUTE_NORMAL 0x00000080 -#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 -#define INVALID_FILE_ATTRIBUTES ((DWORD) - 1) -#define INVALID_FILE_SIZE ((DWORD) - 1) -#define INVALID_SET_FILE_POINTER ((DWORD) - 1) - -#define FILE_BEGIN SEEK_SET -#define FILE_CURRENT SEEK_CUR -#define FILE_END SEEK_END - -#define PAGE_NOACCESS 0x01 -#define PAGE_READONLY 0x02 -#define PAGE_READWRITE 0x04 -#define PAGE_WRITECOPY 0x08 -#define PAGE_EXECUTE 0x10 -#define PAGE_EXECUTE_READ 0x20 -#define PAGE_EXECUTE_READWRITE 0x40 -#define PAGE_EXECUTE_WRITECOPY 0x80 -#define PAGE_GUARD 0x100 -#define PAGE_NOCACHE 0x200 -#define PAGE_WRITECOMBINE 0x400 -#define PAGE_USER_READONLY 0x1000 -#define PAGE_USER_READWRITE 0x2000 #define MEM_COMMIT 0x1000 #define MEM_RESERVE 0x2000 #define MEM_DECOMMIT 0x4000 -#define MEM_RELEASE 0x8000 -#define MEM_FREE 0x10000 -#define MEM_PRIVATE 0x20000 -#define MEM_RESET 0x80000 -#define MEM_TOP_DOWN 0x100000 -#define MEM_NOZERO 0x800000 -#define MEM_LARGE_PAGES 0x20000000 -#define MEM_HEAP 0x40000000 -#define MEM_16MB_PAGES 0x80000000 - -#define THREAD_BASE_PRIORITY_LOWRT \ - 15 // value that gets a thread to LowRealtime-1 -#define THREAD_BASE_PRIORITY_MAX 2 // maximum thread base priority boost -#define THREAD_BASE_PRIORITY_MIN -2 // minimum thread base priority boost -#define THREAD_BASE_PRIORITY_IDLE -15 // value that gets a thread to idle - -#define THREAD_PRIORITY_LOWEST THREAD_BASE_PRIORITY_MIN -#define THREAD_PRIORITY_BELOW_NORMAL (THREAD_PRIORITY_LOWEST + 1) -#define THREAD_PRIORITY_NORMAL 0 -#define THREAD_PRIORITY_HIGHEST THREAD_BASE_PRIORITY_MAX -#define THREAD_PRIORITY_ABOVE_NORMAL (THREAD_PRIORITY_HIGHEST - 1) -#define THREAD_PRIORITY_ERROR_RETURN (MAXLONG) - -#define THREAD_PRIORITY_TIME_CRITICAL THREAD_BASE_PRIORITY_LOWRT -#define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE - -#define IGNORE 0 // Ignore signal -#define INFINITE 0xFFFFFFFF // Infinite timeout -#define STATUS_WAIT_0 ((DWORD)0x00000000L) -#define WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0) -#define STATUS_PENDING ((DWORD)0x00000103L) -#define STILL_ACTIVE STATUS_PENDING - -#define INVALID_HANDLE_VALUE ((HANDLE)(ULONG_PTR) - 1) +#define PAGE_READWRITE 0x04 // https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime typedef struct _FILETIME { @@ -255,110 +163,6 @@ static inline FILETIME _TimeToFileTime(time_t t) { return ft; } -static inline HANDLE CreateFileA(const char* lpFileName, DWORD dwDesiredAccess, - DWORD dwShareMode, void* lpSecurityAttributes, - DWORD dwCreationDisposition, - DWORD dwFlagsAndAttributes, - HANDLE hTemplateFile) { - int flags = 0; - if ((dwDesiredAccess & GENERIC_READ) && (dwDesiredAccess & GENERIC_WRITE)) - flags = O_RDWR; - else if (dwDesiredAccess & GENERIC_WRITE) - flags = O_WRONLY; - else - flags = O_RDONLY; - - switch (dwCreationDisposition) { - case CREATE_NEW: - flags |= O_CREAT | O_EXCL; - break; - case CREATE_ALWAYS: - flags |= O_CREAT | O_TRUNC; - break; - case OPEN_EXISTING: - break; - case OPEN_ALWAYS: - flags |= O_CREAT; - break; - case TRUNCATE_EXISTING: - flags |= O_TRUNC; - break; - } - - int fd = open(lpFileName, flags, 0644); - return fd == -1 ? INVALID_HANDLE_VALUE : (HANDLE)(intptr_t)fd; -} - -static inline HANDLE CreateFileW(const wchar_t* lpFileName, - DWORD dwDesiredAccess, DWORD dwShareMode, - void* lpSecurityAttributes, - DWORD dwCreationDisposition, - DWORD dwFlagsAndAttributes, - HANDLE hTemplateFile) { - char narrowBuf[1024]; - wcstombs(narrowBuf, lpFileName, sizeof(narrowBuf)); - narrowBuf[sizeof(narrowBuf) - 1] = '\0'; - return CreateFileA(narrowBuf, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, - dwFlagsAndAttributes, hTemplateFile); -} - -static inline HANDLE CreateFile(const char* lpFileName, DWORD dwDesiredAccess, - DWORD dwShareMode, void* lpSecurityAttributes, - DWORD dwCreationDisposition, - DWORD dwFlagsAndAttributes, - HANDLE hTemplateFile) { - return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, - dwFlagsAndAttributes, hTemplateFile); -} - -static inline HANDLE CreateFile(const wchar_t* lpFileName, - DWORD dwDesiredAccess, DWORD dwShareMode, - void* lpSecurityAttributes, - DWORD dwCreationDisposition, - DWORD dwFlagsAndAttributes, - HANDLE hTemplateFile) { - return CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, - dwFlagsAndAttributes, hTemplateFile); -} - -static inline bool CloseHandle(HANDLE hObject) { - if (hObject == INVALID_HANDLE_VALUE) return false; - return close((int)(intptr_t)hObject) == 0; -} - -static inline DWORD GetFileSize(HANDLE hFile, DWORD* lpFileSizeHigh) { - struct stat st{}; - if (fstat((int)(intptr_t)hFile, &st) != 0) { - if (lpFileSizeHigh) *lpFileSizeHigh = 0; - return INVALID_FILE_SIZE; - } - if (lpFileSizeHigh) - *lpFileSizeHigh = (DWORD)((st.st_size >> 32) & 0xFFFFFFFF); - return (DWORD)(st.st_size & 0xFFFFFFFF); -} - -static inline bool GetFileSizeEx(HANDLE hFile, LARGE_INTEGER* lpFileSize) { - struct stat st{}; - if (fstat((int)(intptr_t)hFile, &st) != 0) return false; - if (lpFileSize) { - lpFileSize->QuadPart = st.st_size; - lpFileSize->LowPart = (DWORD)(st.st_size & 0xFFFFFFFF); - lpFileSize->HighPart = (LONG)(st.st_size >> 32); - } - return true; -} - -static inline bool ReadFile(HANDLE hFile, void* lpBuffer, - DWORD nNumberOfBytesToRead, - DWORD* lpNumberOfBytesRead, void* lpOverlapped) { - ssize_t n = read((int)(intptr_t)hFile, lpBuffer, nNumberOfBytesToRead); - if (lpNumberOfBytesRead) *lpNumberOfBytesRead = n >= 0 ? (DWORD)n : 0; - return n >= 0; -} - // internal helper: convert FILETIME (100ns since 1601) to time_t (seconds since // 1970) static inline time_t _FileTimeToTimeT(const FILETIME& ft) { @@ -433,268 +237,6 @@ static inline void OutputDebugString(const char* lpOutputString) { return OutputDebugStringA(lpOutputString); } -typedef struct { - pthread_mutex_t mutex; - pthread_cond_t cond; - int signaled; - int manual_reset; -} Event; - -static inline HANDLE CreateEvent(int manual_reset, int initial_state) { - Event* ev = (Event*)malloc(sizeof(Event)); - pthread_mutex_init(&ev->mutex, nullptr); - pthread_cond_init(&ev->cond, nullptr); - ev->signaled = initial_state; - ev->manual_reset = manual_reset; - return (HANDLE)ev; -} - -static inline HANDLE CreateEvent(void*, bool manual_reset, bool initial_state, - void*) { - return CreateEvent(manual_reset, initial_state); -} - -static inline bool SetEvent(HANDLE hEvent) { - Event* ev = (Event*)hEvent; - if (!ev) return false; - pthread_mutex_lock(&ev->mutex); - ev->signaled = 1; - if (ev->manual_reset) - pthread_cond_broadcast(&ev->cond); - else - pthread_cond_signal(&ev->cond); - pthread_mutex_unlock(&ev->mutex); - return true; -} - -static inline bool ResetEvent(HANDLE hEvent) { - Event* ev = (Event*)hEvent; - if (!ev) return false; - pthread_mutex_lock(&ev->mutex); - ev->signaled = 0; - pthread_mutex_unlock(&ev->mutex); - return true; -} - -#define WAIT_FAILED ((DWORD)0xFFFFFFFF) -#define INFINITE 0xFFFFFFFF -#define HANDLE_TYPE_THREAD 0x54485200 - -static inline DWORD _WaitForEvent(Event* ev, DWORD dwMilliseconds) { - pthread_mutex_lock(&ev->mutex); - if (dwMilliseconds == INFINITE) { - while (!ev->signaled) pthread_cond_wait(&ev->cond, &ev->mutex); - } else if (dwMilliseconds > 0) { - struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += dwMilliseconds / 1000; - ts.tv_nsec += (dwMilliseconds % 1000) * 1000000; - if (ts.tv_nsec >= 1000000000) { - ts.tv_sec++; - ts.tv_nsec -= 1000000000; - } - while (!ev->signaled) { - if (pthread_cond_timedwait(&ev->cond, &ev->mutex, &ts) != 0) { - pthread_mutex_unlock(&ev->mutex); - return WAIT_TIMEOUT; - } - } - } else { - if (!ev->signaled) { - pthread_mutex_unlock(&ev->mutex); - return WAIT_TIMEOUT; - } - } - if (!ev->manual_reset) ev->signaled = 0; - pthread_mutex_unlock(&ev->mutex); - return WAIT_OBJECT_0; -} - -struct LinuxThread; -static inline DWORD _WaitForThread(struct LinuxThread* lt, - DWORD dwMilliseconds); - -static inline DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds) { - if (!hHandle) return WAIT_FAILED; - // Check if this is a thread handle (LinuxThread has magic number as first - // field) - if (*(int*)hHandle == HANDLE_TYPE_THREAD) { - return _WaitForThread((struct LinuxThread*)hHandle, dwMilliseconds); - } - return _WaitForEvent((Event*)hHandle, dwMilliseconds); -} - -static inline DWORD WaitForMultipleObjects(DWORD nCount, - const HANDLE* lpHandles, - bool bWaitAll, - DWORD dwMilliseconds) { - if (bWaitAll) { - for (DWORD i = 0; i < nCount; i++) - WaitForSingleObject(lpHandles[i], dwMilliseconds); - return WAIT_OBJECT_0; - } - for (int pass = 0; pass < 1000; pass++) { - for (DWORD i = 0; i < nCount; i++) { - if (WaitForSingleObject(lpHandles[i], 0) == WAIT_OBJECT_0) - return WAIT_OBJECT_0 + i; - } - usleep(1000); - } - return WAIT_TIMEOUT; -} - -static inline void CloseHandle_Event(HANDLE hEvent) { - Event* ev = (Event*)hEvent; - if (!ev) return; - pthread_mutex_destroy(&ev->mutex); - pthread_cond_destroy(&ev->cond); - free(ev); -} - -#define CREATE_SUSPENDED 0x00000004 - -typedef DWORD (*LPTHREAD_START_ROUTINE)(void*); - -struct LinuxThread { - int handleType; - pthread_t thread; - LPTHREAD_START_ROUTINE func; - void* param; - DWORD threadId; - DWORD exitCode; - int suspended; - pthread_mutex_t suspendMutex; - pthread_cond_t suspendCond; - pthread_mutex_t completionMutex; - pthread_cond_t completionCond; - int completed; -}; - -static inline void* _linux_thread_entry(void* arg) { - LinuxThread* lt = (LinuxThread*)arg; - pthread_mutex_lock(<->suspendMutex); - while (lt->suspended) - pthread_cond_wait(<->suspendCond, <->suspendMutex); - pthread_mutex_unlock(<->suspendMutex); - lt->exitCode = lt->func(lt->param); - // Signal completion - pthread_mutex_lock(<->completionMutex); - lt->completed = 1; - pthread_cond_broadcast(<->completionCond); - pthread_mutex_unlock(<->completionMutex); - return nullptr; -} - -static inline DWORD _WaitForThread(struct LinuxThread* lt, - DWORD dwMilliseconds) { - pthread_mutex_lock(<->completionMutex); - if (lt->completed) { - pthread_mutex_unlock(<->completionMutex); - return WAIT_OBJECT_0; - } - if (dwMilliseconds == 0) { - pthread_mutex_unlock(<->completionMutex); - return WAIT_TIMEOUT; - } - if (dwMilliseconds == INFINITE) { - while (!lt->completed) - pthread_cond_wait(<->completionCond, <->completionMutex); - } else { - struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += dwMilliseconds / 1000; - ts.tv_nsec += (dwMilliseconds % 1000) * 1000000; - if (ts.tv_nsec >= 1000000000) { - ts.tv_sec++; - ts.tv_nsec -= 1000000000; - } - while (!lt->completed) { - if (pthread_cond_timedwait(<->completionCond, - <->completionMutex, &ts) != 0) { - pthread_mutex_unlock(<->completionMutex); - return WAIT_TIMEOUT; - } - } - } - pthread_mutex_unlock(<->completionMutex); - return WAIT_OBJECT_0; -} - -static DWORD g_nextThreadId = 1000; - -static inline HANDLE CreateThread(void*, size_t stackSize, - LPTHREAD_START_ROUTINE lpStartAddress, - void* lpParameter, DWORD dwCreationFlags, - DWORD* lpThreadId) { - LinuxThread* lt = (LinuxThread*)calloc(1, sizeof(LinuxThread)); - lt->handleType = HANDLE_TYPE_THREAD; - lt->func = lpStartAddress; - lt->param = lpParameter; - lt->exitCode = STILL_ACTIVE; - lt->suspended = (dwCreationFlags & CREATE_SUSPENDED) ? 1 : 0; - lt->completed = 0; - lt->threadId = __sync_fetch_and_add(&g_nextThreadId, 1); - pthread_mutex_init(<->suspendMutex, nullptr); - pthread_cond_init(<->suspendCond, nullptr); - pthread_mutex_init(<->completionMutex, nullptr); - pthread_cond_init(<->completionCond, nullptr); - if (lpThreadId) *lpThreadId = lt->threadId; - pthread_attr_t attr; - pthread_attr_init(&attr); - if (stackSize > 0) pthread_attr_setstacksize(&attr, stackSize); - pthread_create(<->thread, &attr, _linux_thread_entry, lt); - pthread_attr_destroy(&attr); - return (HANDLE)lt; -} - -static inline DWORD ResumeThread(HANDLE hThread) { - LinuxThread* lt = (LinuxThread*)hThread; - if (!lt) return (DWORD)-1; - pthread_mutex_lock(<->suspendMutex); - lt->suspended = 0; - pthread_cond_signal(<->suspendCond); - pthread_mutex_unlock(<->suspendMutex); - return 0; -} - -static inline bool SetThreadPriority(HANDLE hThread, int nPriority) { - (void)hThread; - (void)nPriority; - return true; -} - -static inline bool GetExitCodeThread(HANDLE hThread, DWORD* lpExitCode) { - LinuxThread* lt = (LinuxThread*)hThread; - if (!lt || !lpExitCode) return false; - *lpExitCode = lt->exitCode; - return true; -} - -static inline DWORD GetCurrentThreadId() { - return (DWORD)(unsigned long)pthread_self(); -} - -static inline HANDLE GetCurrentThread() { - return (HANDLE)(unsigned long)pthread_self(); -} - -template -static inline int swprintf_s(wchar_t (&buf)[N], const wchar_t* fmt, ...) { - va_list args; - va_start(args, fmt); - int ret = vswprintf(buf, N, fmt, args); - va_end(args); - return ret; -} - -static inline int swprintf_s(wchar_t* buf, size_t sz, const wchar_t* fmt, ...) { - va_list args; - va_start(args, fmt); - int ret = vswprintf(buf, sz, fmt, args); - va_end(args); - return ret; -} - static inline HMODULE GetModuleHandle(const char* lpModuleName) { return 0; } static inline void* VirtualAlloc(void* lpAddress, size_t dwSize, @@ -735,6 +277,4 @@ static inline bool VirtualFree(void* lpAddress, size_t dwSize, return true; } -#define _wcsicmp wcscasecmp - #endif // WINAPISTUBS_H From 4a365e19f28dd13366434f33085bf3e625e9de29 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 18:35:43 -0500 Subject: [PATCH 13/15] nuke a ton of winapi garbage --- targets/app/common/Game.cpp | 4 +- targets/app/common/NetworkController.cpp | 32 ++--- .../All Platforms/IUIScene_CraftingMenu.cpp | 13 +- .../UI/Scenes/Debug/UIScene_DebugOptions.cpp | 2 +- targets/app/linux/Stubs/winapi_stubs.h | 122 +++--------------- .../level/chunk/CompressedTileStorage.cpp | 9 +- .../level/tile/entity/SignTileEntity.cpp | 12 +- 7 files changed, 51 insertions(+), 143 deletions(-) diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 752016d29..a17dccfcb 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -156,7 +156,7 @@ void Game::DebugPrintf(const char* szFormat, ...) { va_start(ap, szFormat); vsnprintf(buf, sizeof(buf), szFormat, ap); va_end(ap); - OutputDebugStringA(buf); + fputs(buf, stderr); #endif } @@ -168,7 +168,7 @@ void Game::DebugPrintf(int user, const char* szFormat, ...) { va_start(ap, szFormat); vsnprintf(buf, sizeof(buf), szFormat, ap); va_end(ap); - OutputDebugStringA(buf); + fputs(buf, stderr); if (user == USER_UI) { ui.logDebugString(buf); } diff --git a/targets/app/common/NetworkController.cpp b/targets/app/common/NetworkController.cpp index 295079fdb..257bef7da 100644 --- a/targets/app/common/NetworkController.cpp +++ b/targets/app/common/NetworkController.cpp @@ -1,5 +1,9 @@ #include "app/common/NetworkController.h" +#include +#include +#include + #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" @@ -13,18 +17,10 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" -#include "minecraft/stats/StatsCounter.h" -#include "minecraft/world/entity/player/Player.h" -#include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" -#include "app/common/Audio/SoundEngine.h" - -#include -#include -#include unsigned int NetworkController::m_uiLastSignInData = 0; @@ -39,9 +35,8 @@ NetworkController::NetworkController() { memset(m_playerGamePrivileges, 0, sizeof(m_playerGamePrivileges)); for (int i = 0; i < XUSER_MAX_COUNT; i++) { - if (FAILED(XUserGetSigninInfo(i, - XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, - &m_currentSigninInfo[i]))) { + if (XUserGetSigninInfo(i, XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, + &m_currentSigninInfo[i]) < 0) { m_currentSigninInfo[i].xuid = INVALID_XUID; m_currentSigninInfo[i].dwGuestNumber = 0; } @@ -308,12 +303,11 @@ void NetworkController::signInChangeCallback(void* pParam, if (bPlayerChanged && (!bPlayerSignedIn || - (bPlayerSignedIn && - !PlatformProfile.AreXUIDSEqual( - pApp->m_networkController - .m_currentSigninInfo[i] - .xuid, - info.xuid)))) { + (bPlayerSignedIn && !PlatformProfile.AreXUIDSEqual( + pApp->m_networkController + .m_currentSigninInfo[i] + .xuid, + info.xuid)))) { pApp->DebugPrintf( "Player at index %d Left - invalidating their " "banned list\n", @@ -355,9 +349,9 @@ void NetworkController::signInChangeCallback(void* pParam, } for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (FAILED(XUserGetSigninInfo( + if (XUserGetSigninInfo( i, XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY, - &pApp->m_networkController.m_currentSigninInfo[i]))) { + &pApp->m_networkController.m_currentSigninInfo[i]) < 0) { pApp->m_networkController.m_currentSigninInfo[i].xuid = INVALID_XUID; pApp->m_networkController.m_currentSigninInfo[i].dwGuestNumber = 0; diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 0aecabe23..c415b9e8c 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -7,15 +7,13 @@ #include #include -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/LocalPlayer.h" @@ -27,6 +25,8 @@ #include "minecraft/world/item/crafting/Recipes.h" #include "minecraft/world/item/crafting/ShapedRecipy.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" Recipy::_eGroupType IUIScene_CraftingMenu::m_GroupTypeMapping4GridA @@ -875,7 +875,8 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() { } else { app.DebugPrintf("Need more H slots - "); #if !defined(_CONTENT_PACKAGE) - OutputDebugStringW( + fwprintf( + stderr, app.GetString(pTempItemInst->getDescriptionId())); #endif app.DebugPrintf("\n"); @@ -1313,8 +1314,8 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade) { // 12 for splitscreen, 14 for normal EHTMLFontSize size = eHTMLSize_Normal; - if (m_bSplitscreen || - (!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen())) { + if (m_bSplitscreen || (!PlatformRenderer.IsHiDef() && + !PlatformRenderer.IsWidescreen())) { size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp index d42483a53..f9efe3f44 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp @@ -1,13 +1,13 @@ #include "UIScene_DebugOptions.h" #include "app/common/Console_Debug_enum.h" -#include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/LinuxGame.h" +#include "platform/input/InputConstants.h" class UILayer; diff --git a/targets/app/linux/Stubs/winapi_stubs.h b/targets/app/linux/Stubs/winapi_stubs.h index 49d8e34c9..b06539542 100644 --- a/targets/app/linux/Stubs/winapi_stubs.h +++ b/targets/app/linux/Stubs/winapi_stubs.h @@ -4,16 +4,14 @@ #pragma once #include -#include #include #include #include #include #include -#include -#include #include +#include #include #include #include @@ -22,41 +20,20 @@ #define _vsnprintf_s vsnprintf; typedef unsigned int DWORD; -typedef unsigned char BYTE; -typedef BYTE* PBYTE; -typedef int HRESULT; -typedef unsigned int UINT; -typedef void* HANDLE; -typedef int INT; -typedef unsigned int* LPDWORD; -typedef char CHAR; -typedef uintptr_t ULONG_PTR; -typedef long LONG; -typedef unsigned long long PlayerUID; -typedef DWORD WORD; -typedef DWORD* PDWORD; typedef struct { - DWORD LowPart; - LONG HighPart; - long long QuadPart; + int32_t LowPart; + int32_t HighPart; + int64_t QuadPart; } LARGE_INTEGER; typedef struct { - DWORD LowPart; - LONG HighPart; - long long QuadPart; + uint32_t LowPart; + uint32_t HighPart; + uint64_t QuadPart; } ULARGE_INTEGER; -typedef long long LONGLONG; -typedef wchar_t *LPWSTR, *PWSTR; -typedef unsigned char boolean; // java brainrot #define __debugbreak() -#define CONST const -typedef unsigned long ULONG; -// typedef unsigned char byte; -typedef short SHORT; -typedef float FLOAT; #define ERROR_SUCCESS 0L #define ERROR_IO_PENDING 997L // dderror @@ -73,67 +50,18 @@ typedef struct _FILETIME { DWORD dwHighDateTime; } FILETIME, *PFILETIME, *LPFILETIME; -typedef struct _MEMORYSTATUS { - DWORD dwLength; - DWORD dwMemoryLoad; - size_t dwTotalPhys; - size_t dwAvailPhys; - size_t dwTotalPageFile; - size_t dwAvailPageFile; - size_t dwTotalVirtual; - size_t dwAvailVirtual; -} MEMORYSTATUS, *LPMEMORYSTATUS; - -typedef enum _GET_FILEEX_INFO_LEVELS { - GetFileExInfoStandard, - GetFileExMaxInfoLevel -} GET_FILEEX_INFO_LEVELS; - -typedef void* XMEMCOMPRESSION_CONTEXT; -typedef void* XMEMDECOMPRESSION_CONTEXT; - // https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime typedef struct _SYSTEMTIME { - WORD wYear; - WORD wMonth; - WORD wDayOfWeek; - WORD wDay; - WORD wHour; - WORD wMinute; - WORD wSecond; - WORD wMilliseconds; + int16_t wYear; + int16_t wMonth; + int16_t wDayOfWeek; + int16_t wDay; + int16_t wHour; + int16_t wMinute; + int16_t wSecond; + int16_t wMilliseconds; } SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME; -#define TLS_OUT_OF_INDEXES ((DWORD)0xFFFFFFFF) -// https://learn.microsoft.com/en-us/cpp/c-runtime-library/truncate?view=msvc-170 -#define _TRUNCATE ((size_t)-1) - -#define DECLARE_HANDLE(name) typedef HANDLE name -DECLARE_HANDLE(HINSTANCE); - -typedef HINSTANCE HMODULE; - -#define _HRESULT_TYPEDEF_(_sc) _sc - -#define FAILED(Status) ((HRESULT)(Status) < 0) -#define MAKE_HRESULT(sev, fac, code) \ - ((HRESULT)(((unsigned int)(sev) << 31) | ((unsigned int)(fac) << 16) | \ - ((unsigned int)(code)))) -#define MAKE_SCODE(sev, fac, code) \ - ((SCODE)(((unsigned int)(sev) << 31) | ((unsigned int)(fac) << 16) | \ - ((unsigned int)(code)))) -#define E_FAIL _HRESULT_TYPEDEF_(0x80004005L) -#define E_ABORT _HRESULT_TYPEDEF_(0x80004004L) -#define E_NOINTERFACE _HRESULT_TYPEDEF_(0x80004002L) - -// https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-globalmemorystatus -static inline void GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) { - // TODO: Parse /proc/meminfo and set lpBuffer based on that. Probably will - // also need another different codepath for macOS too. -} - -static inline DWORD GetLastError(void) { return errno; } - #ifdef __LP64__ static inline int64_t InterlockedCompareExchangeRelease64( int64_t volatile* Destination, int64_t Exchange, int64_t Comperand) { @@ -195,7 +123,7 @@ static inline void _FillSystemTime(const struct tm* tm, long tv_nsec, lpSystemTime->wHour = tm->tm_hour; lpSystemTime->wMinute = tm->tm_min; lpSystemTime->wSecond = tm->tm_sec; - lpSystemTime->wMilliseconds = (WORD)(tv_nsec / 1000000); // ns to ms + lpSystemTime->wMilliseconds = (int16_t)(tv_nsec / 1000000); // ns to ms } // https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getlocaltime @@ -221,23 +149,7 @@ static inline bool FileTimeToSystemTime(const FILETIME* lpFileTime, return true; } -// https://learn.microsoft.com/en-us/windows/win32/api/debugapi/nf-debugapi-outputdebugstringa -static inline void OutputDebugStringA(const char* lpOutputString) { - if (!lpOutputString) return; - fputs(lpOutputString, stderr); -} - -// https://learn.microsoft.com/en-us/windows/win32/api/debugapi/nf-debugapi-outputdebugstringw -static inline void OutputDebugStringW(const wchar_t* lpOutputString) { - if (!lpOutputString) return; - fprintf(stderr, "%ls", lpOutputString); -} - -static inline void OutputDebugString(const char* lpOutputString) { - return OutputDebugStringA(lpOutputString); -} - -static inline HMODULE GetModuleHandle(const char* lpModuleName) { return 0; } +static inline void* GetModuleHandle(const char* lpModuleName) { return 0; } static inline void* VirtualAlloc(void* lpAddress, size_t dwSize, DWORD flAllocationType, DWORD flProtect) { diff --git a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp index ffeefde22..067474dee 100644 --- a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp +++ b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp @@ -952,10 +952,11 @@ void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) { unsigned char* newIndicesAndData = (unsigned char*)malloc( memToAlloc); //(unsigned char *)malloc( memToAlloc ); if (newIndicesAndData == nullptr) { - uint32_t lastError = GetLastError(); - MEMORYSTATUS memStatus; - GlobalMemoryStatus(&memStatus); - __debugbreak(); + assert(0 && "Failed to allocate memory for CompressedTileStorage."); + // uint32_t lastError = GetLastError(); + // MEMORYSTATUS memStatus; + // GlobalMemoryStatus(&memStatus); + // __debugbreak(); } unsigned char* pucData = newIndicesAndData + 1024; unsigned short usDataOffset = 0; diff --git a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp index 8f72c21f3..0ad4eb0db 100644 --- a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp @@ -43,10 +43,10 @@ void SignTileEntity::save(CompoundTag* tag) { tag->putString(L"Text3", m_wsmessages[2]); tag->putString(L"Text4", m_wsmessages[3]); #if !defined(_CONTENT_PACKAGE) - OutputDebugStringW(L"### - Saving a sign with text - \n"); + fwprintf(stderr, L"### - Saving a sign with text - \n"); for (int i = 0; i < 4; i++) { - OutputDebugStringW(m_wsmessages[i].c_str()); - OutputDebugStringW(L"\n"); + fwprintf(stderr, m_wsmessages[i].c_str()); + fwprintf(stderr, L"\n"); } #endif } @@ -62,10 +62,10 @@ void SignTileEntity::load(CompoundTag* tag) { m_wsmessages[i] = m_wsmessages[i].substr(0, MAX_LINE_LENGTH); } #if !defined(_CONTENT_PACKAGE) - OutputDebugStringW(L"### - Loaded a sign with text - \n"); + fwprintf(stderr, L"### - Loaded a sign with text - \n"); for (int i = 0; i < 4; i++) { - OutputDebugStringW(m_wsmessages[i].c_str()); - OutputDebugStringW(L"\n"); + fwprintf(stderr, m_wsmessages[i].c_str()); + fwprintf(stderr, L"\n"); } #endif From 6faa481013346ee78685df09f5fc2e2c4a2b9f85 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 18:38:04 -0500 Subject: [PATCH 14/15] byte byte DWORD --- targets/app/linux/Stubs/winapi_stubs.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/targets/app/linux/Stubs/winapi_stubs.h b/targets/app/linux/Stubs/winapi_stubs.h index b06539542..7adbe7d38 100644 --- a/targets/app/linux/Stubs/winapi_stubs.h +++ b/targets/app/linux/Stubs/winapi_stubs.h @@ -19,8 +19,6 @@ #define __cdecl #define _vsnprintf_s vsnprintf; -typedef unsigned int DWORD; - typedef struct { int32_t LowPart; int32_t HighPart; @@ -46,8 +44,8 @@ typedef struct { // https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime typedef struct _FILETIME { - DWORD dwLowDateTime; - DWORD dwHighDateTime; + int32_t dwLowDateTime; + int32_t dwHighDateTime; } FILETIME, *PFILETIME, *LPFILETIME; // https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime @@ -86,8 +84,8 @@ static inline FILETIME _TimeToFileTime(time_t t) { const uint64_t EPOCH_DIFF = 11644473600ULL; uint64_t val = ((uint64_t)t + EPOCH_DIFF) * 10000000ULL; FILETIME ft; - ft.dwLowDateTime = (DWORD)(val & 0xFFFFFFFF); - ft.dwHighDateTime = (DWORD)(val >> 32); + ft.dwLowDateTime = (int32_t)(val & 0xFFFFFFFF); + ft.dwHighDateTime = (int32_t)(val >> 32); return ft; } @@ -152,7 +150,7 @@ static inline bool FileTimeToSystemTime(const FILETIME* lpFileTime, static inline void* GetModuleHandle(const char* lpModuleName) { return 0; } static inline void* VirtualAlloc(void* lpAddress, size_t dwSize, - DWORD flAllocationType, DWORD flProtect) { + int32_t flAllocationType, int32_t flProtect) { // MEM_COMMIT | MEM_RESERVE → mmap anonymous int prot = 0; if (flProtect == 0x04 /*PAGE_READWRITE*/) @@ -173,7 +171,7 @@ static inline void* VirtualAlloc(void* lpAddress, size_t dwSize, } static inline bool VirtualFree(void* lpAddress, size_t dwSize, - DWORD dwFreeType) { + int32_t dwFreeType) { if (lpAddress == nullptr) return false; // MEM_RELEASE (0x8000) frees the whole region if (dwFreeType == 0x8000 /*MEM_RELEASE*/) { From e4883d87fcc3f17eab83cc56aa577222ec325c0f Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Tue, 7 Apr 2026 18:58:49 -0500 Subject: [PATCH 15/15] replace __debugbreak with assert, fix full build --- targets/app/common/DLC/DLCManager.cpp | 2 +- targets/app/common/DLC/DLCPack.cpp | 6 ++-- targets/app/common/Game.cpp | 2 +- .../app/common/GameRules/GameRuleManager.cpp | 2 +- .../LevelGeneration/ConsoleSchematicFile.cpp | 4 +-- .../GameRules/LevelRules/Rules/GameRule.cpp | 2 +- .../app/common/Localisation/StringTable.cpp | 6 ++-- targets/app/common/MenuController.cpp | 1 + targets/app/common/Tutorial/FullTutorial.cpp | 1 + .../common/UI/All Platforms/ArchiveFile.cpp | 2 +- .../UI/Components/UIComponent_Tooltips.h | 1 + .../UIScene_MainMenu.cpp | 2 +- targets/app/common/UI/UIScene.cpp | 36 +++++++++---------- targets/app/linux/Iggy/include/rrCore.h | 2 +- targets/app/linux/Stubs/LinuxStubs.h | 9 ----- targets/app/linux/Stubs/winapi_stubs.h | 11 ------ targets/app/windows/Iggy/include/rrCore.h | 2 +- .../app/windows/Windows64_UIController.cpp | 2 +- targets/java/include/java/Class.h | 2 +- targets/minecraft/client/Minecraft.h | 1 + targets/minecraft/client/Options.cpp | 1 + targets/minecraft/client/gui/Gui.cpp | 3 +- .../client/gui/particle/GuiParticle.cpp | 3 +- targets/minecraft/client/model/ChestModel.cpp | 3 +- .../minecraft/client/particle/Particle.cpp | 4 +-- .../minecraft/client/player/LocalPlayer.cpp | 2 +- targets/minecraft/client/renderer/Chunk.cpp | 2 +- .../client/renderer/GameRenderer.cpp | 2 +- .../renderer/MobSkinTextureProcessor.cpp | 1 + .../entity/EntityRenderDispatcher.cpp | 2 +- .../texture/PreStitchedTextureMap.cpp | 8 ++--- .../client/renderer/texture/Stitcher.cpp | 2 +- .../client/renderer/texture/TextureMap.cpp | 2 +- .../client/skins/AbstractTexturePack.cpp | 3 +- .../minecraft/client/skins/DLCTexturePack.cpp | 4 +-- .../network/packet/CustomPayloadPacket.cpp | 2 +- .../network/packet/GameCommandPacket.cpp | 2 +- .../network/packet/MoveEntityPacket.cpp | 2 +- .../network/packet/MoveEntityPacketSmall.cpp | 10 +++--- targets/minecraft/network/packet/Packet.cpp | 4 +-- .../network/packet/SetPlayerTeamPacket.cpp | 4 +-- .../minecraft/server/level/EntityTracker.cpp | 2 +- targets/minecraft/util/WeighedRandom.cpp | 5 +-- targets/minecraft/world/entity/Entity.cpp | 2 +- targets/minecraft/world/item/ArmorItem.cpp | 2 +- targets/minecraft/world/level/Level.cpp | 2 +- .../world/level/biome/BiomeDecorator.cpp | 2 +- .../level/chunk/CompressedTileStorage.cpp | 2 +- .../world/level/chunk/storage/RegionFile.cpp | 2 +- .../level/levelgen/CustomLevelSource.cpp | 4 +-- .../levelgen/structure/StrongholdFeature.cpp | 2 +- .../newbiome/layer/BiomeOverrideLayer.cpp | 2 +- .../ConsoleSaveFileOriginal.cpp | 8 ++--- .../ConsoleSaveFileSplit.cpp | 11 +++--- .../storage/ConsoleSaveFileIO/FileHeader.cpp | 2 +- .../level/storage/DirectoryLevelStorage.cpp | 4 +-- .../world/level/storage/SavedDataStorage.cpp | 2 +- .../world/level/tile/PressurePlateTile.cpp | 2 +- targets/minecraft/world/scores/Scoreboard.cpp | 2 +- targets/platform/stubs.h | 5 --- 60 files changed, 105 insertions(+), 120 deletions(-) delete mode 100644 targets/app/linux/Stubs/LinuxStubs.h diff --git a/targets/app/common/DLC/DLCManager.cpp b/targets/app/common/DLC/DLCManager.cpp index 6fdbe3048..b583b93ff 100644 --- a/targets/app/common/DLC/DLCManager.cpp +++ b/targets/app/common/DLC/DLCManager.cpp @@ -259,7 +259,7 @@ unsigned int DLCManager::getPackIndex(DLCPack* pack, bool& found, if (pack == nullptr) { app.DebugPrintf( "DLCManager: Attempting to find the index for a nullptr pack\n"); - //__debugbreak(); + //assert(0); return foundIndex; } if (type != e_DLCType_All) { diff --git a/targets/app/common/DLC/DLCPack.cpp b/targets/app/common/DLC/DLCPack.cpp index 5eb690ac4..919d45f4f 100644 --- a/targets/app/common/DLC/DLCPack.cpp +++ b/targets/app/common/DLC/DLCPack.cpp @@ -84,7 +84,7 @@ void DLCPack::addChildPack(DLCPack* childPack) { const std::uint32_t packId = childPack->GetPackId(); #if !defined(_CONTENT_PACKAGE) if (packId < 0 || packId > 15) { - __debugbreak(); + assert(0); } #endif childPack->SetPackId((packId << 24) | m_packId); @@ -302,7 +302,7 @@ unsigned int DLCPack::getFileIndexAt(DLCManager::EDLCType type, if (type == DLCManager::e_DLCType_All) { app.DebugPrintf("Unimplemented\n"); #if !defined(__CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return 0; } @@ -327,7 +327,7 @@ bool DLCPack::hasPurchasedFile(DLCManager::EDLCType type, if (type == DLCManager::e_DLCType_All) { app.DebugPrintf("Unimplemented\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return false; } diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index a17dccfcb..4c14b9bcd 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -119,7 +119,7 @@ Game::Game() { "%d\n", sizeof(GAME_SETTINGS), GAME_SETTINGS_PROFILE_DATA_BYTES); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif } diff --git a/targets/app/common/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp index 000e198b9..321596d45 100644 --- a/targets/app/common/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -473,7 +473,7 @@ bool GameRuleManager::readRuleFile( compressedBuffer.data(), compressedSize); break; default: app.DebugPrintf("Invalid compression type %d found\n", compressionType); - __debugbreak(); + assert(0); [] decompressedBuffer.data(); dis.close(); bais.reset(); diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp index 5a4567217..29b521f14 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp @@ -142,7 +142,7 @@ void ConsoleSchematicFile::load(DataInputStream* dis) { app.DebugPrintf( "ConsoleSchematicFile has read a nullptr tile " "entity\n"); - __debugbreak(); + assert(0); #endif } else { m_tileEntities.push_back(te); @@ -675,7 +675,7 @@ void ConsoleSchematicFile::generateSchematicFile( } #ifndef _CONTENT_PACKAGE - if (p != blockCount) __debugbreak(); + if (p != blockCount) assert(0); #endif // We don't know how this will compress - just make a fixed length buffer to diff --git a/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp index 5d00d72cd..ce9750da4 100644 --- a/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp +++ b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp @@ -34,7 +34,7 @@ GameRule::ValueType GameRule::getParameter(const std::wstring& parameterName) { #ifndef _CONTENT_PACKAGE wprintf(L"WARNING: Parameter %ls was not set before being fetched\n", parameterName.c_str()); - __debugbreak(); + assert(0); #endif } return m_parameters[parameterName]; diff --git a/targets/app/common/Localisation/StringTable.cpp b/targets/app/common/Localisation/StringTable.cpp index 838e005e9..262f7cd26 100644 --- a/targets/app/common/Localisation/StringTable.cpp +++ b/targets/app/common/Localisation/StringTable.cpp @@ -115,7 +115,7 @@ void StringTable::ProcessStringTableData(void) { } else { app.DebugPrintf("Failed to get language\n"); #ifdef _DEBUG - __debugbreak(); + assert(0); #endif isStatic = false; @@ -137,7 +137,7 @@ void StringTable::getData(std::uint8_t** ppData, unsigned int* pSize) { const wchar_t* StringTable::getString(const std::wstring& id) { #ifndef _CONTENT_PACKAGE if (isStatic) { - __debugbreak(); + assert(0); return L""; } #endif @@ -154,7 +154,7 @@ const wchar_t* StringTable::getString(const std::wstring& id) { const wchar_t* StringTable::getString(int id) { #ifndef _CONTENT_PACKAGE if (!isStatic) { - __debugbreak(); + assert(0); return L""; } #endif diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index 0549a1cc3..6089184fd 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -6,6 +6,7 @@ #include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/renderer/GameRenderer.h" diff --git a/targets/app/common/Tutorial/FullTutorial.cpp b/targets/app/common/Tutorial/FullTutorial.cpp index 9d357652c..079f85dec 100644 --- a/targets/app/common/Tutorial/FullTutorial.cpp +++ b/targets/app/common/Tutorial/FullTutorial.cpp @@ -31,6 +31,7 @@ #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" +#include "platform/input/InputConstants.h" #include "strings.h" class TutorialConstraint; diff --git a/targets/app/common/UI/All Platforms/ArchiveFile.cpp b/targets/app/common/UI/All Platforms/ArchiveFile.cpp index c64ecfb64..932cfe514 100644 --- a/targets/app/common/UI/All Platforms/ArchiveFile.cpp +++ b/targets/app/common/UI/All Platforms/ArchiveFile.cpp @@ -102,7 +102,7 @@ std::vector ArchiveFile::getFile(const std::wstring& filename) { app.DebugPrintf("Failed to find file '%ls' in archive\n", filename.c_str()); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif app.FatalLoadError(); } else { diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.h b/targets/app/common/UI/Components/UIComponent_Tooltips.h index 24501c2b9..943c81f82 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.h +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.h @@ -13,6 +13,7 @@ #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" +#include "platform/input/InputConstants.h" class UILayer; 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 28032e4cd..a298e7a3c 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 @@ -286,7 +286,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) { } break; default: - __debugbreak(); + assert(0); } bool confirmUser = false; diff --git a/targets/app/common/UI/UIScene.cpp b/targets/app/common/UI/UIScene.cpp index 63a8d8d12..ff764d2ca 100644 --- a/targets/app/common/UI/UIScene.cpp +++ b/targets/app/common/UI/UIScene.cpp @@ -307,7 +307,7 @@ void UIScene::loadMovie() { app.DebugPrintf("ERROR: Could not find any iggy movie for %ls!\n", moviePath.c_str()); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif app.FatalLoadError(); } @@ -323,7 +323,7 @@ void UIScene::loadMovie() { if (!swf) { app.DebugPrintf("ERROR: Failed to load iggy scene!\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif app.FatalLoadError(); } @@ -718,7 +718,7 @@ void UIScene::_customDrawSlotControl(CustomDrawData* region, int iPad, // { // app.DebugPrintf("A scene is trying to navigate forwards, but // it's parent layer is nullptr!\n"); #ifndef _CONTENT_PACKAGE -// __debugbreak(); +// assert(0); // #endif // } // else @@ -911,7 +911,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Callback for handlePress did not have the correct number of " "arguments\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -920,7 +920,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { app.DebugPrintf( "Arguments for handlePress were not of the correct type\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -932,7 +932,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Callback for handleFocusChange did not have the correct " "number of arguments\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -942,7 +942,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Arguments for handleFocusChange were not of the correct " "type\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -955,7 +955,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Callback for handleInitFocus did not have the correct number " "of arguments\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -964,7 +964,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { app.DebugPrintf( "Arguments for handleInitFocus were not of the correct type\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -977,7 +977,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Callback for handleCheckboxToggled did not have the correct " "number of arguments\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -987,7 +987,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Arguments for handleCheckboxToggled were not of the correct " "type\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -1000,7 +1000,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Callback for handleSliderMove did not have the correct number " "of arguments\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -1010,7 +1010,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Arguments for handleSliderMove were not of the correct " "type\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -1023,7 +1023,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Callback for handleAnimationEnd did not have the correct " "number of arguments\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -1036,7 +1036,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Callback for handleSelectionChanged did not have the correct " "number of arguments\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -1045,7 +1045,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Arguments for handleSelectionChanged were not of the correct " "type\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -1061,7 +1061,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Callback for handleRequestMoreData did not have the " "correct number of arguments\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } @@ -1071,7 +1071,7 @@ void UIScene::externalCallback(IggyExternalFunctionCallUTF16* call) { "Arguments for handleRequestMoreData were not of the " "correct type\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return; } diff --git a/targets/app/linux/Iggy/include/rrCore.h b/targets/app/linux/Iggy/include/rrCore.h index e88b5f8c3..ab39323d3 100644 --- a/targets/app/linux/Iggy/include/rrCore.h +++ b/targets/app/linux/Iggy/include/rrCore.h @@ -1619,7 +1619,7 @@ RADDEFSTART #define RR_BREAK() __builtin_trap() #define RR_CACHE_LINE_SIZE 32 #elif defined(__RADXENON__) - #define RR_BREAK() __debugbreak() + #define RR_BREAK() assert(0) #define RR_CACHE_LINE_SIZE 128 #elif defined(__RADANDROID__) #define RR_BREAK() __builtin_trap() diff --git a/targets/app/linux/Stubs/LinuxStubs.h b/targets/app/linux/Stubs/LinuxStubs.h deleted file mode 100644 index 7ed4032d3..000000000 --- a/targets/app/linux/Stubs/LinuxStubs.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef STUBS_H -#define STUBS_H - -#pragma once -#include "winapi_stubs.h" -#ifndef _ENABLEIGGY -#include "iggy_stubs.h" -#endif -#endif // STUBS_H \ No newline at end of file diff --git a/targets/app/linux/Stubs/winapi_stubs.h b/targets/app/linux/Stubs/winapi_stubs.h index 7adbe7d38..52ef81a12 100644 --- a/targets/app/linux/Stubs/winapi_stubs.h +++ b/targets/app/linux/Stubs/winapi_stubs.h @@ -9,15 +9,8 @@ #include #include -#include -#include #include -#include #include -#include - -#define __cdecl -#define _vsnprintf_s vsnprintf; typedef struct { int32_t LowPart; @@ -31,8 +24,6 @@ typedef struct { uint64_t QuadPart; } ULARGE_INTEGER; -#define __debugbreak() - #define ERROR_SUCCESS 0L #define ERROR_IO_PENDING 997L // dderror #define ERROR_CANCELLED 1223L @@ -147,8 +138,6 @@ static inline bool FileTimeToSystemTime(const FILETIME* lpFileTime, return true; } -static inline void* GetModuleHandle(const char* lpModuleName) { return 0; } - static inline void* VirtualAlloc(void* lpAddress, size_t dwSize, int32_t flAllocationType, int32_t flProtect) { // MEM_COMMIT | MEM_RESERVE → mmap anonymous diff --git a/targets/app/windows/Iggy/include/rrCore.h b/targets/app/windows/Iggy/include/rrCore.h index 6465f7577..83110cabc 100644 --- a/targets/app/windows/Iggy/include/rrCore.h +++ b/targets/app/windows/Iggy/include/rrCore.h @@ -1619,7 +1619,7 @@ RADDEFSTART #define RR_BREAK() __builtin_trap() #define RR_CACHE_LINE_SIZE 32 #elif defined(__RADXENON__) - #define RR_BREAK() __debugbreak() + #define RR_BREAK() assert(0) #define RR_CACHE_LINE_SIZE 128 #elif defined(__RADANDROID__) #define RR_BREAK() __builtin_trap() diff --git a/targets/app/windows/Windows64_UIController.cpp b/targets/app/windows/Windows64_UIController.cpp index d37be6d73..5b1a825ad 100644 --- a/targets/app/windows/Windows64_UIController.cpp +++ b/targets/app/windows/Windows64_UIController.cpp @@ -25,7 +25,7 @@ void ConsoleUIController::init(ID3D11Device* dev, ID3D11DeviceContext* ctx, if (!gdraw_funcs) { app.DebugPrintf("Failed to initialise GDraw!\n"); #ifndef _CONTENT_PACKAGE - __debugbreak(); + assert(0); #endif app.FatalLoadError(); } diff --git a/targets/java/include/java/Class.h b/targets/java/include/java/Class.h index c4e602d89..ce61e1bcf 100644 --- a/targets/java/include/java/Class.h +++ b/targets/java/include/java/Class.h @@ -750,7 +750,7 @@ public: } if ((m_falsePositives.size() > 0) || (m_falseNegatives.size() > 0)) { - __debugbreak(); + assert(0); } } }; diff --git a/targets/minecraft/client/Minecraft.h b/targets/minecraft/client/Minecraft.h index 7d1ec07ed..1c0a205d0 100644 --- a/targets/minecraft/client/Minecraft.h +++ b/targets/minecraft/client/Minecraft.h @@ -11,6 +11,7 @@ #include "java/File.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/stubs.h" class Timer; class MultiPlayerLevel; diff --git a/targets/minecraft/client/Options.cpp b/targets/minecraft/client/Options.cpp index 12142849f..63e8da42a 100644 --- a/targets/minecraft/client/Options.cpp +++ b/targets/minecraft/client/Options.cpp @@ -16,6 +16,7 @@ #include "minecraft/client/renderer/Textures.h" #include "minecraft/locale/I18n.h" #include "minecraft/locale/Language.h" +#include "platform/stubs.h" // 4J - the Option sub-class used to be an java enumerated type, trying to // emulate that functionality here diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index b820e6ea1..0a373143b 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -17,6 +17,7 @@ #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" +#include "java/Color.h" #include "minecraft/client/ClientConstants.h" #include "minecraft/client/GuiMessage.h" #include "minecraft/client/Lighting.h" @@ -1084,7 +1085,7 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth int col = 0xffffff; if (animateOverlayMessageColor) { - col = Color::HSBtoRGB(t / 50.0f, 0.7f, 0.6f) & 0xffffff; + col = Color::getHSBColor(t / 50.0f, 0.7f, 0.6f).getRGB() & 0xffffff; } // 4J-PB - this is the string displayed when cds are placed in a // jukebox diff --git a/targets/minecraft/client/gui/particle/GuiParticle.cpp b/targets/minecraft/client/gui/particle/GuiParticle.cpp index c7aae80d0..9d46a83b7 100644 --- a/targets/minecraft/client/gui/particle/GuiParticle.cpp +++ b/targets/minecraft/client/gui/particle/GuiParticle.cpp @@ -2,6 +2,7 @@ #include "platform/stubs.h" #include "java/Random.h" +#include "java/Color.h" Random* GuiParticle::random = new Random(); @@ -17,7 +18,7 @@ GuiParticle::GuiParticle(double x, double y, double xa, double ya) { this->xa = xa; this->ya = ya; - int col = Color::HSBtoRGB(random->nextFloat(), 0.5f, 1); + int col = Color::getHSBColor(random->nextFloat(), 0.5f, 1).getRGB(); r = ((col >> 16) & 0xff) / 255.0; g = ((col >> 8) & 0xff) / 255.0; b = ((col) & 0xff) / 255.0; diff --git a/targets/minecraft/client/model/ChestModel.cpp b/targets/minecraft/client/model/ChestModel.cpp index 3169b41bb..80f849e8e 100644 --- a/targets/minecraft/client/model/ChestModel.cpp +++ b/targets/minecraft/client/model/ChestModel.cpp @@ -1,7 +1,6 @@ #include "ChestModel.h" - - +#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" ChestModel::ChestModel() { diff --git a/targets/minecraft/client/particle/Particle.cpp b/targets/minecraft/client/particle/Particle.cpp index cddabd80e..41b27c006 100644 --- a/targets/minecraft/client/particle/Particle.cpp +++ b/targets/minecraft/client/particle/Particle.cpp @@ -185,7 +185,7 @@ void Particle::setTex(Textures* textures, Icon* icon) { } else { #if !defined(_CONTENT_PACKAGE) printf("Invalid call to Particle.setTex, use coordinate methods\n"); - __debugbreak(); + assert(0); #endif // throw new RuntimeException("Invalid call to Particle.setTex, use // coordinate methods"); @@ -197,7 +197,7 @@ void Particle::setMiscTex(int slotIndex) { getParticleTexture() != ParticleEngine::DRAGON_BREATH_TEXTURE) { #if !defined(_CONTENT_PACKAGE) printf("Invalid call to Particle.setMixTex\n"); - __debugbreak(); + assert(0); // throw new RuntimeException("Invalid call to Particle.setMiscTex"); #endif } diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index b0648a94f..baecf09b7 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -523,7 +523,7 @@ void LocalPlayer::changeDimension(int i) { Log::info( "LocalPlayer::changeDimension from 1 to 1 but WinScreen has " "not been implemented.\n"); - __debugbreak(); + assert(0); #endif } else { awardStat(GenericStats::theEnd(), GenericStats::param_theEnd()); diff --git a/targets/minecraft/client/renderer/Chunk.cpp b/targets/minecraft/client/renderer/Chunk.cpp index 75de01de2..0bdc5bfe3 100644 --- a/targets/minecraft/client/renderer/Chunk.cpp +++ b/targets/minecraft/client/renderer/Chunk.cpp @@ -797,7 +797,7 @@ bool Chunk::isEmpty() { void Chunk::setDirty() { // 4J - not used, but if this starts being used again then we'll need to // investigate how best to handle it. - __debugbreak(); + assert(0); levelRenderer->setGlobalChunkFlag(x, y, z, level, LevelRenderer::CHUNK_FLAG_DIRTY); } diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index 7bbbc69a2..b7cdcc947 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -2024,7 +2024,7 @@ void GameRenderer::setupFog(int i, float alpha) { } if (i == 999) { - __debugbreak(); + assert(0); // 4J TODO /* glFog(GL_FOG_COLOR, getBuffer(0, 0, 0, 1)); diff --git a/targets/minecraft/client/renderer/MobSkinTextureProcessor.cpp b/targets/minecraft/client/renderer/MobSkinTextureProcessor.cpp index 335256b11..3c48ed8c8 100644 --- a/targets/minecraft/client/renderer/MobSkinTextureProcessor.cpp +++ b/targets/minecraft/client/renderer/MobSkinTextureProcessor.cpp @@ -1,6 +1,7 @@ #include "MobSkinTextureProcessor.h" #include "minecraft/client/BufferedImage.h" +#include "platform/stubs.h" BufferedImage* MobSkinTextureProcessor::process(BufferedImage* in) { if (in == nullptr) return nullptr; diff --git a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp index 6f9e4d4bd..31bda5f4f 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp @@ -198,7 +198,7 @@ EntityRenderer* EntityRenderDispatcher::getRenderer(eINSTANCEOF e) { if (it == renderers.end()) { Log::info("Couldn't find renderer for entity of type %d\n", e); // New renderer mapping required in above table - // __debugbreak(); + // assert(0); assert(0); } /* 4J - not doing this hierarchical search anymore. We need to explicitly diff --git a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp index 03ea642c1..ff9fd08c5 100644 --- a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp @@ -178,7 +178,7 @@ void PreStitchedTextureMap::makeTextureAnimated(TexturePack* texturePack, textureFileName.c_str(), first->getWidth(), tex->getWidth(), first->getHeight(), tex->getHeight()); - __debugbreak(); + assert(0); } #endif @@ -196,7 +196,7 @@ void PreStitchedTextureMap::makeTextureAnimated(TexturePack* texturePack, StitchedTexture* PreStitchedTextureMap::getTexture(const std::wstring& name) { #if !defined(_CONTENT_PACKAGE) Log::info("Not implemented!\n"); - __debugbreak(); + assert(0); #endif return nullptr; } @@ -218,7 +218,7 @@ Icon* PreStitchedTextureMap::registerIcon(const std::wstring& name) { if (name.empty()) { Log::info("Don't register nullptr\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif result = missingPosition; // new RuntimeException("Don't register null!").printStackTrace(); @@ -230,7 +230,7 @@ Icon* PreStitchedTextureMap::registerIcon(const std::wstring& name) { if (result == nullptr) { #if !defined(_CONTENT_PACKAGE) Log::info("Could not find uv data for icon %ls\n", name.c_str()); - __debugbreak(); + assert(0); #endif result = missingPosition; } diff --git a/targets/minecraft/client/renderer/texture/Stitcher.cpp b/targets/minecraft/client/renderer/texture/Stitcher.cpp index 30f656257..9056aac66 100644 --- a/targets/minecraft/client/renderer/texture/Stitcher.cpp +++ b/targets/minecraft/client/renderer/texture/Stitcher.cpp @@ -84,7 +84,7 @@ void Stitcher::stitch() { if (!addToStorage(textureHolder)) { Log::info("Stitcher exception!\n"); #ifndef _CONTENT_PACKAGE - __debugbreak(); + assert(0); #endif // throw new StitcherException(textureHolder); } diff --git a/targets/minecraft/client/renderer/texture/TextureMap.cpp b/targets/minecraft/client/renderer/texture/TextureMap.cpp index 8421fa863..b6e6f6ce2 100644 --- a/targets/minecraft/client/renderer/texture/TextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/TextureMap.cpp @@ -237,7 +237,7 @@ Icon* TextureMap::registerIcon(const std::wstring& name) { if (name.empty()) { Log::info("Don't register nullptr\n"); #ifndef _CONTENT_PACKAGE - __debugbreak(); + assert(0); #endif // new RuntimeException("Don't register null!").printStackTrace(); } diff --git a/targets/minecraft/client/skins/AbstractTexturePack.cpp b/targets/minecraft/client/skins/AbstractTexturePack.cpp index c8dc44f83..7a901bbc3 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.cpp +++ b/targets/minecraft/client/skins/AbstractTexturePack.cpp @@ -214,7 +214,8 @@ void AbstractTexturePack::unloadUI() { } std::wstring AbstractTexturePack::getXuiRootPath() { - const uintptr_t c_ModuleHandle = (uintptr_t)GetModuleHandle(nullptr); + // const uintptr_t c_ModuleHandle = (uintptr_t)GetModuleHandle(nullptr); + const uintptr_t c_ModuleHandle = 0; // 4jcraft changed // Load new skin constexpr int LOCATOR_SIZE = diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 4e8d803c1..3a25807e3 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -150,7 +150,7 @@ void DLCTexturePack::loadDescription() { std::wstring DLCTexturePack::getResource(const std::wstring& name) { // 4J Stu - We should never call this function #if !defined(__CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return L""; } @@ -160,7 +160,7 @@ InputStream* DLCTexturePack::getResourceImplementation( { // 4J Stu - We should never call this function #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); if (hasFile(name)) return nullptr; #endif return nullptr; // resource; diff --git a/targets/minecraft/network/packet/CustomPayloadPacket.cpp b/targets/minecraft/network/packet/CustomPayloadPacket.cpp index 66f373aec..9402bc31e 100644 --- a/targets/minecraft/network/packet/CustomPayloadPacket.cpp +++ b/targets/minecraft/network/packet/CustomPayloadPacket.cpp @@ -33,7 +33,7 @@ CustomPayloadPacket::CustomPayloadPacket(const std::wstring& identifier, if (length > std::numeric_limits::max()) { Log::info("Payload may not be larger than 32K\n"); #ifndef _CONTENT_PACKAGE - __debugbreak(); + assert(0); #endif // throw new IllegalArgumentException("Payload may not be larger // than 32k"); diff --git a/targets/minecraft/network/packet/GameCommandPacket.cpp b/targets/minecraft/network/packet/GameCommandPacket.cpp index 71944da60..2410169f7 100644 --- a/targets/minecraft/network/packet/GameCommandPacket.cpp +++ b/targets/minecraft/network/packet/GameCommandPacket.cpp @@ -26,7 +26,7 @@ GameCommandPacket::GameCommandPacket(EGameCommand command, if (length > std::numeric_limits::max()) { Log::info("Payload may not be larger than 32K\n"); #ifndef _CONTENT_PACKAGE - __debugbreak(); + assert(0); #endif // throw new IllegalArgumentException("Payload may not be larger // than 32k"); diff --git a/targets/minecraft/network/packet/MoveEntityPacket.cpp b/targets/minecraft/network/packet/MoveEntityPacket.cpp index ee5d26cf1..1f3bdadd4 100644 --- a/targets/minecraft/network/packet/MoveEntityPacket.cpp +++ b/targets/minecraft/network/packet/MoveEntityPacket.cpp @@ -40,7 +40,7 @@ void MoveEntityPacket::write(DataOutputStream* dos) // throws IOException if ((id < 0) || (id >= 2048)) { // We shouln't be tracking an entity that doesn't have a short type of // id - __debugbreak(); + assert(0); } dos->writeShort((short)id); } diff --git a/targets/minecraft/network/packet/MoveEntityPacketSmall.cpp b/targets/minecraft/network/packet/MoveEntityPacketSmall.cpp index 50a109954..97410a0fe 100644 --- a/targets/minecraft/network/packet/MoveEntityPacketSmall.cpp +++ b/targets/minecraft/network/packet/MoveEntityPacketSmall.cpp @@ -23,7 +23,7 @@ MoveEntityPacketSmall::MoveEntityPacketSmall(int id) { if ((id < 0) || (id >= 2048)) { // We shouln't be tracking an entity that doesn't have a short type of // id - __debugbreak(); + assert(0); } this->id = id; @@ -46,7 +46,7 @@ void MoveEntityPacketSmall::write(DataOutputStream* dos) // throws IOException if ((id < 0) || (id >= 2048)) { // We shouln't be tracking an entity that doesn't have a short type of // id - __debugbreak(); + assert(0); } dos->writeShort((short)id); } @@ -96,7 +96,7 @@ void MoveEntityPacketSmall::PosRot::write( if ((id < 0) || (id >= 2048)) { // We shouln't be tracking an entity that doesn't have a short type of // id - __debugbreak(); + assert(0); } short idAndRot = id | yRot << 11; dos->writeShort(idAndRot); @@ -132,7 +132,7 @@ void MoveEntityPacketSmall::Pos::write( if ((id < 0) || (id >= 2048)) { // We shouln't be tracking an entity that doesn't have a short type of // id - __debugbreak(); + assert(0); } short idAndY = id | ya << 11; dos->writeShort(idAndY); @@ -165,7 +165,7 @@ void MoveEntityPacketSmall::Rot::write( if ((id < 0) || (id >= 2048)) { // We shouln't be tracking an entity that doesn't have a short type of // id - __debugbreak(); + assert(0); } short idAndRot = id | yRot << 11; dos->writeShort(idAndRot); diff --git a/targets/minecraft/network/packet/Packet.cpp b/targets/minecraft/network/packet/Packet.cpp index d2eb450c2..5e18938b1 100644 --- a/targets/minecraft/network/packet/Packet.cpp +++ b/targets/minecraft/network/packet/Packet.cpp @@ -468,7 +468,7 @@ std::vector Packet::readBytes(DataInputStream* datainputstream) { if (size < 0) { Log::info("Key was smaller than nothing! Weird key!"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif return std::vector(); // throw new IOException("Key was smaller than nothing! Weird key!"); @@ -517,7 +517,7 @@ std::shared_ptr Packet::readPacket( (!isServer && clientReceivedPackets.find(id) == clientReceivedPackets.end())) { // Log::info("Bad packet id %d\n", id); - __debugbreak(); + assert(0); assert(false); // throw new IOException(wstring(L"Bad packet id ") + // toWString(id)); diff --git a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp index cd5448d2e..ae33874ef 100644 --- a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp +++ b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp @@ -43,13 +43,13 @@ SetPlayerTeamPacket::SetPlayerTeamPacket(PlayerTeam* team, if (method != METHOD_JOIN && method != METHOD_LEAVE) { Log::info("Method must be join or leave for player constructor"); #ifndef _CONTENT_PACKAGE - __debugbreak(); + assert(0); #endif } if (playerNames == nullptr || playerNames->empty()) { Log::info("Players cannot be null/empty"); #ifndef _CONTENT_PACKAGE - __debugbreak(); + assert(0); #endif } diff --git a/targets/minecraft/server/level/EntityTracker.cpp b/targets/minecraft/server/level/EntityTracker.cpp index 3768ef7a1..0ee2a9d84 100644 --- a/targets/minecraft/server/level/EntityTracker.cpp +++ b/targets/minecraft/server/level/EntityTracker.cpp @@ -102,7 +102,7 @@ void EntityTracker::addEntity(std::shared_ptr e, int range, assert(false); // Entity already tracked } if (e->entityId >= 2048) { - __debugbreak(); + assert(0); } std::shared_ptr te = std::shared_ptr( new TrackedEntity(e, range, updateInterval, trackDeltas)); diff --git a/targets/minecraft/util/WeighedRandom.cpp b/targets/minecraft/util/WeighedRandom.cpp index 1a07dd078..07a99f54d 100644 --- a/targets/minecraft/util/WeighedRandom.cpp +++ b/targets/minecraft/util/WeighedRandom.cpp @@ -2,6 +2,7 @@ #include "minecraft/util/WeighedRandom.h" #include +#include #include "app/linux/Stubs/winapi_stubs.h" #include "java/Random.h" @@ -17,7 +18,7 @@ int WeighedRandom::getTotalWeight(std::vector* items) { WeighedRandomItem* WeighedRandom::getRandomItem( Random* random, std::vector* items, int totalWeight) { if (totalWeight <= 0) { - __debugbreak(); + assert(0); } int selection = random->nextInt(totalWeight); @@ -49,7 +50,7 @@ WeighedRandomItem* WeighedRandom::getRandomItem( Random* random, const std::vector& items, int totalWeight) { if (totalWeight <= 0) { - __debugbreak(); + assert(0); } int selection = random->nextInt(totalWeight); diff --git a/targets/minecraft/world/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index d9b45abb6..cce8ff4d0 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -126,7 +126,7 @@ int Entity::getSmallId() { } Log::info("Out of small entity Ids... possible leak?\n"); - __debugbreak(); + assert(0); return -1; } diff --git a/targets/minecraft/world/item/ArmorItem.cpp b/targets/minecraft/world/item/ArmorItem.cpp index 9a7c38108..1daa05977 100644 --- a/targets/minecraft/world/item/ArmorItem.cpp +++ b/targets/minecraft/world/item/ArmorItem.cpp @@ -206,7 +206,7 @@ void ArmorItem::setColor(std::shared_ptr item, int color) { if (armorType != ArmorMaterial::CLOTH) { #ifndef _CONTENT_PACKAGE printf("Can't dye non-leather!"); - __debugbreak(); + assert(0); #endif // throw new UnsupportedOperationException("Can't dye non-leather!"); } diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index d7cd0b255..e760030ea 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -2188,7 +2188,7 @@ void Level::tickEntities() { if (tileEntitiesToUnload.find(*it) != tileEntitiesToUnload.end()) { if (isClientSide) { - __debugbreak(); + assert(0); } it = tileEntityList.erase(it); } else { diff --git a/targets/minecraft/world/level/biome/BiomeDecorator.cpp b/targets/minecraft/world/level/biome/BiomeDecorator.cpp index 339bd2f23..ac352882c 100644 --- a/targets/minecraft/world/level/biome/BiomeDecorator.cpp +++ b/targets/minecraft/world/level/biome/BiomeDecorator.cpp @@ -37,7 +37,7 @@ void BiomeDecorator::decorate(Level* level, Random* random, int xo, int zo) { if (this->level != nullptr) { Log::info("BiomeDecorator::decorate - Already decorating!!\n"); #ifndef _CONTENT_PACKAGE - __debugbreak(); + assert(0); // throw new RuntimeException("Already decorating!!"); #endif } diff --git a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp index 067474dee..7c4e3eef8 100644 --- a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp +++ b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp @@ -956,7 +956,7 @@ void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) { // uint32_t lastError = GetLastError(); // MEMORYSTATUS memStatus; // GlobalMemoryStatus(&memStatus); - // __debugbreak(); + // assert(0); } unsigned char* pucData = newIndicesAndData + 1024; unsigned short usDataOffset = 0; diff --git a/targets/minecraft/world/level/chunk/storage/RegionFile.cpp b/targets/minecraft/world/level/chunk/storage/RegionFile.cpp index dd5eb2060..882981e02 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/RegionFile.cpp @@ -320,7 +320,7 @@ void RegionFile::write(int x, int z, std::uint8_t* data, #ifndef _CONTENT_PACKAGE if (sectorNumber < 0) { - __debugbreak(); + assert(0); } #endif diff --git a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp index 21fc21605..036e5436c 100644 --- a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -51,7 +51,7 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed, path, m_heightmapOverride.data(), m_heightmapOverride.size()); if (result.status == IPlatformFilesystem::ReadStatus::TooLarge) { Log::info("Heightmap binary is too large!!\n"); - __debugbreak(); + assert(0); } else if (result.status != IPlatformFilesystem::ReadStatus::Ok) { gameServices().fatalLoadError(); assert(false); @@ -71,7 +71,7 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed, m_waterheightOverride.size()); } else if (result.status == IPlatformFilesystem::ReadStatus::TooLarge) { Log::info("waterheight binary is too large!!\n"); - __debugbreak(); + assert(0); } else if (result.status != IPlatformFilesystem::ReadStatus::Ok) { gameServices().fatalLoadError(); } diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp index 8435768a2..6f7c741da 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp @@ -159,7 +159,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { #ifndef _CONTENT_PACKAGE if (position->x > 2560 || position->x < -2560 || position->z > 2560 || position->z < -2560) { - __debugbreak(); + assert(0); } #endif diff --git a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp index d390191f4..784dfccf6 100644 --- a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp @@ -24,7 +24,7 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) { m_biomeOverride.size()); } else if (result.status == IPlatformFilesystem::ReadStatus::TooLarge) { Log::info("Biomemap binary is too large!!\n"); - __debugbreak(); + assert(0); } else if (result.status != IPlatformFilesystem::ReadStatus::Ok) { gameServices().fatalLoadError(); } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index a7f4da1b4..c34ce5774 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -91,7 +91,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( // pages committed should always be zero at this point. if (pagesCommitted != 0) { #ifndef _CONTENT_PACKAGE - __debugbreak(); + assert(0); #endif } @@ -103,7 +103,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( if (pvRet == nullptr) { #ifndef _CONTENT_PACKAGE // Out of physical memory - __debugbreak(); + assert(0); #endif } pagesCommitted = pagesRequired; @@ -162,7 +162,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( COMMIT_ALLOCATION, PAGE_READWRITE); if (pvRet == nullptr) { // Out of physical memory - __debugbreak(); + assert(0); } pagesCommitted = pagesRequired; } @@ -438,7 +438,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond( COMMIT_ALLOCATION, PAGE_READWRITE); if (pvRet == nullptr) { // Out of physical memory - __debugbreak(); + assert(0); } pagesCommitted = pagesRequired; } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 299deac45..663aa8942 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -15,6 +15,7 @@ #include #include +#include "platform/fs/fs.h" #include "platform/PlatformTypes.h" #include "minecraft/GameEnums.h" #include "app/common/BuildVer/BuildVer.h" @@ -469,7 +470,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring& fileName, void* pvSaveData, // pages committed should always be zero at this point. if (pagesCommitted != 0) { #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif } @@ -481,7 +482,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring& fileName, void* pvSaveData, if (pvRet == nullptr) { #if !defined(_CONTENT_PACKAGE) // Out of physical memory - __debugbreak(); + assert(0); #endif } pagesCommitted = pagesRequired; @@ -530,7 +531,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring& fileName, void* pvSaveData, COMMIT_ALLOCATION, PAGE_READWRITE); if (pvRet == nullptr) { // Out of physical memory - __debugbreak(); + assert(0); } pagesCommitted = pagesRequired; } @@ -541,7 +542,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring& fileName, void* pvSaveData, // actually be ok Log::info("Failed to decompress save data!\n"); #if !defined(_CONTENT_PACKAGE) - __debugbreak(); + assert(0); #endif memset(pvSaveMem, 0, fileSize); // Clear the first 8 bytes that reference the header @@ -1036,7 +1037,7 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry* file, COMMIT_ALLOCATION, PAGE_READWRITE); if (pvRet == nullptr) { // Out of physical memory - __debugbreak(); + assert(0); } pagesCommitted = pagesRequired; } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp index 8f8521493..43ee5a88f 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp @@ -284,7 +284,7 @@ void FileHeader::ReadHeader( #if !defined(_CONTENT_PACKAGE) Log::info("********** Invalid save version %d\n", m_saveVersion); - __debugbreak(); + assert(0); #endif break; } diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index 360b99f02..be4abd24d 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -70,7 +70,7 @@ int _MapDataMappings::getDimension(int id) { default: #if !defined(_CONTENT_PACKAGE) printf("Read invalid dimension from MapDataMapping\n"); - __debugbreak(); + assert(0); #endif break; } @@ -98,7 +98,7 @@ void _MapDataMappings::setMapping(int id, PlayerUID xuid, int dimension) { #if !defined(_CONTENT_PACKAGE) printf( "Trinyg to set a MapDataMapping for an invalid dimension.\n"); - __debugbreak(); + assert(0); #endif break; } diff --git a/targets/minecraft/world/level/storage/SavedDataStorage.cpp b/targets/minecraft/world/level/storage/SavedDataStorage.cpp index 71635ed81..4be1c0ccc 100644 --- a/targets/minecraft/world/level/storage/SavedDataStorage.cpp +++ b/targets/minecraft/world/level/storage/SavedDataStorage.cpp @@ -63,7 +63,7 @@ std::shared_ptr SavedDataStorage::get(const std::type_info& clazz, new StructureFeatureSavedData(id))); } else { // Handling of new SavedData class required - __debugbreak(); + assert(0); } ConsoleSaveFileInputStream fis = diff --git a/targets/minecraft/world/level/tile/PressurePlateTile.cpp b/targets/minecraft/world/level/tile/PressurePlateTile.cpp index 8d18d8117..b1e198b1a 100644 --- a/targets/minecraft/world/level/tile/PressurePlateTile.cpp +++ b/targets/minecraft/world/level/tile/PressurePlateTile.cpp @@ -43,7 +43,7 @@ int PressurePlateTile::getSignalStrength(Level* level, int x, int y, int z) { else if (sensitivity == players) entities = level->getEntitiesOfClass(typeid(Player), &at_bb); else - __debugbreak(); // 4J-JEV: We're going to delete something at a random + assert(0); // 4J-JEV: We're going to delete something at a random // location. if (entities != nullptr && !entities->empty()) { diff --git a/targets/minecraft/world/scores/Scoreboard.cpp b/targets/minecraft/world/scores/Scoreboard.cpp index 46e68ec0a..af12ee670 100644 --- a/targets/minecraft/world/scores/Scoreboard.cpp +++ b/targets/minecraft/world/scores/Scoreboard.cpp @@ -14,7 +14,7 @@ Objective* Scoreboard::addObjective(const std::wstring& name, // if (objective != nullptr) // { // #indef _CONTENT_PACKAGE - // __debugbreak(); + // assert(0); // #endif // //throw new IllegalArgumentException("An objective with the name //'" + name + "' already exists!"); diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index c9ba7f71b..afaced233 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -300,8 +300,3 @@ public: void halt() {} void forceReload() {} }; - -class Color { -public: - static int HSBtoRGB(float, float, float) { return 0; } -};